X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
| Revision | 136 (tree) |
|---|---|
| Time | 2016-06-18 23:29:02 |
| Author | |
AI制御クラスの分離を試みる(未完成)、AIの追尾処理のバグ修正、コンソールのコマンドを1個追加(aiinfo)
| @@ -38,30 +38,31 @@ | ||
| 38 | 38 | ctrlid = in_ctrlid; |
| 39 | 39 | ctrlhuman = in_ObjMgr->GeHumanObject(in_ctrlid); |
| 40 | 40 | blocks = in_blocks; |
| 41 | - Points = in_Points; | |
| 42 | 41 | Param = in_Param; |
| 43 | 42 | CollD = in_CollD; |
| 44 | 43 | GameSound = in_GameSound; |
| 45 | 44 | |
| 46 | 45 | battlemode = AI_NORMAL; |
| 47 | - movemode = AI_WAIT; | |
| 48 | - addrx = 0.0f; | |
| 49 | - addry = 0.0f; | |
| 50 | - target_pointid = -1; | |
| 51 | - target_posx = 0.0f; | |
| 52 | - target_posz = 0.0f; | |
| 53 | - target_rx = 0.0f; | |
| 46 | + cautionback_posx = 0.0f; | |
| 47 | + cautionback_posz = 0.0f; | |
| 54 | 48 | total_move = 0.0f; |
| 55 | 49 | waitcnt = 0; |
| 56 | 50 | movejumpcnt = 1*((int)GAMEFPS); |
| 57 | 51 | gotocnt = 0; |
| 58 | - moveturn_mode = 0; | |
| 59 | 52 | longattack = false; |
| 53 | + | |
| 54 | + MoveNavi = new AIMoveNavi; | |
| 55 | + ObjDriver = new AIObjectDriver; | |
| 56 | + MoveNavi->SetClass(in_ObjMgr, in_ctrlid, in_Points); | |
| 57 | + ObjDriver->SetClass(in_ObjMgr, in_ctrlid); | |
| 60 | 58 | } |
| 61 | 59 | |
| 62 | 60 | //! @brief ディストラクタ |
| 63 | 61 | AIcontrol::~AIcontrol() |
| 64 | -{} | |
| 62 | +{ | |
| 63 | + delete MoveNavi; | |
| 64 | + delete ObjDriver; | |
| 65 | +} | |
| 65 | 66 | |
| 66 | 67 | //! @brief 対象クラスを設定 |
| 67 | 68 | //! @attention この関数で設定を行わないと、クラス自体が正しく機能しません。 |
| @@ -71,43 +72,35 @@ | ||
| 71 | 72 | ctrlid = in_ctrlid; |
| 72 | 73 | ctrlhuman = in_ObjMgr->GeHumanObject(in_ctrlid); |
| 73 | 74 | blocks = in_blocks; |
| 74 | - Points = in_Points; | |
| 75 | 75 | Param = in_Param; |
| 76 | 76 | CollD = in_CollD; |
| 77 | 77 | GameSound = in_GameSound; |
| 78 | -} | |
| 79 | 78 | |
| 80 | -//! @brief 人を検索 | |
| 81 | -//! @param in_p4 検索する人の第4パラメータ(認識番号) | |
| 82 | -//! @param out_x X座標を受け取るポインタ | |
| 83 | -//! @param out_z Z座標を受け取るポインタ | |
| 84 | -//! @return 成功:1 失敗:0 | |
| 85 | -int AIcontrol::SearchHumanPos(signed char in_p4, float *out_x, float *out_z) | |
| 86 | -{ | |
| 87 | - float x, z; | |
| 88 | - human* thuman; | |
| 89 | - | |
| 90 | - //人を検索してクラスを取得 | |
| 91 | - thuman = ObjMgr->SearchHuman(in_p4); | |
| 92 | - if( thuman == NULL ){ return 0; } | |
| 93 | - | |
| 94 | - //X・Z座標を取得 | |
| 95 | - thuman->GetPosData(&x, NULL, &z, NULL); | |
| 96 | - *out_x = x; | |
| 97 | - *out_z = z; | |
| 98 | - return 1; | |
| 79 | + MoveNavi->SetClass(in_ObjMgr, in_ctrlid, in_Points); | |
| 80 | + ObjDriver->SetClass(in_ObjMgr, in_ctrlid); | |
| 99 | 81 | } |
| 100 | 82 | |
| 101 | 83 | //! @brief 目標地点に移動しているか確認 |
| 102 | 84 | //! @return 到達:true 非到達:false |
| 103 | -bool AIcontrol::CheckTargetPos() | |
| 85 | +bool AIcontrol::CheckTargetPos(bool back) | |
| 104 | 86 | { |
| 87 | + float target_posx, target_posz; | |
| 88 | + int movemode; | |
| 89 | + if( back == false ){ | |
| 90 | + MoveNavi->GetTargetPos(&target_posx, &target_posz, NULL, &movemode, NULL); | |
| 91 | + } | |
| 92 | + else{ | |
| 93 | + target_posx = cautionback_posx; | |
| 94 | + target_posz = cautionback_posz; | |
| 95 | + movemode = AI_NAVI_MOVE_RUN; | |
| 96 | + } | |
| 97 | + | |
| 105 | 98 | //距離を算出 |
| 106 | 99 | float x = posx - target_posx; |
| 107 | 100 | float z = posz - target_posz; |
| 108 | 101 | float r = x * x + z * z; |
| 109 | 102 | |
| 110 | - if( movemode == AI_TRACKING ){ //追尾中なら | |
| 103 | + if( movemode == AI_NAVI_MOVE_TRACKING ){ //追尾中なら | |
| 111 | 104 | if( r < AI_ARRIVALDIST_TRACKING * AI_ARRIVALDIST_TRACKING ){ |
| 112 | 105 | return true; |
| 113 | 106 | } |
| @@ -121,99 +114,8 @@ | ||
| 121 | 114 | return false; |
| 122 | 115 | } |
| 123 | 116 | |
| 124 | -//! @brief 目標地点を検索 | |
| 125 | -//! @param next 次を検索する | |
| 126 | -//! @return 完了:true 失敗:false | |
| 127 | -bool AIcontrol::SearchTarget(bool next) | |
| 128 | -{ | |
| 129 | - //ポイントの情報を取得 | |
| 130 | - pointdata pdata; | |
| 131 | - if( Points->Getdata(&pdata, target_pointid) != 0 ){ | |
| 132 | - movemode = AI_NULL; | |
| 133 | - return false; | |
| 134 | - } | |
| 135 | - | |
| 136 | - signed char nextpointp4; | |
| 137 | - | |
| 138 | - //次のポイントを検索するなら | |
| 139 | - if( next == true ){ | |
| 140 | - nextpointp4 = pdata.p3; | |
| 141 | - | |
| 142 | - //ランダムパス処理 | |
| 143 | - if( pdata.p1 == 8 ){ | |
| 144 | - if( GetRand(2) == 0 ){ | |
| 145 | - nextpointp4 = pdata.p2; | |
| 146 | - } | |
| 147 | - else{ | |
| 148 | - nextpointp4 = pdata.p3; | |
| 149 | - } | |
| 150 | - movemode = AI_RANDOM; | |
| 151 | - } | |
| 152 | - | |
| 153 | - //ポイントを検索 | |
| 154 | - if( Points->SearchPointdata(&pdata, 0x08, 0, 0, 0, nextpointp4, 0) == 0 ){ | |
| 155 | - return false; | |
| 156 | - } | |
| 157 | - } | |
| 158 | - | |
| 159 | - //ランダムパスなら次へ | |
| 160 | - if( pdata.p1 == 8 ){ | |
| 161 | - target_pointid = pdata.id; | |
| 162 | - movemode = AI_RANDOM; | |
| 163 | - return false; | |
| 164 | - } | |
| 165 | - | |
| 166 | - //人なら座標を取得 | |
| 167 | - if( (pdata.p1 == 1)||(pdata.p1 == 6) ){ | |
| 168 | - SearchHumanPos(pdata.p4, &target_posx, &target_posz); | |
| 169 | - movemode = AI_TRACKING; | |
| 170 | - return true; | |
| 171 | - } | |
| 172 | - | |
| 173 | - //移動パスなら〜 | |
| 174 | - if( pdata.p1 == 3 ){ | |
| 175 | - //情報適用 | |
| 176 | - target_pointid = pdata.id; | |
| 177 | - target_posx = pdata.x; | |
| 178 | - target_posz = pdata.z; | |
| 179 | - target_rx = pdata.r; | |
| 180 | - | |
| 181 | - //移動ステート設定 | |
| 182 | - switch(pdata.p2){ | |
| 183 | - case 0: movemode = AI_WALK; break; | |
| 184 | - case 1: movemode = AI_RUN; break; | |
| 185 | - case 2: movemode = AI_WAIT; break; | |
| 186 | - case 3: | |
| 187 | - movemode = AI_TRACKING; | |
| 188 | - if( next == true ){ | |
| 189 | - nextpointp4 = pdata.p3; | |
| 190 | - | |
| 191 | - //ポイント(人)の情報を取得 | |
| 192 | - if( Points->SearchPointdata(&pdata, 0x08, 0, 0, 0, nextpointp4, 0) == 0 ){ | |
| 193 | - return false; | |
| 194 | - } | |
| 195 | - | |
| 196 | - //情報保存 | |
| 197 | - target_pointid = pdata.id; | |
| 198 | - target_posx = pdata.x; | |
| 199 | - target_posz = pdata.z; | |
| 200 | - } | |
| 201 | - break; | |
| 202 | - case 4: movemode = AI_WAIT; break; | |
| 203 | - case 5: movemode = AI_STOP; break; | |
| 204 | - case 6: movemode = AI_GRENADE; break; | |
| 205 | - case 7: movemode = AI_RUN2; break; | |
| 206 | - default: break; | |
| 207 | - } | |
| 208 | - return true; | |
| 209 | - } | |
| 210 | - | |
| 211 | - movemode = AI_NULL; | |
| 212 | - return false; | |
| 213 | -} | |
| 214 | - | |
| 215 | 117 | //! @brief 目標地点に移動 |
| 216 | -void AIcontrol::MoveTarget() | |
| 118 | +void AIcontrol::MoveTarget(bool back) | |
| 217 | 119 | { |
| 218 | 120 | float r, atan; |
| 219 | 121 | int paramid; |
| @@ -220,6 +122,17 @@ | ||
| 220 | 122 | HumanParameter Paraminfo; |
| 221 | 123 | bool zombie; |
| 222 | 124 | |
| 125 | + float target_posx, target_posz; | |
| 126 | + int movemode; | |
| 127 | + if( back == false ){ | |
| 128 | + MoveNavi->GetTargetPos(&target_posx, &target_posz, NULL, &movemode, NULL); | |
| 129 | + } | |
| 130 | + else{ | |
| 131 | + target_posx = cautionback_posx; | |
| 132 | + target_posz = cautionback_posz; | |
| 133 | + movemode = AI_NAVI_MOVE_RUN; | |
| 134 | + } | |
| 135 | + | |
| 223 | 136 | //ゾンビかどうか判定 |
| 224 | 137 | ctrlhuman->GetParamData(¶mid, NULL, NULL, NULL); |
| 225 | 138 | Param->GetHuman(paramid, &Paraminfo); |
| @@ -231,7 +144,7 @@ | ||
| 231 | 144 | } |
| 232 | 145 | |
| 233 | 146 | //一度全ての動きを止める |
| 234 | - moveturn_mode = 0; | |
| 147 | + ObjDriver->ResetMode(); | |
| 235 | 148 | |
| 236 | 149 | //目標地点への角度を求める |
| 237 | 150 | CheckTargetAngle(posx, 0.0f, posz, rx*-1 + (float)M_PI/2, 0.0f, target_posx, 0.0f, target_posz, 0.0f, &atan, NULL, &r); |
| @@ -238,45 +151,40 @@ | ||
| 238 | 151 | |
| 239 | 152 | //旋回 |
| 240 | 153 | if( atan > DegreeToRadian(0.5f) ){ |
| 241 | - SetFlag(moveturn_mode, AI_CTRL_TURNLEFT); | |
| 154 | + ObjDriver->SetModeFlag(AI_CTRL_TURNLEFT); | |
| 242 | 155 | } |
| 243 | 156 | if( atan < DegreeToRadian(-0.5f) ){ |
| 244 | - SetFlag(moveturn_mode, AI_CTRL_TURNRIGHT); | |
| 157 | + ObjDriver->SetModeFlag(AI_CTRL_TURNRIGHT); | |
| 245 | 158 | } |
| 246 | 159 | |
| 247 | 160 | //前進する |
| 248 | 161 | if( zombie == true ){ |
| 249 | 162 | if( fabs(atan) < DegreeToRadian(20) ){ |
| 250 | - SetFlag(moveturn_mode, AI_CTRL_MOVEWALK); | |
| 163 | + ObjDriver->SetModeFlag(AI_CTRL_MOVEWALK); | |
| 251 | 164 | } |
| 252 | 165 | } |
| 253 | - else if( battlemode == AI_CAUTION ){ | |
| 166 | + else if( movemode == AI_NAVI_MOVE_RUN ){ | |
| 254 | 167 | if( fabs(atan) < DegreeToRadian(50) ){ |
| 255 | - SetFlag(moveturn_mode, AI_CTRL_MOVEFORWARD); | |
| 168 | + ObjDriver->SetModeFlag(AI_CTRL_MOVEFORWARD); | |
| 256 | 169 | } |
| 257 | 170 | } |
| 258 | - else if( movemode == AI_WALK ){ | |
| 259 | - if( fabs(atan) < DegreeToRadian(6) ){ | |
| 260 | - SetFlag(moveturn_mode, AI_CTRL_MOVEWALK); | |
| 261 | - } | |
| 262 | - } | |
| 263 | - else if( (movemode == AI_RUN)||(movemode == AI_RUN2) ){ | |
| 171 | + else if( movemode == AI_NAVI_MOVE_RUN2 ){ | |
| 264 | 172 | if( fabs(atan) < DegreeToRadian(50) ){ |
| 265 | - SetFlag(moveturn_mode, AI_CTRL_MOVEFORWARD); | |
| 173 | + ObjDriver->SetModeFlag(AI_CTRL_MOVEFORWARD); | |
| 266 | 174 | } |
| 267 | 175 | } |
| 268 | - else if( (movemode == AI_WAIT)||(movemode == AI_STOP) ){ | |
| 176 | + else if( movemode == AI_NAVI_MOVE_WALK ){ | |
| 269 | 177 | if( fabs(atan) < DegreeToRadian(6) ){ |
| 270 | - SetFlag(moveturn_mode, AI_CTRL_MOVEWALK); | |
| 178 | + ObjDriver->SetModeFlag(AI_CTRL_MOVEWALK); | |
| 271 | 179 | } |
| 272 | 180 | } |
| 273 | - else{ //movemode == AI_TRACKING | |
| 181 | + else if( movemode == AI_NAVI_MOVE_TRACKING ){ | |
| 274 | 182 | if( fabs(atan) < DegreeToRadian(20) ){ |
| 275 | 183 | if( r < (AI_ARRIVALDIST_WALKTRACKING * AI_ARRIVALDIST_WALKTRACKING) ){ |
| 276 | - SetFlag(moveturn_mode, AI_CTRL_MOVEWALK); | |
| 184 | + ObjDriver->SetModeFlag(AI_CTRL_MOVEWALK); | |
| 277 | 185 | } |
| 278 | 186 | else{ |
| 279 | - SetFlag(moveturn_mode, AI_CTRL_MOVEFORWARD); | |
| 187 | + ObjDriver->SetModeFlag(AI_CTRL_MOVEFORWARD); | |
| 280 | 188 | } |
| 281 | 189 | } |
| 282 | 190 | } |
| @@ -290,8 +198,8 @@ | ||
| 290 | 198 | if( GetRand(28) == 0 ){ |
| 291 | 199 | if( ctrlhuman->GetMovemode(true) != 0 ){ |
| 292 | 200 | if( ctrlhuman->GetTotalMove() - total_move < 0.1f ){ |
| 293 | - if( GetRand(2) == 0 ){ SetFlag(moveturn_mode, AI_CTRL_TURNRIGHT); } | |
| 294 | - else{ SetFlag(moveturn_mode, AI_CTRL_TURNLEFT); } | |
| 201 | + if( GetRand(2) == 0 ){ ObjDriver->SetModeFlag(AI_CTRL_TURNRIGHT); } | |
| 202 | + else{ ObjDriver->SetModeFlag(AI_CTRL_TURNLEFT); } | |
| 295 | 203 | } |
| 296 | 204 | } |
| 297 | 205 | } |
| @@ -299,27 +207,36 @@ | ||
| 299 | 207 | } |
| 300 | 208 | |
| 301 | 209 | //! @brief 目標地点に移動(優先的な走り用) |
| 302 | -void AIcontrol::MoveTarget2() | |
| 210 | +void AIcontrol::MoveTarget2(bool back) | |
| 303 | 211 | { |
| 304 | 212 | float atan; |
| 305 | 213 | |
| 214 | + float target_posx, target_posz; | |
| 215 | + if( back == false ){ | |
| 216 | + MoveNavi->GetTargetPos(&target_posx, &target_posz, NULL, NULL, NULL); | |
| 217 | + } | |
| 218 | + else{ | |
| 219 | + target_posx = cautionback_posx; | |
| 220 | + target_posz = cautionback_posz; | |
| 221 | + } | |
| 222 | + | |
| 306 | 223 | //目標地点への角度を求める |
| 307 | 224 | CheckTargetAngle(posx, 0.0f, posz, rx*-1 + (float)M_PI/2, 0.0f, target_posx, 0.0f, target_posz, 0.0f, &atan, NULL, NULL); |
| 308 | 225 | |
| 309 | 226 | //前後移動の処理 |
| 310 | 227 | if( fabs(atan) < DegreeToRadian(56) ){ |
| 311 | - SetFlag(moveturn_mode, AI_CTRL_MOVEFORWARD); | |
| 228 | + ObjDriver->SetModeFlag(AI_CTRL_MOVEFORWARD); | |
| 312 | 229 | } |
| 313 | 230 | if( fabs(atan) > DegreeToRadian(123.5f) ){ |
| 314 | - SetFlag(moveturn_mode, AI_CTRL_MOVEBACKWARD); | |
| 231 | + ObjDriver->SetModeFlag(AI_CTRL_MOVEBACKWARD); | |
| 315 | 232 | } |
| 316 | 233 | |
| 317 | 234 | //左右移動の処理 |
| 318 | 235 | if( (DegreeToRadian(-146) < atan)&&(atan < DegreeToRadian(-33)) ){ |
| 319 | - SetFlag(moveturn_mode, AI_CTRL_TURNRIGHT); | |
| 236 | + ObjDriver->SetModeFlag(AI_CTRL_TURNRIGHT); | |
| 320 | 237 | } |
| 321 | 238 | if( (DegreeToRadian(33) < atan)&&(atan < DegreeToRadian(146)) ){ |
| 322 | - SetFlag(moveturn_mode, AI_CTRL_TURNLEFT); | |
| 239 | + ObjDriver->SetModeFlag(AI_CTRL_TURNLEFT); | |
| 323 | 240 | } |
| 324 | 241 | |
| 325 | 242 | //ジャンプ |
| @@ -331,8 +248,8 @@ | ||
| 331 | 248 | if( GetRand(28) == 0 ){ |
| 332 | 249 | if( ctrlhuman->GetMovemode(true) != 0 ){ |
| 333 | 250 | if( ctrlhuman->GetTotalMove() - total_move < 0.1f ){ |
| 334 | - if( GetRand(2) == 0 ){ SetFlag(moveturn_mode, AI_CTRL_TURNRIGHT); } | |
| 335 | - else{ SetFlag(moveturn_mode, AI_CTRL_TURNLEFT); } | |
| 251 | + if( GetRand(2) == 0 ){ ObjDriver->SetModeFlag(AI_CTRL_TURNRIGHT); } | |
| 252 | + else{ ObjDriver->SetModeFlag(AI_CTRL_TURNLEFT); } | |
| 336 | 253 | } |
| 337 | 254 | } |
| 338 | 255 | } |
| @@ -357,16 +274,16 @@ | ||
| 357 | 274 | |
| 358 | 275 | //ランダムに移動を始める |
| 359 | 276 | if( GetRand(forwardstart) == 0 ){ |
| 360 | - SetFlag(moveturn_mode, AI_CTRL_MOVEFORWARD); | |
| 277 | + ObjDriver->SetModeFlag(AI_CTRL_MOVEFORWARD); | |
| 361 | 278 | } |
| 362 | 279 | if( GetRand(backstart) == 0 ){ |
| 363 | - SetFlag(moveturn_mode, AI_CTRL_MOVEBACKWARD); | |
| 280 | + ObjDriver->SetModeFlag(AI_CTRL_MOVEBACKWARD); | |
| 364 | 281 | } |
| 365 | 282 | if( GetRand(sidestart) == 0 ){ |
| 366 | - SetFlag(moveturn_mode, AI_CTRL_MOVELEFT); | |
| 283 | + ObjDriver->SetModeFlag(AI_CTRL_MOVELEFT); | |
| 367 | 284 | } |
| 368 | 285 | if( GetRand(sidestart) == 0 ){ |
| 369 | - SetFlag(moveturn_mode, AI_CTRL_MOVERIGHT); | |
| 286 | + ObjDriver->SetModeFlag(AI_CTRL_MOVERIGHT); | |
| 370 | 287 | } |
| 371 | 288 | |
| 372 | 289 | //武器を持っておらず、手ぶらならば |
| @@ -373,12 +290,12 @@ | ||
| 373 | 290 | if( ctrlhuman->GetMainWeaponTypeNO() == ID_WEAPON_NONE ){ |
| 374 | 291 | // 1/80の確率で下がり始める |
| 375 | 292 | if( GetRand(80) == 0 ){ |
| 376 | - SetFlag(moveturn_mode, AI_CTRL_MOVEBACKWARD); | |
| 293 | + ObjDriver->SetModeFlag(AI_CTRL_MOVEBACKWARD); | |
| 377 | 294 | } |
| 378 | 295 | } |
| 379 | 296 | |
| 380 | 297 | // 1/3の確率か、移動フラグが設定されていたら |
| 381 | - if( (GetRand(3) == 0)||(GetFlag(moveturn_mode, (AI_CTRL_MOVEFORWARD | AI_CTRL_MOVEBACKWARD | AI_CTRL_MOVELEFT | AI_CTRL_MOVERIGHT))) ){ | |
| 298 | + if( (GetRand(3) == 0)||(ObjDriver->GetModeFlag(AI_CTRL_MOVEFORWARD | AI_CTRL_MOVEBACKWARD | AI_CTRL_MOVELEFT | AI_CTRL_MOVERIGHT)) ){ | |
| 382 | 299 | float vx, vz; |
| 383 | 300 | float Dist; |
| 384 | 301 |
| @@ -391,8 +308,8 @@ | ||
| 391 | 308 | (CollD->CheckALLBlockIntersectDummyRay(posx, posy - 1.0f, posz, vx, 0, vz, NULL, NULL, &Dist, HUMAN_MAPCOLLISION_R) == false) //足元にブロックがない(落ちる) |
| 392 | 309 | ){ |
| 393 | 310 | //前進フラグを削除し、後退フラグを設定 |
| 394 | - DelFlag(moveturn_mode, AI_CTRL_MOVEFORWARD); | |
| 395 | - SetFlag(moveturn_mode, AI_CTRL_MOVEBACKWARD); | |
| 311 | + ObjDriver->DelModeFlag(AI_CTRL_MOVEFORWARD); | |
| 312 | + ObjDriver->SetModeFlag(AI_CTRL_MOVEBACKWARD); | |
| 396 | 313 | } |
| 397 | 314 | |
| 398 | 315 | //後方向のベクトルを計算 |
| @@ -403,8 +320,8 @@ | ||
| 403 | 320 | (CollD->CheckALLBlockIntersectDummyRay(posx, posy - 1.0f, posz, vx, 0, vz, NULL, NULL, &Dist, HUMAN_MAPCOLLISION_R) == false) //足元にブロックがない(落ちる) |
| 404 | 321 | ){ |
| 405 | 322 | //後退フラグを削除し、前進フラグを設定 |
| 406 | - DelFlag(moveturn_mode, AI_CTRL_MOVEBACKWARD); | |
| 407 | - SetFlag(moveturn_mode, AI_CTRL_MOVEFORWARD); | |
| 323 | + ObjDriver->DelModeFlag(AI_CTRL_MOVEBACKWARD); | |
| 324 | + ObjDriver->SetModeFlag(AI_CTRL_MOVEFORWARD); | |
| 408 | 325 | } |
| 409 | 326 | } |
| 410 | 327 | else{ |
| @@ -416,8 +333,8 @@ | ||
| 416 | 333 | (CollD->CheckALLBlockIntersectDummyRay(posx, posy - 1.0f, posz, vx, 0, vz, NULL, NULL, &Dist, HUMAN_MAPCOLLISION_R) == false) //足元にブロックがない(落ちる) |
| 417 | 334 | ){ |
| 418 | 335 | //右移動フラグを削除し、左移動フラグを設定 |
| 419 | - DelFlag(moveturn_mode, AI_CTRL_MOVERIGHT); | |
| 420 | - SetFlag(moveturn_mode, AI_CTRL_MOVELEFT); | |
| 336 | + ObjDriver->DelModeFlag(AI_CTRL_MOVERIGHT); | |
| 337 | + ObjDriver->SetModeFlag(AI_CTRL_MOVELEFT); | |
| 421 | 338 | } |
| 422 | 339 | |
| 423 | 340 | vx = cos(rx*-1 + (float)M_PI); |
| @@ -427,8 +344,8 @@ | ||
| 427 | 344 | (CollD->CheckALLBlockIntersectDummyRay(posx, posy - 1.0f, posz, vx, 0, vz, NULL, NULL, &Dist, HUMAN_MAPCOLLISION_R) == false) //足元にブロックがない(落ちる) |
| 428 | 345 | ){ |
| 429 | 346 | //左移動フラグを削除し、右移動フラグを設定 |
| 430 | - DelFlag(moveturn_mode, AI_CTRL_MOVELEFT); | |
| 431 | - SetFlag(moveturn_mode, AI_CTRL_MOVERIGHT); | |
| 347 | + ObjDriver->DelModeFlag(AI_CTRL_MOVELEFT); | |
| 348 | + ObjDriver->SetModeFlag(AI_CTRL_MOVERIGHT); | |
| 432 | 349 | } |
| 433 | 350 | } |
| 434 | 351 | } |
| @@ -446,9 +363,9 @@ | ||
| 446 | 363 | |
| 447 | 364 | //敵に近づきすぎたなら後退する |
| 448 | 365 | if( r < 20.0f * 20.0f ){ |
| 449 | - DelFlag(moveturn_mode, AI_CTRL_MOVEFORWARD); | |
| 366 | + ObjDriver->DelModeFlag(AI_CTRL_MOVEFORWARD); | |
| 450 | 367 | if( GetRand(70) == 0 ){ |
| 451 | - SetFlag(moveturn_mode, AI_CTRL_MOVEBACKWARD); | |
| 368 | + ObjDriver->SetModeFlag(AI_CTRL_MOVEBACKWARD); | |
| 452 | 369 | } |
| 453 | 370 | } |
| 454 | 371 | } |
| @@ -459,6 +376,10 @@ | ||
| 459 | 376 | { |
| 460 | 377 | int turnstart, turnstop; |
| 461 | 378 | |
| 379 | + float target_rx; | |
| 380 | + int pointmode; | |
| 381 | + MoveNavi->GetTargetPos(NULL, NULL, &target_rx, NULL, &pointmode); | |
| 382 | + | |
| 462 | 383 | //回転の開始・終了確率を設定 |
| 463 | 384 | if( battlemode == AI_ACTION ){ |
| 464 | 385 | return; |
| @@ -468,7 +389,7 @@ | ||
| 468 | 389 | turnstop = 20; |
| 469 | 390 | } |
| 470 | 391 | else{ |
| 471 | - if( movemode == AI_TRACKING ){ turnstart = 65; } | |
| 392 | + if( pointmode == AI_NAVI_POINT_TRACKING ){ turnstart = 65; } | |
| 472 | 393 | else{ turnstart = 85; } |
| 473 | 394 | turnstop = 18; |
| 474 | 395 | } |
| @@ -475,13 +396,13 @@ | ||
| 475 | 396 | |
| 476 | 397 | //ランダムに回転を始める |
| 477 | 398 | if( GetRand(turnstart) == 0 ){ |
| 478 | - SetFlag(moveturn_mode, AI_CTRL_TURNRIGHT); | |
| 399 | + ObjDriver->SetModeFlag(AI_CTRL_TURNRIGHT); | |
| 479 | 400 | } |
| 480 | 401 | if( GetRand(turnstart) == 0 ){ |
| 481 | - SetFlag(moveturn_mode, AI_CTRL_TURNLEFT); | |
| 402 | + ObjDriver->SetModeFlag(AI_CTRL_TURNLEFT); | |
| 482 | 403 | } |
| 483 | 404 | |
| 484 | - if( (battlemode == AI_NORMAL)&&(movemode == AI_WAIT) ){ | |
| 405 | + if( (battlemode == AI_NORMAL)&&(pointmode == AI_NAVI_POINT_WAIT) ){ | |
| 485 | 406 | //ランダムにポイントの方を向こうとする |
| 486 | 407 | //「ポイントの方向を少し重視する」の再現 |
| 487 | 408 | if( GetRand(80) == 0 ){ |
| @@ -491,10 +412,10 @@ | ||
| 491 | 412 | for(; tr < (float)M_PI*-1; tr += (float)M_PI*2){} |
| 492 | 413 | |
| 493 | 414 | if( tr > 0.0f ){ |
| 494 | - SetFlag(moveturn_mode, AI_CTRL_TURNRIGHT); | |
| 415 | + ObjDriver->SetModeFlag(AI_CTRL_TURNRIGHT); | |
| 495 | 416 | } |
| 496 | 417 | if( tr < 0.0f ){ |
| 497 | - SetFlag(moveturn_mode, AI_CTRL_TURNLEFT); | |
| 418 | + ObjDriver->SetModeFlag(AI_CTRL_TURNLEFT); | |
| 498 | 419 | } |
| 499 | 420 | } |
| 500 | 421 | } |
| @@ -501,10 +422,10 @@ | ||
| 501 | 422 | |
| 502 | 423 | //回転をランダムに止める |
| 503 | 424 | if( GetRand(turnstop) == 0 ){ |
| 504 | - DelFlag(moveturn_mode, AI_CTRL_TURNRIGHT); | |
| 425 | + ObjDriver->DelModeFlag(AI_CTRL_TURNRIGHT); | |
| 505 | 426 | } |
| 506 | 427 | if( GetRand(turnstop) == 0 ){ |
| 507 | - DelFlag(moveturn_mode, AI_CTRL_TURNLEFT); | |
| 428 | + ObjDriver->DelModeFlag(AI_CTRL_TURNLEFT); | |
| 508 | 429 | } |
| 509 | 430 | } |
| 510 | 431 |
| @@ -514,20 +435,23 @@ | ||
| 514 | 435 | float tr; |
| 515 | 436 | bool returnflag = false; |
| 516 | 437 | |
| 438 | + float target_rx; | |
| 439 | + MoveNavi->GetTargetPos(NULL, NULL, &target_rx, NULL, NULL); | |
| 440 | + | |
| 517 | 441 | tr = target_rx - rx; |
| 518 | 442 | for(; tr > (float)M_PI; tr -= (float)M_PI*2){} |
| 519 | 443 | for(; tr < (float)M_PI*-1; tr += (float)M_PI*2){} |
| 520 | 444 | |
| 521 | - DelFlag(moveturn_mode, AI_CTRL_TURNRIGHT); | |
| 522 | - DelFlag(moveturn_mode, AI_CTRL_TURNLEFT); | |
| 445 | + ObjDriver->DelModeFlag(AI_CTRL_TURNRIGHT); | |
| 446 | + ObjDriver->DelModeFlag(AI_CTRL_TURNLEFT); | |
| 523 | 447 | |
| 524 | 448 | //旋回 |
| 525 | 449 | if( tr > DegreeToRadian(2.5f) ){ |
| 526 | - SetFlag(moveturn_mode, AI_CTRL_TURNRIGHT); | |
| 450 | + ObjDriver->SetModeFlag(AI_CTRL_TURNRIGHT); | |
| 527 | 451 | returnflag = false; |
| 528 | 452 | } |
| 529 | 453 | if( tr < DegreeToRadian(-2.5f) ){ |
| 530 | - SetFlag(moveturn_mode, AI_CTRL_TURNLEFT); | |
| 454 | + ObjDriver->SetModeFlag(AI_CTRL_TURNLEFT); | |
| 531 | 455 | returnflag = false; |
| 532 | 456 | } |
| 533 | 457 |
| @@ -650,12 +574,12 @@ | ||
| 650 | 574 | if( randr != 0 ){ |
| 651 | 575 | //旋回 |
| 652 | 576 | if( atanx > 0.0f ){ |
| 653 | - SetFlag(moveturn_mode, AI_CTRL_TURNLEFT); | |
| 654 | - DelFlag(moveturn_mode, AI_CTRL_TURNRIGHT); | |
| 577 | + ObjDriver->SetModeFlag(AI_CTRL_TURNLEFT); | |
| 578 | + ObjDriver->DelModeFlag(AI_CTRL_TURNRIGHT); | |
| 655 | 579 | } |
| 656 | 580 | if( atanx < 0.0f ){ |
| 657 | - SetFlag(moveturn_mode, AI_CTRL_TURNRIGHT); | |
| 658 | - DelFlag(moveturn_mode, AI_CTRL_TURNLEFT); | |
| 581 | + ObjDriver->SetModeFlag(AI_CTRL_TURNRIGHT); | |
| 582 | + ObjDriver->DelModeFlag(AI_CTRL_TURNLEFT); | |
| 659 | 583 | } |
| 660 | 584 | |
| 661 | 585 | //腕の角度 |
| @@ -664,12 +588,12 @@ | ||
| 664 | 588 | |
| 665 | 589 | //旋回 |
| 666 | 590 | if( ry < 0.0f ){ |
| 667 | - SetFlag(moveturn_mode, AI_CTRL_TURNUP); | |
| 668 | - DelFlag(moveturn_mode, AI_CTRL_TURNDOWN); | |
| 591 | + ObjDriver->SetModeFlag(AI_CTRL_TURNUP); | |
| 592 | + ObjDriver->DelModeFlag(AI_CTRL_TURNDOWN); | |
| 669 | 593 | } |
| 670 | 594 | if( ry > 0.0f ){ |
| 671 | - SetFlag(moveturn_mode, AI_CTRL_TURNDOWN); | |
| 672 | - DelFlag(moveturn_mode, AI_CTRL_TURNUP); | |
| 595 | + ObjDriver->SetModeFlag(AI_CTRL_TURNDOWN); | |
| 596 | + ObjDriver->DelModeFlag(AI_CTRL_TURNUP); | |
| 673 | 597 | } |
| 674 | 598 | } |
| 675 | 599 | else{ |
| @@ -677,24 +601,24 @@ | ||
| 677 | 601 | if( weaponid == ID_WEAPON_NONE ){ |
| 678 | 602 | if( EnemyHuman->GetMainWeaponTypeNO() == ID_WEAPON_NONE ){ //敵も手ぶらならば〜 |
| 679 | 603 | //下に向け続ける |
| 680 | - SetFlag(moveturn_mode, AI_CTRL_TURNDOWN); | |
| 681 | - DelFlag(moveturn_mode, AI_CTRL_TURNUP); | |
| 604 | + ObjDriver->SetModeFlag(AI_CTRL_TURNDOWN); | |
| 605 | + ObjDriver->DelModeFlag(AI_CTRL_TURNUP); | |
| 682 | 606 | } |
| 683 | 607 | else{ //敵が武器を持っていれば〜 |
| 684 | 608 | //上に向け続ける |
| 685 | - SetFlag(moveturn_mode, AI_CTRL_TURNUP); | |
| 686 | - DelFlag(moveturn_mode, AI_CTRL_TURNDOWN); | |
| 609 | + ObjDriver->SetModeFlag(AI_CTRL_TURNUP); | |
| 610 | + ObjDriver->DelModeFlag(AI_CTRL_TURNDOWN); | |
| 687 | 611 | } |
| 688 | 612 | } |
| 689 | 613 | else{ |
| 690 | 614 | //旋回 |
| 691 | 615 | if( atany > 0.0f ){ |
| 692 | - SetFlag(moveturn_mode, AI_CTRL_TURNUP); | |
| 693 | - DelFlag(moveturn_mode, AI_CTRL_TURNDOWN); | |
| 616 | + ObjDriver->SetModeFlag(AI_CTRL_TURNUP); | |
| 617 | + ObjDriver->DelModeFlag(AI_CTRL_TURNDOWN); | |
| 694 | 618 | } |
| 695 | 619 | if( atany < 0.0f ){ |
| 696 | - SetFlag(moveturn_mode, AI_CTRL_TURNDOWN); | |
| 697 | - DelFlag(moveturn_mode, AI_CTRL_TURNUP); | |
| 620 | + ObjDriver->SetModeFlag(AI_CTRL_TURNDOWN); | |
| 621 | + ObjDriver->DelModeFlag(AI_CTRL_TURNUP); | |
| 698 | 622 | } |
| 699 | 623 | } |
| 700 | 624 | } |
| @@ -705,7 +629,7 @@ | ||
| 705 | 629 | if( weaponid == ID_WEAPON_NONE ){ |
| 706 | 630 | //一定の確率で後退する |
| 707 | 631 | if( GetRand(80) == 0 ){ |
| 708 | - SetFlag(moveturn_mode, AI_CTRL_MOVEBACKWARD); | |
| 632 | + ObjDriver->SetModeFlag(AI_CTRL_MOVEBACKWARD); | |
| 709 | 633 | } |
| 710 | 634 | } |
| 711 | 635 | } |
| @@ -715,9 +639,9 @@ | ||
| 715 | 639 | float y = posy2 - ty; |
| 716 | 640 | |
| 717 | 641 | //もし走っていれば、一度歩きに切り替える |
| 718 | - if( GetFlag(moveturn_mode, AI_CTRL_MOVEFORWARD) ){ | |
| 719 | - DelFlag(moveturn_mode, AI_CTRL_MOVEFORWARD); | |
| 720 | - SetFlag(moveturn_mode, AI_CTRL_MOVEWALK); | |
| 642 | + if( ObjDriver->GetModeFlag(AI_CTRL_MOVEFORWARD) ){ | |
| 643 | + ObjDriver->DelModeFlag(AI_CTRL_MOVEFORWARD); | |
| 644 | + ObjDriver->SetModeFlag(AI_CTRL_MOVEWALK); | |
| 721 | 645 | } |
| 722 | 646 | |
| 723 | 647 | //敵に向かって前進する |
| @@ -724,11 +648,11 @@ | ||
| 724 | 648 | if( fabs(atanx) <= DegreeToRadian(25) ){ |
| 725 | 649 | if( (fabs(atanx) <= DegreeToRadian(15)) && (r < 24.0f*24.0f) && (actioncnt%50 > 20) ){ |
| 726 | 650 | //歩きを取り消し、走る |
| 727 | - SetFlag(moveturn_mode, AI_CTRL_MOVEFORWARD); | |
| 728 | - DelFlag(moveturn_mode, AI_CTRL_MOVEWALK); | |
| 651 | + ObjDriver->SetModeFlag(AI_CTRL_MOVEFORWARD); | |
| 652 | + ObjDriver->DelModeFlag(AI_CTRL_MOVEWALK); | |
| 729 | 653 | } |
| 730 | 654 | else{ |
| 731 | - SetFlag(moveturn_mode, AI_CTRL_MOVEWALK); | |
| 655 | + ObjDriver->SetModeFlag(AI_CTRL_MOVEWALK); | |
| 732 | 656 | } |
| 733 | 657 | } |
| 734 | 658 |
| @@ -787,7 +711,7 @@ | ||
| 787 | 711 | //AIレベルごとに調整 |
| 788 | 712 | ShotAngle += DegreeToRadian(0.5f) * LevelParam->limitserror; |
| 789 | 713 | |
| 790 | - if( movemode == AI_RUN2 ){ | |
| 714 | + if( MoveNavi->GetRun2() == true ){ | |
| 791 | 715 | ShotAngle *= 1.5f; |
| 792 | 716 | } |
| 793 | 717 | } |
| @@ -827,7 +751,7 @@ | ||
| 827 | 751 | if( r < 200.0f * 200.0f ){ |
| 828 | 752 | longattack = false; |
| 829 | 753 | } |
| 830 | - if( (r > 200.0f * 200.0f)&&(movemode != AI_RUN2) ){ | |
| 754 | + if( (r > 200.0f * 200.0f)&&(MoveNavi->GetRun2() == false) ){ | |
| 831 | 755 | longattack = true; |
| 832 | 756 | } |
| 833 | 757 |
| @@ -943,17 +867,17 @@ | ||
| 943 | 867 | int forward, back, side, updown, rightleft; |
| 944 | 868 | |
| 945 | 869 | if( battlemode == AI_ACTION ){ //攻撃中 |
| 946 | - if( movemode == AI_RUN2 ){ //優先的な走り | |
| 947 | - DelFlag(moveturn_mode, AI_CTRL_MOVEFORWARD); | |
| 948 | - DelFlag(moveturn_mode, AI_CTRL_MOVEBACKWARD); | |
| 949 | - DelFlag(moveturn_mode, AI_CTRL_MOVELEFT); | |
| 950 | - DelFlag(moveturn_mode, AI_CTRL_MOVERIGHT); | |
| 951 | - DelFlag(moveturn_mode, AI_CTRL_TURNUP); | |
| 952 | - DelFlag(moveturn_mode, AI_CTRL_TURNDOWN); | |
| 953 | - DelFlag(moveturn_mode, AI_CTRL_TURNLEFT); | |
| 954 | - DelFlag(moveturn_mode, AI_CTRL_TURNRIGHT); | |
| 870 | + if( MoveNavi->GetRun2() == true ){ //優先的な走り | |
| 871 | + ObjDriver->DelModeFlag(AI_CTRL_MOVEFORWARD); | |
| 872 | + ObjDriver->DelModeFlag(AI_CTRL_MOVEBACKWARD); | |
| 873 | + ObjDriver->DelModeFlag(AI_CTRL_MOVELEFT); | |
| 874 | + ObjDriver->DelModeFlag(AI_CTRL_MOVERIGHT); | |
| 875 | + ObjDriver->DelModeFlag(AI_CTRL_TURNUP); | |
| 876 | + ObjDriver->DelModeFlag(AI_CTRL_TURNDOWN); | |
| 877 | + ObjDriver->DelModeFlag(AI_CTRL_TURNLEFT); | |
| 878 | + ObjDriver->DelModeFlag(AI_CTRL_TURNRIGHT); | |
| 955 | 879 | if( GetRand(3) == 0 ){ |
| 956 | - DelFlag(moveturn_mode, AI_CTRL_MOVEWALK); | |
| 880 | + ObjDriver->DelModeFlag(AI_CTRL_MOVEWALK); | |
| 957 | 881 | } |
| 958 | 882 | return; |
| 959 | 883 | } |
| @@ -991,87 +915,36 @@ | ||
| 991 | 915 | |
| 992 | 916 | //移動をランダムに止める |
| 993 | 917 | if( GetRand(forward) == 0 ){ |
| 994 | - DelFlag(moveturn_mode, AI_CTRL_MOVEFORWARD); | |
| 918 | + ObjDriver->DelModeFlag(AI_CTRL_MOVEFORWARD); | |
| 995 | 919 | } |
| 996 | 920 | if( GetRand(back) == 0 ){ |
| 997 | - DelFlag(moveturn_mode, AI_CTRL_MOVEBACKWARD); | |
| 921 | + ObjDriver->DelModeFlag(AI_CTRL_MOVEBACKWARD); | |
| 998 | 922 | } |
| 999 | 923 | if( GetRand(side) == 0 ){ |
| 1000 | - DelFlag(moveturn_mode, AI_CTRL_MOVELEFT); | |
| 924 | + ObjDriver->DelModeFlag(AI_CTRL_MOVELEFT); | |
| 1001 | 925 | } |
| 1002 | 926 | if( GetRand(side) == 0 ){ |
| 1003 | - DelFlag(moveturn_mode, AI_CTRL_MOVERIGHT); | |
| 927 | + ObjDriver->DelModeFlag(AI_CTRL_MOVERIGHT); | |
| 1004 | 928 | } |
| 1005 | 929 | if( GetRand(3) == 0 ){ |
| 1006 | - DelFlag(moveturn_mode, AI_CTRL_MOVEWALK); | |
| 930 | + ObjDriver->DelModeFlag(AI_CTRL_MOVEWALK); | |
| 1007 | 931 | } |
| 1008 | 932 | |
| 1009 | 933 | //回転をランダムに止める |
| 1010 | 934 | if( GetRand(updown) == 0 ){ |
| 1011 | - DelFlag(moveturn_mode, AI_CTRL_TURNUP); | |
| 935 | + ObjDriver->DelModeFlag(AI_CTRL_TURNUP); | |
| 1012 | 936 | } |
| 1013 | 937 | if( GetRand(updown) == 0 ){ |
| 1014 | - DelFlag(moveturn_mode, AI_CTRL_TURNDOWN); | |
| 938 | + ObjDriver->DelModeFlag(AI_CTRL_TURNDOWN); | |
| 1015 | 939 | } |
| 1016 | 940 | if( GetRand(rightleft) == 0 ){ |
| 1017 | - DelFlag(moveturn_mode, AI_CTRL_TURNLEFT); | |
| 941 | + ObjDriver->DelModeFlag(AI_CTRL_TURNLEFT); | |
| 1018 | 942 | } |
| 1019 | 943 | if( GetRand(rightleft) == 0 ){ |
| 1020 | - DelFlag(moveturn_mode, AI_CTRL_TURNRIGHT); | |
| 944 | + ObjDriver->DelModeFlag(AI_CTRL_TURNRIGHT); | |
| 1021 | 945 | } |
| 1022 | 946 | } |
| 1023 | 947 | |
| 1024 | -//! @brief 移動や方向転換を実行 | |
| 1025 | -void AIcontrol::ControlMoveTurn() | |
| 1026 | -{ | |
| 1027 | - //移動の実行 | |
| 1028 | - if( GetFlag(moveturn_mode, AI_CTRL_MOVEFORWARD) ){ | |
| 1029 | - ObjMgr->MoveForward(ctrlid); | |
| 1030 | - } | |
| 1031 | - if( GetFlag(moveturn_mode, AI_CTRL_MOVEBACKWARD) ){ | |
| 1032 | - ObjMgr->MoveBack(ctrlid); | |
| 1033 | - } | |
| 1034 | - if( GetFlag(moveturn_mode, AI_CTRL_MOVELEFT) ){ | |
| 1035 | - ObjMgr->MoveLeft(ctrlid); | |
| 1036 | - } | |
| 1037 | - if( GetFlag(moveturn_mode, AI_CTRL_MOVERIGHT) ){ | |
| 1038 | - ObjMgr->MoveRight(ctrlid); | |
| 1039 | - } | |
| 1040 | - if( GetFlag(moveturn_mode, AI_CTRL_MOVEWALK) ){ | |
| 1041 | - ObjMgr->MoveWalk(ctrlid); | |
| 1042 | - } | |
| 1043 | - | |
| 1044 | - //方向転換の実行(回転速度の加算) | |
| 1045 | - if( GetFlag(moveturn_mode, AI_CTRL_TURNUP) ){ | |
| 1046 | - addry += AI_ADDTURNRAD; | |
| 1047 | - } | |
| 1048 | - if( GetFlag(moveturn_mode, AI_CTRL_TURNDOWN) ){ | |
| 1049 | - addry -= AI_ADDTURNRAD; | |
| 1050 | - } | |
| 1051 | - if( GetFlag(moveturn_mode, AI_CTRL_TURNLEFT) ){ | |
| 1052 | - addrx -= AI_ADDTURNRAD; | |
| 1053 | - } | |
| 1054 | - if( GetFlag(moveturn_mode, AI_CTRL_TURNRIGHT) ){ | |
| 1055 | - addrx += AI_ADDTURNRAD; | |
| 1056 | - } | |
| 1057 | - | |
| 1058 | - //角度に加算 | |
| 1059 | - rx += addrx; | |
| 1060 | - ry += addry; | |
| 1061 | - | |
| 1062 | - //回転速度の減衰 | |
| 1063 | - addrx *= 0.8f; | |
| 1064 | - addry *= 0.8f; | |
| 1065 | - | |
| 1066 | - //0.0fへ補正 | |
| 1067 | - if( fabs(addrx) < DegreeToRadian(0.2f) ){ addrx = 0.0f; } | |
| 1068 | - if( fabs(addry) < DegreeToRadian(0.2f) ){ addry = 0.0f; } | |
| 1069 | - | |
| 1070 | - //縦の回転範囲を収める | |
| 1071 | - if( ry > DegreeToRadian(70) ){ ry = DegreeToRadian(70); } | |
| 1072 | - if( ry < DegreeToRadian(-70) ){ ry = DegreeToRadian(-70); } | |
| 1073 | -} | |
| 1074 | - | |
| 1075 | 948 | //! @brief 武器をリロード・捨てる |
| 1076 | 949 | //! @return 捨てる:1 リロード:2 持ち替える:3 FULL/SEMI切り替え:4 何もしない:0 |
| 1077 | 950 | int AIcontrol::ControlWeapon() |
| @@ -1250,11 +1123,11 @@ | ||
| 1250 | 1123 | float atan_rx, atan_ry; |
| 1251 | 1124 | |
| 1252 | 1125 | //パスと人の高さを取得 |
| 1253 | - Points->Getdata(&pdata, target_pointid); | |
| 1126 | + MoveNavi->GetPathPointData(&pdata); | |
| 1254 | 1127 | posy2 = posy + VIEW_HEIGHT; |
| 1255 | 1128 | |
| 1256 | 1129 | //一度全ての動きを止める |
| 1257 | - moveturn_mode = 0; | |
| 1130 | + ObjDriver->ResetMode(); | |
| 1258 | 1131 | |
| 1259 | 1132 | //目標地点への角度を求める |
| 1260 | 1133 | CheckTargetAngle(posx, posy2, posz, rx*-1 + (float)M_PI/2, ry, pdata.x, pdata.y, pdata.z, 0.0f, &atan_rx, &atan_ry, NULL); |
| @@ -1261,16 +1134,16 @@ | ||
| 1261 | 1134 | |
| 1262 | 1135 | //旋回 |
| 1263 | 1136 | if( atan_rx > 0.0f ){ |
| 1264 | - SetFlag(moveturn_mode, AI_CTRL_TURNLEFT); | |
| 1137 | + ObjDriver->SetModeFlag(AI_CTRL_TURNLEFT); | |
| 1265 | 1138 | } |
| 1266 | 1139 | if( atan_rx < 0.0f ){ |
| 1267 | - SetFlag(moveturn_mode, AI_CTRL_TURNRIGHT); | |
| 1140 | + ObjDriver->SetModeFlag(AI_CTRL_TURNRIGHT); | |
| 1268 | 1141 | } |
| 1269 | 1142 | if( atan_ry > 0.0f ){ |
| 1270 | - SetFlag(moveturn_mode, AI_CTRL_TURNUP); | |
| 1143 | + ObjDriver->SetModeFlag(AI_CTRL_TURNUP); | |
| 1271 | 1144 | } |
| 1272 | 1145 | if( atan_ry < 0.0f ){ |
| 1273 | - SetFlag(moveturn_mode, AI_CTRL_TURNDOWN); | |
| 1146 | + ObjDriver->SetModeFlag(AI_CTRL_TURNDOWN); | |
| 1274 | 1147 | } |
| 1275 | 1148 | |
| 1276 | 1149 | //投げる |
| @@ -1289,12 +1162,12 @@ | ||
| 1289 | 1162 | //! @brief 腕の角度を設定 |
| 1290 | 1163 | void AIcontrol::ArmAngle() |
| 1291 | 1164 | { |
| 1292 | - DelFlag(moveturn_mode, AI_CTRL_TURNUP); | |
| 1293 | - DelFlag(moveturn_mode, AI_CTRL_TURNDOWN); | |
| 1165 | + ObjDriver->DelModeFlag(AI_CTRL_TURNUP); | |
| 1166 | + ObjDriver->DelModeFlag(AI_CTRL_TURNDOWN); | |
| 1294 | 1167 | |
| 1295 | 1168 | if( ctrlhuman->GetMainWeaponTypeNO() == ID_WEAPON_NONE ){ //手ぶら |
| 1296 | 1169 | //下に向け続ける |
| 1297 | - SetFlag(moveturn_mode, AI_CTRL_TURNDOWN); | |
| 1170 | + ObjDriver->SetModeFlag(AI_CTRL_TURNDOWN); | |
| 1298 | 1171 | } |
| 1299 | 1172 | else if( (battlemode == AI_CAUTION)&&(cautioncnt > 0) ){ //警戒中 |
| 1300 | 1173 | float addry2 = 0.0f - ry; |
| @@ -1301,19 +1174,19 @@ | ||
| 1301 | 1174 | |
| 1302 | 1175 | //旋回 |
| 1303 | 1176 | if( addry2 > DegreeToRadian(1.0f) ){ |
| 1304 | - SetFlag(moveturn_mode, AI_CTRL_TURNUP); | |
| 1177 | + ObjDriver->SetModeFlag(AI_CTRL_TURNUP); | |
| 1305 | 1178 | } |
| 1306 | 1179 | if( addry2 < DegreeToRadian(-1.0f) ){ |
| 1307 | - SetFlag(moveturn_mode, AI_CTRL_TURNDOWN); | |
| 1180 | + ObjDriver->SetModeFlag(AI_CTRL_TURNDOWN); | |
| 1308 | 1181 | } |
| 1309 | 1182 | } |
| 1310 | 1183 | else{ //平常時で武器所有中 |
| 1311 | 1184 | //旋回 |
| 1312 | 1185 | if( ry < DegreeToRadian(-32) ){ |
| 1313 | - SetFlag(moveturn_mode, AI_CTRL_TURNUP); | |
| 1186 | + ObjDriver->SetModeFlag(AI_CTRL_TURNUP); | |
| 1314 | 1187 | } |
| 1315 | 1188 | if( ry > DegreeToRadian(-28) ){ |
| 1316 | - SetFlag(moveturn_mode, AI_CTRL_TURNDOWN); | |
| 1189 | + ObjDriver->SetModeFlag(AI_CTRL_TURNDOWN); | |
| 1317 | 1190 | } |
| 1318 | 1191 | } |
| 1319 | 1192 | } |
| @@ -1379,7 +1252,7 @@ | ||
| 1379 | 1252 | |
| 1380 | 1253 | if( CheckLookEnemy(targetid, B_rx, B_ry, maxDist, NULL) == true ){ |
| 1381 | 1254 | if( GetRand(4) == 0 ){ |
| 1382 | - if( movemode == AI_RUN2 ){ longattack = false; } | |
| 1255 | + if( MoveNavi->GetRun2() == true ){ longattack = false; } | |
| 1383 | 1256 | else{ longattack = true; } |
| 1384 | 1257 | return 2; |
| 1385 | 1258 | } |
| @@ -1512,29 +1385,41 @@ | ||
| 1512 | 1385 | //! @brief パスによる移動 |
| 1513 | 1386 | void AIcontrol::MovePath() |
| 1514 | 1387 | { |
| 1515 | - if( movemode == AI_NULL ){ //異常なパス | |
| 1516 | - // | |
| 1388 | + int movemode, pointmode; | |
| 1389 | + MoveNavi->GetTargetPos(NULL, NULL, NULL, &movemode, &pointmode); | |
| 1390 | + | |
| 1391 | + if( movemode == AI_NAVI_MOVE_NULL ){ //異常なパス | |
| 1392 | + return; | |
| 1517 | 1393 | } |
| 1518 | - else if( movemode == AI_GRENADE ){ //手榴弾パス | |
| 1519 | - if( ThrowGrenade() != 0 ){ | |
| 1520 | - SearchTarget(true); | |
| 1521 | - } | |
| 1394 | + | |
| 1395 | + if( CheckTargetPos(false) == false ){ | |
| 1396 | + MoveTarget(false); | |
| 1522 | 1397 | } |
| 1523 | - else{ //その他パス | |
| 1524 | - if( CheckTargetPos() == false ){ | |
| 1525 | - MoveTarget(); | |
| 1526 | - } | |
| 1527 | - else if( (movemode == AI_WAIT)||(movemode == AI_TRACKING) ){ | |
| 1398 | + else{ | |
| 1399 | + if( (pointmode == AI_NAVI_POINT_WAIT)||(pointmode == AI_NAVI_POINT_TRACKING) ){ | |
| 1528 | 1400 | TurnSeen(); |
| 1529 | 1401 | } |
| 1530 | - else if( (movemode == AI_STOP)&&(waitcnt < ((int)GAMEFPS)*5) ){ | |
| 1531 | - if( StopSeen() == true ){ | |
| 1402 | + else if( pointmode == AI_NAVI_POINT_STOP ){ | |
| 1403 | + /* | |
| 1404 | + if( (StopSeen() == true)&&(waitcnt < ((int)GAMEFPS)*5) ){ | |
| 1532 | 1405 | waitcnt += 1; |
| 1533 | 1406 | } |
| 1407 | + */ | |
| 1408 | + if( waitcnt < ((int)GAMEFPS)*5 ){ | |
| 1409 | + if( StopSeen() == true ){ | |
| 1410 | + waitcnt += 1; | |
| 1411 | + } | |
| 1412 | + } | |
| 1413 | + else{ | |
| 1414 | + waitcnt = 0; | |
| 1415 | + MoveNavi->MovePathNextState(); | |
| 1416 | + MoveNavi->MovePathNowState(); | |
| 1417 | + } | |
| 1534 | 1418 | } |
| 1535 | - else{ | |
| 1419 | + else{ //pointmode == AI_NAVI_POINT_NULL | |
| 1536 | 1420 | waitcnt = 0; |
| 1537 | - SearchTarget(true); | |
| 1421 | + MoveNavi->MovePathNextState(); | |
| 1422 | + MoveNavi->MovePathNowState(); | |
| 1538 | 1423 | } |
| 1539 | 1424 | } |
| 1540 | 1425 | } |
| @@ -1548,14 +1433,15 @@ | ||
| 1548 | 1433 | //攻撃処理 |
| 1549 | 1434 | Action(); |
| 1550 | 1435 | |
| 1551 | - if( movemode == AI_RUN2 ){ //優先的な走り | |
| 1436 | + if( MoveNavi->GetRun2() == true ){ //優先的な走り | |
| 1552 | 1437 | //目標地点へ移動 |
| 1553 | - if( CheckTargetPos() == true ){ | |
| 1438 | + if( CheckTargetPos(false) == true ){ | |
| 1554 | 1439 | newbattlemode = AI_NORMAL; |
| 1555 | - SearchTarget(true); | |
| 1440 | + MoveNavi->MovePathNextState(); | |
| 1441 | + MoveNavi->MovePathNowState(); | |
| 1556 | 1442 | } |
| 1557 | 1443 | else{ |
| 1558 | - MoveTarget2(); | |
| 1444 | + MoveTarget2(false); | |
| 1559 | 1445 | } |
| 1560 | 1446 | } |
| 1561 | 1447 | else{ //優先的な走り 以外 |
| @@ -1569,7 +1455,7 @@ | ||
| 1569 | 1455 | if( ActionCancel() == true ){ |
| 1570 | 1456 | enemyhuman = NULL; |
| 1571 | 1457 | |
| 1572 | - if( movemode == AI_RUN2 ){ | |
| 1458 | + if( MoveNavi->GetRun2() == true ){ | |
| 1573 | 1459 | newbattlemode = AI_NORMAL; |
| 1574 | 1460 | } |
| 1575 | 1461 | else{ |
| @@ -1623,8 +1509,8 @@ | ||
| 1623 | 1509 | cautioncnt = 160; //警戒を再開 |
| 1624 | 1510 | } |
| 1625 | 1511 | else if( cautioncnt == 0 ){ //警戒を終了するなら |
| 1626 | - if( CheckTargetPos() == false ){ //警戒開始地点より離れているか | |
| 1627 | - MoveTarget(); //警戒開始地点に近づく | |
| 1512 | + if( CheckTargetPos(true) == false ){ //警戒開始地点より離れているか | |
| 1513 | + MoveTarget(true); //警戒開始地点に近づく | |
| 1628 | 1514 | } |
| 1629 | 1515 | else{ |
| 1630 | 1516 | newbattlemode = AI_NORMAL; |
| @@ -1631,9 +1517,10 @@ | ||
| 1631 | 1517 | |
| 1632 | 1518 | //警戒待ちパスなら次へ進める |
| 1633 | 1519 | pointdata pdata; |
| 1634 | - Points->Getdata(&pdata, target_pointid); | |
| 1520 | + MoveNavi->GetPathPointData(&pdata); | |
| 1635 | 1521 | if( (pdata.p1 == 3)&&(pdata.p2 == 4) ){ |
| 1636 | - SearchTarget(true); | |
| 1522 | + MoveNavi->MovePathNextState(); | |
| 1523 | + MoveNavi->MovePathNowState(); | |
| 1637 | 1524 | } |
| 1638 | 1525 | } |
| 1639 | 1526 | } |
| @@ -1643,12 +1530,11 @@ | ||
| 1643 | 1530 | else{ cautioncnt -= 1; } |
| 1644 | 1531 | |
| 1645 | 1532 | //追尾中で対象から離れすぎたら、ランダムに警戒終了 |
| 1646 | - if( (movemode == AI_TRACKING)&&(GetRand(3) == 0) ){ | |
| 1647 | - pointdata pdata; | |
| 1533 | + if( (MoveNavi->GetMoveMode() == AI_TRACKING)&&(GetRand(3) == 0) ){ | |
| 1648 | 1534 | float x, z; |
| 1649 | 1535 | float tx, tz; |
| 1650 | - Points->Getdata(&pdata, target_pointid); | |
| 1651 | - SearchHumanPos(pdata.p4, &tx, &tz); | |
| 1536 | + class human *targethuman = ObjMgr->GeHumanObject(MoveNavi->GetTargetHumanID()); | |
| 1537 | + targethuman->GetPosData(&tx, NULL, &tz, NULL); | |
| 1652 | 1538 | x = posx - tx; |
| 1653 | 1539 | z = posz - tz; |
| 1654 | 1540 | if( (x*x + z*z) > 25.0f*25.0f ){ |
| @@ -1670,9 +1556,7 @@ | ||
| 1670 | 1556 | { |
| 1671 | 1557 | int newbattlemode = AI_NORMAL; |
| 1672 | 1558 | |
| 1673 | - if( hold == false ){ | |
| 1674 | - SearchTarget(false); | |
| 1675 | - } | |
| 1559 | + MoveNavi->MovePathNowState(); | |
| 1676 | 1560 | enemyhuman = NULL; |
| 1677 | 1561 | |
| 1678 | 1562 | //座標とチーム番号を取得 |
| @@ -1690,14 +1574,25 @@ | ||
| 1690 | 1574 | } |
| 1691 | 1575 | |
| 1692 | 1576 | //ランダムパスなら処理実行 |
| 1693 | - if( movemode == AI_RANDOM ){ | |
| 1694 | - SearchTarget(true); | |
| 1577 | + if( MoveNavi->GetMoveMode() == AI_RANDOM ){ | |
| 1578 | + MoveNavi->MovePathNextState(); | |
| 1579 | + MoveNavi->MovePathNowState(); | |
| 1695 | 1580 | } |
| 1696 | 1581 | |
| 1697 | - if( movemode == AI_RUN2 ){ //優先的な走りの処理 | |
| 1582 | + //手榴弾パス | |
| 1583 | + if( MoveNavi->GetMoveMode() == AI_GRENADE ){ | |
| 1584 | + if( ThrowGrenade() != 0 ){ | |
| 1585 | + MoveNavi->MovePathNextState(); | |
| 1586 | + MoveNavi->MovePathNowState(); | |
| 1587 | + } | |
| 1588 | + } | |
| 1589 | + | |
| 1590 | + if( MoveNavi->GetMoveMode() == AI_RUN2 ){ //優先的な走りの処理 | |
| 1698 | 1591 | //敵を見つけたら攻撃に入る |
| 1699 | 1592 | if( SearchEnemy() != 0 ){ |
| 1700 | 1593 | newbattlemode = AI_ACTION; |
| 1594 | + //cautionback_posx = posx; | |
| 1595 | + //cautionback_posz = posz; | |
| 1701 | 1596 | } |
| 1702 | 1597 | else{ |
| 1703 | 1598 | MovePath(); //移動実行 |
| @@ -1712,8 +1607,8 @@ | ||
| 1712 | 1607 | ){ |
| 1713 | 1608 | newbattlemode = AI_CAUTION; |
| 1714 | 1609 | cautioncnt = 160; |
| 1715 | - target_posx = posx; | |
| 1716 | - target_posz = posz; | |
| 1610 | + cautionback_posx = posx; | |
| 1611 | + cautionback_posz = posz; | |
| 1717 | 1612 | } |
| 1718 | 1613 | else{ |
| 1719 | 1614 | MovePath(); //移動実行 |
| @@ -1721,7 +1616,7 @@ | ||
| 1721 | 1616 | } |
| 1722 | 1617 | |
| 1723 | 1618 | //腕の角度を設定 |
| 1724 | - if( movemode != AI_GRENADE ){ | |
| 1619 | + if( MoveNavi->GetMoveMode() != AI_GRENADE ){ | |
| 1725 | 1620 | ArmAngle(); |
| 1726 | 1621 | } |
| 1727 | 1622 |
| @@ -1739,7 +1634,6 @@ | ||
| 1739 | 1634 | //クラス設定がおかしければ処理しない |
| 1740 | 1635 | if( ctrlhuman == NULL ){ return; } |
| 1741 | 1636 | if( blocks == NULL ){ return; } |
| 1742 | - if( Points == NULL ){ return; } | |
| 1743 | 1637 | if( CollD == NULL ){ return; } |
| 1744 | 1638 | |
| 1745 | 1639 | //使用されていない人なら処理しない |
| @@ -1746,31 +1640,29 @@ | ||
| 1746 | 1640 | if( ctrlhuman->GetEnableFlag() == false ){ return; } |
| 1747 | 1641 | |
| 1748 | 1642 | //ステートを初期化 |
| 1749 | - hold = false; | |
| 1750 | 1643 | NoFight = false; |
| 1751 | 1644 | battlemode = AI_NORMAL; |
| 1752 | - movemode = AI_NULL; | |
| 1753 | 1645 | enemyhuman = NULL; |
| 1754 | - addrx = 0.0f; | |
| 1755 | - addry = 0.0f; | |
| 1756 | 1646 | waitcnt = 0; |
| 1757 | 1647 | gotocnt = 0; |
| 1758 | - moveturn_mode = 0x00; | |
| 1759 | 1648 | cautioncnt = 0; |
| 1760 | 1649 | actioncnt = 0; |
| 1761 | 1650 | longattack = false; |
| 1762 | 1651 | |
| 1652 | + MoveNavi->Init(); | |
| 1653 | + ObjDriver->Init(); | |
| 1654 | + | |
| 1763 | 1655 | //AIレベルと設定値を取得 |
| 1764 | 1656 | int paramid; |
| 1765 | 1657 | HumanParameter paramdata; |
| 1766 | - //target_pointid = in_target_pointid; | |
| 1767 | - ctrlhuman->GetParamData(¶mid, &target_pointid, NULL, NULL); | |
| 1658 | + ctrlhuman->GetParamData(¶mid, NULL, NULL, NULL); | |
| 1768 | 1659 | Param->GetHuman(paramid, ¶mdata); |
| 1769 | 1660 | AIlevel = paramdata.AIlevel; |
| 1770 | 1661 | Param->GetAIlevel(AIlevel, &LevelParam); |
| 1771 | 1662 | |
| 1772 | 1663 | //次のポイントを検索 |
| 1773 | - SearchTarget(true); | |
| 1664 | + //MoveNavi->MovePathNextState(); | |
| 1665 | + MoveNavi->MovePathNowState(); | |
| 1774 | 1666 | } |
| 1775 | 1667 | |
| 1776 | 1668 | //! @brief 指定した場所へ待機させる |
| @@ -1780,11 +1672,7 @@ | ||
| 1780 | 1672 | //! @attention 移動パスに関わらず、指定した座標への待機を強制します。Init()関数を再度実行するまで元に戻せません。 |
| 1781 | 1673 | void AIcontrol::SetHoldWait(float px, float pz, float rx) |
| 1782 | 1674 | { |
| 1783 | - movemode = AI_WAIT; | |
| 1784 | - hold = true; | |
| 1785 | - target_posx = px; | |
| 1786 | - target_posz = pz; | |
| 1787 | - target_rx = rx; | |
| 1675 | + MoveNavi->SetHoldWait(px, pz, rx); | |
| 1788 | 1676 | } |
| 1789 | 1677 | |
| 1790 | 1678 | //! @brief 指定した人を追尾させる |
| @@ -1792,9 +1680,7 @@ | ||
| 1792 | 1680 | //! @attention 移動パスに関わらず、指定した人への追尾を強制します。Init()関数を再度実行するまで元に戻せません。 |
| 1793 | 1681 | void AIcontrol::SetHoldTracking(int id) |
| 1794 | 1682 | { |
| 1795 | - movemode = AI_TRACKING; | |
| 1796 | - hold = false; | |
| 1797 | - target_pointid = id; | |
| 1683 | + MoveNavi->SetHoldTracking(id); | |
| 1798 | 1684 | } |
| 1799 | 1685 | |
| 1800 | 1686 | //! @brief 強制的に警戒させる |
| @@ -1802,11 +1688,11 @@ | ||
| 1802 | 1688 | void AIcontrol::SetCautionMode() |
| 1803 | 1689 | { |
| 1804 | 1690 | //優先的な走りならば何もしない |
| 1805 | - if( movemode == AI_RUN2 ){ return; } | |
| 1691 | + if( MoveNavi->GetRun2() == true ){ return; } | |
| 1806 | 1692 | |
| 1807 | 1693 | if( battlemode == AI_NORMAL ){ |
| 1808 | - target_posx = posx; | |
| 1809 | - target_posz = posz; | |
| 1694 | + cautionback_posx = posx; | |
| 1695 | + cautionback_posz = posz; | |
| 1810 | 1696 | } |
| 1811 | 1697 | battlemode = AI_CAUTION; |
| 1812 | 1698 | cautioncnt = 160; |
| @@ -1820,6 +1706,53 @@ | ||
| 1820 | 1706 | NoFight = flag; |
| 1821 | 1707 | } |
| 1822 | 1708 | |
| 1709 | +//! @brief 戦闘モード取得 | |
| 1710 | +//! @param *mode 戦闘モード(数字)を受け取るポインタ | |
| 1711 | +//! @param *modestr 戦闘モード名の文字列を受け取るポインタ | |
| 1712 | +void AIcontrol::GetBattleMode(int *mode, char *modestr) | |
| 1713 | +{ | |
| 1714 | + if( mode != NULL ){ | |
| 1715 | + *mode = battlemode; | |
| 1716 | + } | |
| 1717 | + if( modestr != NULL ){ | |
| 1718 | + switch(battlemode){ | |
| 1719 | + case 0: strcpy(modestr, "AI_DEAD"); break; | |
| 1720 | + case 1: strcpy(modestr, "AI_ACTION"); break; | |
| 1721 | + case 2: strcpy(modestr, "AI_CAUTION"); break; | |
| 1722 | + case 3: strcpy(modestr, "AI_NORMAL"); break; | |
| 1723 | + default: strcpy(modestr, ""); | |
| 1724 | + } | |
| 1725 | + } | |
| 1726 | +} | |
| 1727 | + | |
| 1728 | +//! @brief 攻撃対象の人データ番号 | |
| 1729 | +//! @return 人データ番号(ターゲットがいない場合は -1) | |
| 1730 | +int AIcontrol::GetEnemyHumanID() | |
| 1731 | +{ | |
| 1732 | + if( enemyhuman == NULL ){ | |
| 1733 | + return -1; | |
| 1734 | + } | |
| 1735 | + //else{ | |
| 1736 | + return ObjMgr->GetHumanObjectID(enemyhuman); | |
| 1737 | + //} | |
| 1738 | +} | |
| 1739 | + | |
| 1740 | +//! @brief 移動する目標地点(ターゲット)を取得 | |
| 1741 | +//! @param posx 目標地点のX座標を受け取るポインタ | |
| 1742 | +//! @param posz 目標地点のZ座標を受け取るポインタ | |
| 1743 | +//! @param movemode 目標地点への移動モードを受け取るポインタ | |
| 1744 | +void AIcontrol::GetMoveTargetPos(float *posx, float *posz, int *movemode) | |
| 1745 | +{ | |
| 1746 | + MoveNavi->GetTargetPos(posx, posz, NULL, movemode, NULL); | |
| 1747 | +} | |
| 1748 | + | |
| 1749 | +//! @brief 現在読み込んでいるポイントデータパス | |
| 1750 | +//! @param out_data ポイントデータを受け取るポインタ | |
| 1751 | +void AIcontrol::GetPathPointData(pointdata *out_data) | |
| 1752 | +{ | |
| 1753 | + MoveNavi->GetPathPointData(out_data); | |
| 1754 | +} | |
| 1755 | + | |
| 1823 | 1756 | //! @brief 処理系関数 |
| 1824 | 1757 | void AIcontrol::Process() |
| 1825 | 1758 | { |
| @@ -1826,7 +1759,6 @@ | ||
| 1826 | 1759 | //クラス設定がおかしければ処理しない |
| 1827 | 1760 | if( ctrlhuman == NULL ){ return; } |
| 1828 | 1761 | if( blocks == NULL ){ return; } |
| 1829 | - if( Points == NULL ){ return; } | |
| 1830 | 1762 | if( CollD == NULL ){ return; } |
| 1831 | 1763 | |
| 1832 | 1764 | //無効な人クラスなら処理しない |
| @@ -1835,7 +1767,6 @@ | ||
| 1835 | 1767 | //死亡したら |
| 1836 | 1768 | if( ctrlhuman->GetHP() <= 0 ){ |
| 1837 | 1769 | battlemode = AI_DEAD; |
| 1838 | - movemode = AI_DEAD; | |
| 1839 | 1770 | return; |
| 1840 | 1771 | } |
| 1841 | 1772 |
| @@ -1842,7 +1773,7 @@ | ||
| 1842 | 1773 | //HPが0でないのに 死亡したことになってる ・・・生き返った? |
| 1843 | 1774 | if( battlemode == AI_DEAD ){ |
| 1844 | 1775 | battlemode = AI_NORMAL; |
| 1845 | - SearchTarget(false); | |
| 1776 | + MoveNavi->MovePathNowState(); | |
| 1846 | 1777 | } |
| 1847 | 1778 | |
| 1848 | 1779 | //座標と角度を取得 |
| @@ -1870,11 +1801,392 @@ | ||
| 1870 | 1801 | } |
| 1871 | 1802 | |
| 1872 | 1803 | //移動・方向転換処理 |
| 1873 | - ControlMoveTurn(); | |
| 1804 | + ObjDriver->ControlObject(); | |
| 1874 | 1805 | |
| 1875 | 1806 | //武器を取り扱い |
| 1876 | 1807 | ControlWeapon(); |
| 1808 | +} | |
| 1877 | 1809 | |
| 1878 | - //角度を適用 | |
| 1879 | - ctrlhuman->SetRxRy(rx, ry); | |
| 1810 | +//! @brief コンストラクタ | |
| 1811 | +AIMoveNavi::AIMoveNavi(class ObjectManager *in_ObjMgr, int in_ctrlid, class PointDataInterface *in_Points) | |
| 1812 | +{ | |
| 1813 | + ObjMgr = in_ObjMgr; | |
| 1814 | + ctrlid = in_ctrlid; | |
| 1815 | + Points = in_Points; | |
| 1816 | + | |
| 1817 | + movemode = AI_WAIT; | |
| 1818 | + hold = false; | |
| 1819 | + path_pointid = 0; | |
| 1820 | + target_humanid = -1; | |
| 1821 | + target_posx = 0.0f; | |
| 1822 | + target_posz = 0.0f; | |
| 1823 | + target_rx = 0.0f; | |
| 1824 | +} | |
| 1825 | + | |
| 1826 | +//! @brief ディストラクタ | |
| 1827 | +AIMoveNavi::~AIMoveNavi() | |
| 1828 | +{} | |
| 1829 | + | |
| 1830 | +//! @brief 対象クラスを設定 | |
| 1831 | +//! @attention この関数で設定を行わないと、クラス自体が正しく機能しません。 | |
| 1832 | +void AIMoveNavi::SetClass(class ObjectManager *in_ObjMgr, int in_ctrlid, class PointDataInterface *in_Points) | |
| 1833 | +{ | |
| 1834 | + ObjMgr = in_ObjMgr; | |
| 1835 | + ctrlid = in_ctrlid; | |
| 1836 | + Points = in_Points; | |
| 1837 | +} | |
| 1838 | + | |
| 1839 | +//! @brief 初期化系関数 | |
| 1840 | +void AIMoveNavi::Init() | |
| 1841 | +{ | |
| 1842 | + movemode = AI_NULL; | |
| 1843 | + hold = false; | |
| 1844 | + path_pointid = 0; | |
| 1845 | + | |
| 1846 | + ObjMgr->GeHumanObject(ctrlid)->GetParamData(NULL, &path_pointid, NULL, NULL); | |
| 1847 | + MovePathNextState(); | |
| 1848 | +} | |
| 1849 | + | |
| 1850 | +//! @brief 移動する目標地点を適用 | |
| 1851 | +//! @return 完了:true 失敗:false | |
| 1852 | +//! @attention 追尾時に対象人物の座標を反映させるため、本関数を毎フレーム呼び出して、最新の位置情報を計算する必要があります。 | |
| 1853 | +bool AIMoveNavi::MovePathNowState() | |
| 1854 | +{ | |
| 1855 | + if( hold == true ){ | |
| 1856 | + if( movemode == AI_TRACKING ){ | |
| 1857 | + class human *targethuman; | |
| 1858 | + targethuman = ObjMgr->GeHumanObject(target_humanid); | |
| 1859 | + targethuman->GetPosData(&target_posx, NULL, &target_posz, &target_rx); | |
| 1860 | + } | |
| 1861 | + return true; | |
| 1862 | + } | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + //ポイントの情報を取得 | |
| 1866 | + pointdata pdata; | |
| 1867 | + if( Points->Getdata(&pdata, path_pointid) != 0 ){ | |
| 1868 | + movemode = AI_NULL; | |
| 1869 | + return false; | |
| 1870 | + } | |
| 1871 | + | |
| 1872 | + //移動パスなら〜 | |
| 1873 | + if( pdata.p1 == 3 ){ | |
| 1874 | + //移動ステート設定 | |
| 1875 | + switch(pdata.p2){ | |
| 1876 | + case 0: movemode = AI_WALK; break; | |
| 1877 | + case 1: movemode = AI_RUN; break; | |
| 1878 | + case 2: movemode = AI_WAIT; break; | |
| 1879 | + case 3: movemode = AI_TRACKING; break; | |
| 1880 | + case 4: movemode = AI_WAIT; break; | |
| 1881 | + case 5: movemode = AI_STOP; break; | |
| 1882 | + case 6: movemode = AI_GRENADE; break; | |
| 1883 | + case 7: movemode = AI_RUN2; break; | |
| 1884 | + default: break; | |
| 1885 | + } | |
| 1886 | + | |
| 1887 | + if( movemode == AI_TRACKING ){ | |
| 1888 | + class human *targethuman; | |
| 1889 | + | |
| 1890 | + if( target_humanid == -1 ){ | |
| 1891 | + signed char nextpointp4 = pdata.p3; | |
| 1892 | + | |
| 1893 | + //ポイント(人)の情報を取得 | |
| 1894 | + if( Points->SearchPointdata(&pdata, 0x08, 0, 0, 0, nextpointp4, 0) == 0 ){ | |
| 1895 | + return false; | |
| 1896 | + } | |
| 1897 | + | |
| 1898 | + //人を検索してクラスを取得 | |
| 1899 | + targethuman = ObjMgr->SearchHuman(pdata.p4); | |
| 1900 | + if( targethuman == NULL ){ return false; } | |
| 1901 | + | |
| 1902 | + //人のデータ番号を取得 | |
| 1903 | + target_humanid = ObjMgr->GetHumanObjectID(targethuman); | |
| 1904 | + } | |
| 1905 | + | |
| 1906 | + targethuman = ObjMgr->GeHumanObject(target_humanid); | |
| 1907 | + targethuman->GetPosData(&target_posx, NULL, &target_posz, &target_rx); | |
| 1908 | + } | |
| 1909 | + else{ | |
| 1910 | + //情報適用 | |
| 1911 | + target_posx = pdata.x; | |
| 1912 | + target_posz = pdata.z; | |
| 1913 | + target_rx = pdata.r; | |
| 1914 | + } | |
| 1915 | + | |
| 1916 | + return true; | |
| 1917 | + } | |
| 1918 | + | |
| 1919 | + //ランダムパスなら | |
| 1920 | + if( pdata.p1 == 8 ){ | |
| 1921 | + movemode = AI_RANDOM; | |
| 1922 | + return false; | |
| 1923 | + } | |
| 1924 | + | |
| 1925 | + movemode = AI_NULL; | |
| 1926 | + return false; | |
| 1927 | +} | |
| 1928 | + | |
| 1929 | +//! @brief 次の目標地点を検索 | |
| 1930 | +//! @return 完了:true 失敗:false | |
| 1931 | +bool AIMoveNavi::MovePathNextState() | |
| 1932 | +{ | |
| 1933 | + //ポイントの情報を取得 | |
| 1934 | + pointdata pdata; | |
| 1935 | + if( Points->Getdata(&pdata, path_pointid) != 0 ){ | |
| 1936 | + movemode = AI_NULL; | |
| 1937 | + return false; | |
| 1938 | + } | |
| 1939 | + | |
| 1940 | + signed char nextpointp4 = pdata.p3; | |
| 1941 | + | |
| 1942 | + //ランダムパス処理 | |
| 1943 | + if( pdata.p1 == 8 ){ | |
| 1944 | + if( GetRand(2) == 0 ){ | |
| 1945 | + nextpointp4 = pdata.p2; | |
| 1946 | + } | |
| 1947 | + else{ | |
| 1948 | + nextpointp4 = pdata.p3; | |
| 1949 | + } | |
| 1950 | + movemode = AI_RANDOM; | |
| 1951 | + } | |
| 1952 | + | |
| 1953 | + //ポイントを検索 | |
| 1954 | + if( Points->SearchPointdata(&pdata, 0x08, 0, 0, 0, nextpointp4, 0) == 0 ){ | |
| 1955 | + return false; | |
| 1956 | + } | |
| 1957 | + | |
| 1958 | + path_pointid = pdata.id; | |
| 1959 | + | |
| 1960 | + return true; | |
| 1961 | +} | |
| 1962 | + | |
| 1963 | +//! @brief 指定した場所へ待機させる | |
| 1964 | +//! @param px X座標 | |
| 1965 | +//! @param pz Z座標 | |
| 1966 | +//! @param rx 重視する向き | |
| 1967 | +//! @attention 移動パスに関わらず、指定した座標への待機を強制します。Init()関数を再度実行するまで元に戻せません。 | |
| 1968 | +void AIMoveNavi::SetHoldWait(float px, float pz, float rx) | |
| 1969 | +{ | |
| 1970 | + movemode = AI_WAIT; | |
| 1971 | + hold = true; | |
| 1972 | + target_posx = px; | |
| 1973 | + target_posz = pz; | |
| 1974 | + target_rx = rx; | |
| 1975 | +} | |
| 1976 | + | |
| 1977 | +//! @brief 指定した人を追尾させる | |
| 1978 | +//! @param id 人のデータ番号 | |
| 1979 | +//! @attention 移動パスに関わらず、指定した人への追尾を強制します。Init()関数を再度実行するまで元に戻せません。 | |
| 1980 | +void AIMoveNavi::SetHoldTracking(int id) | |
| 1981 | +{ | |
| 1982 | + movemode = AI_TRACKING; | |
| 1983 | + hold = true; | |
| 1984 | + target_humanid = id; | |
| 1985 | +} | |
| 1986 | + | |
| 1987 | +//! @brief 移動モードを取得 | |
| 1988 | +//! @return 移動モード | |
| 1989 | +int AIMoveNavi::GetMoveMode() | |
| 1990 | +{ | |
| 1991 | + return movemode; | |
| 1992 | +} | |
| 1993 | + | |
| 1994 | +//! @brief 優先的な走りフラグを取得 | |
| 1995 | +//! @return 優先的な走りである:true 優先的な走りでない:false | |
| 1996 | +bool AIMoveNavi::GetRun2() | |
| 1997 | +{ | |
| 1998 | + if( movemode == AI_RUN2 ){ | |
| 1999 | + return true; | |
| 2000 | + } | |
| 2001 | + //else{ | |
| 2002 | + return false; | |
| 2003 | + //} | |
| 2004 | +} | |
| 2005 | + | |
| 2006 | +//! @brief ターゲット(人)のデータ番号を取得 | |
| 2007 | +//! @return 人のデータ番号 | |
| 2008 | +int AIMoveNavi::GetTargetHumanID() | |
| 2009 | +{ | |
| 2010 | + return target_humanid; | |
| 2011 | +} | |
| 2012 | + | |
| 2013 | +//! @brief 現在読み込んでいるポイントデータパス | |
| 2014 | +//! @param out_data ポイントデータを受け取るポインタ | |
| 2015 | +void AIMoveNavi::GetPathPointData(pointdata *out_data) | |
| 2016 | +{ | |
| 2017 | + Points->Getdata(out_data, path_pointid); | |
| 2018 | +} | |
| 2019 | + | |
| 2020 | +//! @brief 移動する目標地点(ターゲット)を取得 | |
| 2021 | +//! @param posx 目標地点のX座標を受け取るポインタ | |
| 2022 | +//! @param posz 目標地点のZ座標を受け取るポインタ | |
| 2023 | +//! @param rx 目標地点の水平角度を受け取るポインタ | |
| 2024 | +//! @param out_movemode 目標地点への移動モードを受け取るポインタ | |
| 2025 | +//! @param out_pointmode 目標地点のポイントモードを受け取るポインタ | |
| 2026 | +//! @warning 本関数では座標は更新されません。先に MovePathNowState() 関数で座標を更新した後、本関数を呼び出してください。 | |
| 2027 | +void AIMoveNavi::GetTargetPos(float *posx, float *posz, float *rx, int *out_movemode, int *out_pointmode) | |
| 2028 | +{ | |
| 2029 | + if( posx != NULL ){ *posx = target_posx; } | |
| 2030 | + if( posz != NULL ){ *posz = target_posz; } | |
| 2031 | + if( rx != NULL ){ *rx = target_rx; } | |
| 2032 | + | |
| 2033 | + if( out_movemode != NULL ){ | |
| 2034 | + if( (movemode == AI_WALK)||(movemode == AI_WAIT)||(movemode == AI_STOP) ){ | |
| 2035 | + *out_movemode = AI_NAVI_MOVE_WALK; | |
| 2036 | + } | |
| 2037 | + else if( movemode == AI_RUN ){ | |
| 2038 | + *out_movemode = AI_NAVI_MOVE_RUN; | |
| 2039 | + } | |
| 2040 | + else if( movemode == AI_RUN2 ){ | |
| 2041 | + *out_movemode = AI_NAVI_MOVE_RUN2; | |
| 2042 | + } | |
| 2043 | + else if( movemode == AI_TRACKING ){ | |
| 2044 | + *out_movemode = AI_NAVI_MOVE_TRACKING; | |
| 2045 | + } | |
| 2046 | + else{ | |
| 2047 | + *out_movemode = AI_NAVI_MOVE_NULL; | |
| 2048 | + } | |
| 2049 | + } | |
| 2050 | + | |
| 2051 | + if( out_pointmode != NULL ){ | |
| 2052 | + if( movemode == AI_WAIT ){ | |
| 2053 | + *out_pointmode = AI_NAVI_POINT_WAIT; | |
| 2054 | + } | |
| 2055 | + else if( movemode == AI_STOP ){ | |
| 2056 | + *out_pointmode = AI_NAVI_POINT_STOP; | |
| 2057 | + } | |
| 2058 | + else if( movemode == AI_TRACKING ){ | |
| 2059 | + *out_pointmode = AI_NAVI_POINT_TRACKING; | |
| 2060 | + } | |
| 2061 | + else if( movemode == AI_GRENADE ){ //手榴弾パス | |
| 2062 | + *out_pointmode = AI_NAVI_POINT_GRENADE; | |
| 2063 | + } | |
| 2064 | + else{ //移動パス・異常なパス | |
| 2065 | + *out_pointmode = AI_NAVI_POINT_NULL; | |
| 2066 | + } | |
| 2067 | + } | |
| 2068 | +} | |
| 2069 | + | |
| 2070 | +//! @brief コンストラクタ | |
| 2071 | +AIObjectDriver::AIObjectDriver(class ObjectManager *in_ObjMgr, int in_ctrlid) | |
| 2072 | +{ | |
| 2073 | + ObjMgr = in_ObjMgr; | |
| 2074 | + ctrlid = in_ctrlid; | |
| 2075 | + | |
| 2076 | + moveturn_mode = 0; | |
| 2077 | + addrx = 0.0f; | |
| 2078 | + addry = 0.0f; | |
| 2079 | +} | |
| 2080 | + | |
| 2081 | +//! @brief ディストラクタ | |
| 2082 | +AIObjectDriver::~AIObjectDriver() | |
| 2083 | +{} | |
| 2084 | + | |
| 2085 | +//! @brief 対象クラスを設定 | |
| 2086 | +//! @attention この関数で設定を行わないと、クラス自体が正しく機能しません。 | |
| 2087 | +void AIObjectDriver::SetClass(class ObjectManager *in_ObjMgr, int in_ctrlid) | |
| 2088 | +{ | |
| 2089 | + ObjMgr = in_ObjMgr; | |
| 2090 | + ctrlid = in_ctrlid; | |
| 2091 | +} | |
| 2092 | + | |
| 2093 | +//! @brief 初期化系関数 | |
| 2094 | +void AIObjectDriver::Init() | |
| 2095 | +{ | |
| 2096 | + addrx = 0.0f; | |
| 2097 | + addry = 0.0f; | |
| 2098 | + | |
| 2099 | + ResetMode(); | |
| 2100 | +} | |
| 2101 | + | |
| 2102 | +//! @brief 移動回転制御フラグをクリア(一度全ての動きを止める) | |
| 2103 | +void AIObjectDriver::ResetMode() | |
| 2104 | +{ | |
| 2105 | + moveturn_mode = 0; | |
| 2106 | +} | |
| 2107 | + | |
| 2108 | +//! @brief 移動回転制御フラグ 設定 | |
| 2109 | +//! @param flag 操作モードを表す定数(AIcontrolFlag列挙型) | |
| 2110 | +void AIObjectDriver::SetModeFlag(int flag) | |
| 2111 | +{ | |
| 2112 | + SetFlag(moveturn_mode, flag); | |
| 2113 | +} | |
| 2114 | + | |
| 2115 | +//! @brief 移動回転制御フラグ 解除 | |
| 2116 | +//! @param flag 操作モードを表す定数(AIcontrolFlag列挙型) | |
| 2117 | +void AIObjectDriver::DelModeFlag(int flag) | |
| 2118 | +{ | |
| 2119 | + DelFlag(moveturn_mode, flag); | |
| 2120 | +} | |
| 2121 | + | |
| 2122 | +//! @brief 移動回転制御フラグ 取得 | |
| 2123 | +//! @param flag 操作モードを表す定数(AIcontrolFlag列挙型) | |
| 2124 | +bool AIObjectDriver::GetModeFlag(int flag) | |
| 2125 | +{ | |
| 2126 | + if( GetFlag(moveturn_mode, flag) == 0 ){ | |
| 2127 | + return false; | |
| 2128 | + } | |
| 2129 | + //else{ | |
| 2130 | + return true; | |
| 2131 | + //} | |
| 2132 | +} | |
| 2133 | + | |
| 2134 | +//! @brief 移動回転制御を実行 | |
| 2135 | +//! @attention 毎フレーム1回だけ呼び出してください。 | |
| 2136 | +void AIObjectDriver::ControlObject() | |
| 2137 | +{ | |
| 2138 | + float rx, ry; | |
| 2139 | + | |
| 2140 | + //移動の実行 | |
| 2141 | + if( GetFlag(moveturn_mode, AI_CTRL_MOVEFORWARD) ){ | |
| 2142 | + ObjMgr->MoveForward(ctrlid); | |
| 2143 | + } | |
| 2144 | + if( GetFlag(moveturn_mode, AI_CTRL_MOVEBACKWARD) ){ | |
| 2145 | + ObjMgr->MoveBack(ctrlid); | |
| 2146 | + } | |
| 2147 | + if( GetFlag(moveturn_mode, AI_CTRL_MOVELEFT) ){ | |
| 2148 | + ObjMgr->MoveLeft(ctrlid); | |
| 2149 | + } | |
| 2150 | + if( GetFlag(moveturn_mode, AI_CTRL_MOVERIGHT) ){ | |
| 2151 | + ObjMgr->MoveRight(ctrlid); | |
| 2152 | + } | |
| 2153 | + if( GetFlag(moveturn_mode, AI_CTRL_MOVEWALK) ){ | |
| 2154 | + ObjMgr->MoveWalk(ctrlid); | |
| 2155 | + } | |
| 2156 | + | |
| 2157 | + //方向転換の実行(回転速度の加算) | |
| 2158 | + if( GetFlag(moveturn_mode, AI_CTRL_TURNUP) ){ | |
| 2159 | + addry += AI_ADDTURNRAD; | |
| 2160 | + } | |
| 2161 | + if( GetFlag(moveturn_mode, AI_CTRL_TURNDOWN) ){ | |
| 2162 | + addry -= AI_ADDTURNRAD; | |
| 2163 | + } | |
| 2164 | + if( GetFlag(moveturn_mode, AI_CTRL_TURNLEFT) ){ | |
| 2165 | + addrx -= AI_ADDTURNRAD; | |
| 2166 | + } | |
| 2167 | + if( GetFlag(moveturn_mode, AI_CTRL_TURNRIGHT) ){ | |
| 2168 | + addrx += AI_ADDTURNRAD; | |
| 2169 | + } | |
| 2170 | + | |
| 2171 | + //角度を取得 | |
| 2172 | + ObjMgr->GeHumanObject(ctrlid)->GetRxRy(&rx, &ry); | |
| 2173 | + | |
| 2174 | + //角度に加算 | |
| 2175 | + rx += addrx; | |
| 2176 | + ry += addry; | |
| 2177 | + | |
| 2178 | + //縦の回転範囲を収める | |
| 2179 | + if( ry > DegreeToRadian(70) ){ ry = DegreeToRadian(70); } | |
| 2180 | + if( ry < DegreeToRadian(-70) ){ ry = DegreeToRadian(-70); } | |
| 2181 | + | |
| 2182 | + //角度を設定 | |
| 2183 | + ObjMgr->GeHumanObject(ctrlid)->SetRxRy(rx, ry); | |
| 2184 | + | |
| 2185 | + //回転速度の減衰 | |
| 2186 | + addrx *= 0.8f; | |
| 2187 | + addry *= 0.8f; | |
| 2188 | + | |
| 2189 | + //0.0fへ補正 | |
| 2190 | + if( fabs(addrx) < DegreeToRadian(0.2f) ){ addrx = 0.0f; } | |
| 2191 | + if( fabs(addry) < DegreeToRadian(0.2f) ){ addry = 0.0f; } | |
| 1880 | 2192 | } |
| \ No newline at end of file |
| @@ -132,6 +132,7 @@ | ||
| 132 | 132 | void SetPlayerID(int id); |
| 133 | 133 | human* GeHumanObject(int id); |
| 134 | 134 | human* GetPlayerHumanObject(); |
| 135 | + int GetHumanObjectID(human* object); | |
| 135 | 136 | weapon* GetWeaponObject(int id); |
| 136 | 137 | smallobject* GetSmallObject(int id); |
| 137 | 138 | bullet* GetBulletObject(int id); |
| @@ -1132,6 +1132,7 @@ | ||
| 1132 | 1132 | PlayerAI = false; |
| 1133 | 1133 | AIstop = false; |
| 1134 | 1134 | AINoFight = false; |
| 1135 | + AIdebuginfoID = -1; | |
| 1135 | 1136 | framecnt = 0; |
| 1136 | 1137 | start_framecnt = 0; |
| 1137 | 1138 | end_framecnt = 0; |
| @@ -1656,7 +1657,7 @@ | ||
| 1656 | 1657 | //AIを設定 |
| 1657 | 1658 | HumanAI[id].Init(); |
| 1658 | 1659 | if( inputCtrl->CheckKeyDown(OriginalkeycodeToDinputdef(0x00)) ){ // [↑] |
| 1659 | - HumanAI[id].SetHoldTracking(dataid); | |
| 1660 | + HumanAI[id].SetHoldTracking(PlayerID); | |
| 1660 | 1661 | } |
| 1661 | 1662 | if( inputCtrl->CheckKeyDown(OriginalkeycodeToDinputdef(0x01)) ){ // [↓] |
| 1662 | 1663 | HumanAI[id].SetHoldWait(x, z, r); |
| @@ -1941,6 +1942,49 @@ | ||
| 1941 | 1942 | } |
| 1942 | 1943 | //オブジェクトを描画 |
| 1943 | 1944 | ObjMgr.Render(camera_x, camera_y, camera_z, DrawPlayer); |
| 1945 | + | |
| 1946 | + //AIデバック情報表示 | |
| 1947 | + if( AIdebuginfoID != -1 ){ | |
| 1948 | + if( (0 <= AIdebuginfoID)&&(AIdebuginfoID < MAX_HUMAN) ){ | |
| 1949 | + float posx, posy, posz, rx; | |
| 1950 | + int EnemyID; | |
| 1951 | + float mposx, mposz; | |
| 1952 | + int movemode; | |
| 1953 | + ObjMgr.GeHumanObject(AIdebuginfoID)->GetPosData(&posx, &posy, &posz, &rx); | |
| 1954 | + EnemyID = HumanAI[AIdebuginfoID].GetEnemyHumanID(); | |
| 1955 | + HumanAI[AIdebuginfoID].GetMoveTargetPos(&mposx, &mposz, &movemode); | |
| 1956 | + | |
| 1957 | + d3dg->ResetWorldTransform(); | |
| 1958 | + | |
| 1959 | + //本人 | |
| 1960 | + d3dg->Drawline(posx+10.0f, posy, posz, posx-10.0f, posy, posz, d3dg->GetColorCode(0.0f,0.0f,1.0f,1.0f)); | |
| 1961 | + d3dg->Drawline(posx, posy+10.0f, posz, posx, posy-10.0f, posz, d3dg->GetColorCode(0.0f,0.0f,1.0f,1.0f)); | |
| 1962 | + d3dg->Drawline(posx, posy, posz+10.0f, posx, posy, posz-10.0f, d3dg->GetColorCode(0.0f,0.0f,1.0f,1.0f)); | |
| 1963 | + | |
| 1964 | + //移動先 | |
| 1965 | + d3dg->Drawline(mposx+10.0f, posy, mposz, mposx-10.0f, posy, mposz, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f)); | |
| 1966 | + d3dg->Drawline(mposx, 5000.0f, mposz, mposx, -500.0f,mposz, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f)); | |
| 1967 | + d3dg->Drawline(mposx, posy, mposz+10.0f, mposx, posy, mposz-10.0f, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f)); | |
| 1968 | + | |
| 1969 | + if( EnemyID != -1 ){ | |
| 1970 | + ObjMgr.GeHumanObject(EnemyID)->GetPosData(&posx, &posy, &posz, &rx); | |
| 1971 | + | |
| 1972 | + //攻撃対象 | |
| 1973 | + d3dg->Drawline(posx+3.0f, posy, posz+3.0f, posx+3.0f, posy, posz-3.0f, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 1974 | + d3dg->Drawline(posx+3.0f, posy, posz-3.0f, posx-3.0f, posy, posz-3.0f, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 1975 | + d3dg->Drawline(posx-3.0f, posy, posz-3.0f, posx-3.0f, posy, posz+3.0f, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 1976 | + d3dg->Drawline(posx-3.0f, posy, posz+3.0f, posx+3.0f, posy, posz+3.0f, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 1977 | + d3dg->Drawline(posx+3.0f, posy+HUMAN_HEIGTH, posz+3.0f, posx+3.0f, posy+HUMAN_HEIGTH, posz-3.0f, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 1978 | + d3dg->Drawline(posx+3.0f, posy+HUMAN_HEIGTH, posz-3.0f, posx-3.0f, posy+HUMAN_HEIGTH, posz-3.0f, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 1979 | + d3dg->Drawline(posx-3.0f, posy+HUMAN_HEIGTH, posz-3.0f, posx-3.0f, posy+HUMAN_HEIGTH, posz+3.0f, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 1980 | + d3dg->Drawline(posx-3.0f, posy+HUMAN_HEIGTH, posz+3.0f, posx+3.0f, posy+HUMAN_HEIGTH, posz+3.0f, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 1981 | + d3dg->Drawline(posx+3.0f, posy, posz+3.0f, posx+3.0f, posy+HUMAN_HEIGTH, posz+3.0f, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 1982 | + d3dg->Drawline(posx+3.0f, posy, posz-3.0f, posx+3.0f, posy+HUMAN_HEIGTH, posz-3.0f, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 1983 | + d3dg->Drawline(posx-3.0f, posy, posz-3.0f, posx-3.0f, posy+HUMAN_HEIGTH, posz-3.0f, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 1984 | + d3dg->Drawline(posx-3.0f, posy, posz+3.0f, posx-3.0f, posy+HUMAN_HEIGTH, posz+3.0f, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 1985 | + } | |
| 1986 | + } | |
| 1987 | + } | |
| 1944 | 1988 | } |
| 1945 | 1989 | |
| 1946 | 1990 | void maingame::Render2D() |
| @@ -2256,7 +2300,42 @@ | ||
| 2256 | 2300 | } |
| 2257 | 2301 | } |
| 2258 | 2302 | |
| 2303 | + //AIデバック情報表示 | |
| 2304 | + if( AIdebuginfoID != -1 ){ | |
| 2305 | + if( (0 <= AIdebuginfoID)&&(AIdebuginfoID < MAX_HUMAN) ){ | |
| 2306 | + float posx, posy, posz, rx; | |
| 2307 | + int hp; | |
| 2308 | + char modestr[32]; | |
| 2309 | + int EnemyID; | |
| 2310 | + float mposx, mposz; | |
| 2311 | + int movemode; | |
| 2312 | + pointdata ppdata; | |
| 2313 | + ObjMgr.GeHumanObject(AIdebuginfoID)->GetPosData(&posx, &posy, &posz, &rx); | |
| 2314 | + hp = ObjMgr.GeHumanObject(AIdebuginfoID)->GetHP(); | |
| 2315 | + HumanAI[AIdebuginfoID].GetBattleMode(NULL, modestr); | |
| 2316 | + EnemyID = HumanAI[AIdebuginfoID].GetEnemyHumanID(); | |
| 2317 | + HumanAI[AIdebuginfoID].GetMoveTargetPos(&mposx, &mposz, &movemode); | |
| 2318 | + HumanAI[AIdebuginfoID].GetPathPointData(&ppdata); | |
| 2259 | 2319 | |
| 2320 | + sprintf(str, "AI debug info [ID:%d]", AIdebuginfoID); | |
| 2321 | + d3dg->Draw2DTextureFontText(20 +1, 130 +1, str, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f), 12, 16); | |
| 2322 | + d3dg->Draw2DTextureFontText(20, 130, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f), 12, 16); | |
| 2323 | + sprintf(str, "(X:%.2f Y:%.2f Z:%.2f RX:%.2f HP:%d)", posx, posy, posz, rx, hp); | |
| 2324 | + d3dg->Draw2DTextureFontText(20 +1, 150 +1, str, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f), 10, 14); | |
| 2325 | + d3dg->Draw2DTextureFontText(20, 150, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f), 10, 14); | |
| 2326 | + sprintf(str, "Mode:%s TargetEnemyID:%d", modestr, EnemyID); | |
| 2327 | + d3dg->Draw2DTextureFontText(20 +1, 170 +1, str, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f), 12, 16); | |
| 2328 | + d3dg->Draw2DTextureFontText(20, 170, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f), 12, 16); | |
| 2329 | + sprintf(str, "PointPath:[%d][%d][%d][%d]", ppdata.p1, ppdata.p2, ppdata.p3, ppdata.p4); | |
| 2330 | + d3dg->Draw2DTextureFontText(20 +1, 190 +1, str, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f), 12, 16); | |
| 2331 | + d3dg->Draw2DTextureFontText(20, 190, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f), 12, 16); | |
| 2332 | + sprintf(str, "MovePosX:%.2f MovePosZ:%.2f", mposx, mposz); | |
| 2333 | + d3dg->Draw2DTextureFontText(20 +1, 210 +1, str, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f), 12, 16); | |
| 2334 | + d3dg->Draw2DTextureFontText(20, 210, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f), 12, 16); | |
| 2335 | + } | |
| 2336 | + } | |
| 2337 | + | |
| 2338 | + | |
| 2260 | 2339 | //----------------------------------- |
| 2261 | 2340 | |
| 2262 | 2341 | //Zバッファを初期化 |
| @@ -2389,10 +2468,10 @@ | ||
| 2389 | 2468 | //! @brief 簡易レーダー表示 |
| 2390 | 2469 | void maingame::RenderRadar() |
| 2391 | 2470 | { |
| 2392 | - int RadarPosX = 10; //レーダーの描画 X座標(左上基準) | |
| 2393 | - int RadarPosY = 130; //レーダーの描画 Y座標(左上基準) | |
| 2394 | - int RadarSize = 200; //レーダーの描画サイズ | |
| 2395 | - float RadarWorldR = 300.0f; //レーダーにポイントする距離 | |
| 2471 | + int RadarSize = 200; //レーダーの描画サイズ | |
| 2472 | + int RadarPosX = SCREEN_WIDTH - RadarSize - 10; //レーダーの描画 X座標(左上基準) | |
| 2473 | + int RadarPosY = 130; //レーダーの描画 Y座標(左上基準) | |
| 2474 | + float RadarWorldR = 300.0f; //レーダーにポイントする距離 | |
| 2396 | 2475 | |
| 2397 | 2476 | float ecr = DISTANCE_CHECKPOINT / RadarWorldR * (RadarSize/2); |
| 2398 | 2477 |
| @@ -2651,14 +2730,14 @@ | ||
| 2651 | 2730 | |
| 2652 | 2731 | //コマンドリスト |
| 2653 | 2732 | if( strcmp(NewCommand, "help") == 0 ){ |
| 2654 | - AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "help human result event"); | |
| 2733 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "help human result event"); | |
| 2655 | 2734 | AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "ver"); |
| 2656 | - AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "info view center map"); | |
| 2657 | - AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "tag radar inmap"); | |
| 2658 | - AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "revive treat <NUM> nodamage <NUM>"); | |
| 2659 | - AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "kill <NUM> break <NUM> newobj <NUM> ff"); | |
| 2660 | - AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "bot nofight caution stop"); | |
| 2661 | - AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "estop speed ss clear"); | |
| 2735 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "info view center map"); | |
| 2736 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "aiinfo <NUM> tag radar inmap"); | |
| 2737 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "revive treat <NUM> nodamage <NUM>"); | |
| 2738 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "kill <NUM> break <NUM> newobj <NUM> ff"); | |
| 2739 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "bot nofight caution stop"); | |
| 2740 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "estop speed ss clear"); | |
| 2662 | 2741 | } |
| 2663 | 2742 | |
| 2664 | 2743 | //人の統計情報 |
| @@ -2786,6 +2865,23 @@ | ||
| 2786 | 2865 | } |
| 2787 | 2866 | } |
| 2788 | 2867 | |
| 2868 | + //AI情報表示 | |
| 2869 | + if( GetCommandNum("aiinfo", &id) == true ){ | |
| 2870 | + if( (0 <= id)&&(id < MAX_HUMAN) ){ | |
| 2871 | + if( AIdebuginfoID == id ){ | |
| 2872 | + //同じ番号が指定されたらなら、無効化 | |
| 2873 | + AIdebuginfoID = -1; | |
| 2874 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "Disable AI Debug information."); | |
| 2875 | + } | |
| 2876 | + else{ | |
| 2877 | + //新たに人を指定 | |
| 2878 | + AIdebuginfoID = id; | |
| 2879 | + sprintf(str, "Enable AI Debug information. Human[%d].", id); | |
| 2880 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), str); | |
| 2881 | + } | |
| 2882 | + } | |
| 2883 | + } | |
| 2884 | + | |
| 2789 | 2885 | //オブジェクトのタグを表示 |
| 2790 | 2886 | if( strcmp(NewCommand, "tag") == 0 ){ |
| 2791 | 2887 | if( tag == false ){ |
| @@ -57,42 +57,35 @@ | ||
| 57 | 57 | { |
| 58 | 58 | class ObjectManager *ObjMgr; //!< ObjectManagerクラスのポインタ |
| 59 | 59 | class BlockDataInterface *blocks; //!< ブロックデータを管理するクラスへのポインタ |
| 60 | - class PointDataInterface *Points; //!< ポイントデータを管理するクラスへのポインタ | |
| 61 | 60 | class ParameterInfo *Param; //!< 設定値を管理するクラスへのポインタ |
| 62 | 61 | class Collision *CollD; //!< 当たり判定を管理するクラスへのポインタ |
| 63 | 62 | class SoundManager *GameSound; //!< ゲーム効果音再生クラスへのポインタ |
| 64 | 63 | |
| 64 | + class AIMoveNavi *MoveNavi; //!< 人移動管理クラスのポインタ | |
| 65 | + class AIObjectDriver *ObjDriver; //!< 人移動回転制御クラスのポインタ | |
| 66 | + | |
| 65 | 67 | int AIlevel; //!< AIレベル |
| 66 | 68 | int battlemode; //!< 戦闘モード |
| 67 | - int movemode; //!< 移動モード | |
| 68 | - bool hold; //!< 移動パスを読まない | |
| 69 | - bool NoFight; //!< 非戦闘化フラグ | |
| 70 | - float posx; //!< X座標 | |
| 71 | - float posy; //!< Y座標 | |
| 72 | - float posz; //!< Z座標 | |
| 73 | - float rx; //!< X軸回転角度 | |
| 74 | - float ry; //!< Y軸回転角度 | |
| 75 | - float addrx; //!< X軸回転角加速度 | |
| 76 | - float addry; //!< Y軸回転角加速度 | |
| 77 | - int target_pointid; //!< パス系 ターゲットのデータ番号 | |
| 78 | - float target_posx; //!< パス系 ターゲットのX座標 | |
| 79 | - float target_posz; //!< パス系 ターゲットのZ座標 | |
| 80 | - float target_rx; //!< パス系 ターゲットの水平角度 | |
| 81 | - float total_move; //!< 合計移動量 | |
| 69 | + bool NoFight; //!< 非戦闘化フラグ | |
| 70 | + float posx; //!< X座標 | |
| 71 | + float posy; //!< Y座標 | |
| 72 | + float posz; //!< Z座標 | |
| 73 | + float rx; //!< X軸回転角度 | |
| 74 | + float ry; //!< Y軸回転角度 | |
| 75 | + float cautionback_posx; //!< 警戒後に戻るX座標 | |
| 76 | + float cautionback_posz; //!< 警戒後に戻るZ座標 | |
| 77 | + float total_move; //!< 合計移動量 | |
| 82 | 78 | int waitcnt; //!< 時間待ちカウント |
| 83 | 79 | int movejumpcnt; //!< ジャンプ判定カウント |
| 84 | 80 | int gotocnt; //!< 移動カウント |
| 85 | - int moveturn_mode; //!< 移動方向や回転方向のフラグ | |
| 86 | 81 | int cautioncnt; //!< 警戒中カウント |
| 87 | 82 | int actioncnt; //!< 攻撃中カウント |
| 88 | 83 | bool longattack; //!< 近距離・遠距離フラグ |
| 89 | 84 | AIParameter *LevelParam; //!< AIの性能値 |
| 90 | 85 | |
| 91 | - int SearchHumanPos(signed char in_p4, float *out_x, float *out_z); | |
| 92 | - bool CheckTargetPos(); | |
| 93 | - bool SearchTarget(bool next); | |
| 94 | - void MoveTarget(); | |
| 95 | - void MoveTarget2(); | |
| 86 | + bool CheckTargetPos(bool back); | |
| 87 | + void MoveTarget(bool back); | |
| 88 | + void MoveTarget2(bool back); | |
| 96 | 89 | void MoveRandom(); |
| 97 | 90 | void TurnSeen(); |
| 98 | 91 | bool StopSeen(); |
| @@ -101,7 +94,6 @@ | ||
| 101 | 94 | bool ActionCancel(); |
| 102 | 95 | int HaveWeapon(); |
| 103 | 96 | void CancelMoveTurn(); |
| 104 | - void ControlMoveTurn(); | |
| 105 | 97 | int ControlWeapon(); |
| 106 | 98 | int ThrowGrenade(); |
| 107 | 99 | void ArmAngle(); |
| @@ -128,10 +120,70 @@ | ||
| 128 | 120 | void SetHoldTracking(int id); |
| 129 | 121 | void SetCautionMode(); |
| 130 | 122 | void SetNoFightFlag(bool flag); |
| 123 | + void GetBattleMode(int *mode, char *modestr); | |
| 124 | + int GetEnemyHumanID(); | |
| 125 | + void GetMoveTargetPos(float *posx, float *posz, int *movemode); | |
| 126 | + void GetPathPointData(pointdata *out_data); | |
| 131 | 127 | void Process(); |
| 132 | 128 | }; |
| 133 | 129 | |
| 130 | +//! @brief 人移動管理クラス | |
| 131 | +//! @details 通常モードにおいて、人の移動先を決定するクラスです。AIcontrolクラス内で使用します。 | |
| 132 | +class AIMoveNavi | |
| 133 | +{ | |
| 134 | + class ObjectManager *ObjMgr; //!< ObjectManagerクラスのポインタ | |
| 135 | + int ctrlid; //!< 自分自身(制御対象)の人番号 | |
| 136 | + class PointDataInterface *Points; //!< ポイントデータを管理するクラスへのポインタ | |
| 137 | + | |
| 138 | + int movemode; //!< 移動モード | |
| 139 | + bool hold; //!< 移動パスを読まない | |
| 140 | + int path_pointid; //!< パスのポイントデータ番号 | |
| 141 | + int target_humanid; //!< ターゲットにする人のデータ番号 | |
| 142 | + float target_posx; //!< ターゲットのX座標 | |
| 143 | + float target_posz; //!< ターゲットのZ座標 | |
| 144 | + float target_rx; //!< ターゲットの水平角度 | |
| 145 | + | |
| 146 | +public: | |
| 147 | + AIMoveNavi(class ObjectManager *in_ObjMgr = NULL, int in_ctrlid = -1, class PointDataInterface *in_Points = NULL); | |
| 148 | + ~AIMoveNavi(); | |
| 149 | + void SetClass(class ObjectManager *in_ObjMgr, int in_ctrlid, class PointDataInterface *in_Points); | |
| 150 | + void Init(); | |
| 151 | + bool MovePathNowState(); | |
| 152 | + bool MovePathNextState(); | |
| 153 | + void SetHoldWait(float px, float pz, float rx); | |
| 154 | + void SetHoldTracking(int id); | |
| 155 | + int GetMoveMode(); | |
| 156 | + bool GetRun2(); | |
| 157 | + int GetTargetHumanID(); | |
| 158 | + void GetPathPointData(pointdata *out_data); | |
| 159 | + void GetTargetPos(float *posx, float *posz, float *rx, int *out_movemode, int *out_pointmode); | |
| 160 | +}; | |
| 161 | + | |
| 162 | +//! @brief 人移動回転制御クラス | |
| 163 | +//! @details 人の移動制御と回転制御をフラグ管理するクラスです。AIcontrolクラス内で使用します。 | |
| 164 | +class AIObjectDriver | |
| 165 | +{ | |
| 166 | + class ObjectManager *ObjMgr; //!< ObjectManagerクラスのポインタ | |
| 167 | + int ctrlid; //!< 自分自身(制御対象)の人番号 | |
| 168 | + | |
| 169 | + int moveturn_mode; //!< 移動方向や回転方向のフラグ | |
| 170 | + float addrx; //!< X軸回転角加速度 | |
| 171 | + float addry; //!< Y軸回転角加速度 | |
| 172 | + | |
| 173 | +public: | |
| 174 | + AIObjectDriver(class ObjectManager *in_ObjMgr = NULL, int in_ctrlid = -1); | |
| 175 | + ~AIObjectDriver(); | |
| 176 | + void SetClass(class ObjectManager *in_ObjMgr, int in_ctrlid); | |
| 177 | + void Init(); | |
| 178 | + void ResetMode(); | |
| 179 | + void SetModeFlag(int flag); | |
| 180 | + void DelModeFlag(int flag); | |
| 181 | + bool GetModeFlag(int flag); | |
| 182 | + void ControlObject(); | |
| 183 | +}; | |
| 184 | + | |
| 134 | 185 | //! AIの制御モードを表す定数 |
| 186 | +//! @warning 定数を変更する場合、必要に応じてGetBattleMode()関数の文字列出力処理も変更すること。 | |
| 135 | 187 | enum AImode { |
| 136 | 188 | AI_DEAD = 0, //!< 死亡している人 |
| 137 | 189 | AI_ACTION, //!< 戦闘中の人 |
| @@ -149,6 +201,21 @@ | ||
| 149 | 201 | AI_NULL //!< パスなし |
| 150 | 202 | }; |
| 151 | 203 | |
| 204 | +//! AIの移動モードを表す定数 | |
| 205 | +enum AIMoveNaviFlag { | |
| 206 | + AI_NAVI_MOVE_NULL, | |
| 207 | + AI_NAVI_MOVE_WALK, | |
| 208 | + AI_NAVI_MOVE_RUN, | |
| 209 | + AI_NAVI_MOVE_RUN2, | |
| 210 | + AI_NAVI_MOVE_TRACKING, | |
| 211 | + | |
| 212 | + AI_NAVI_POINT_NULL, | |
| 213 | + AI_NAVI_POINT_WAIT, | |
| 214 | + AI_NAVI_POINT_STOP, | |
| 215 | + AI_NAVI_POINT_TRACKING, | |
| 216 | + AI_NAVI_POINT_GRENADE | |
| 217 | +}; | |
| 218 | + | |
| 152 | 219 | //! AIの操作モードを表す定数 |
| 153 | 220 | enum AIcontrolFlag { |
| 154 | 221 | AI_CTRL_MOVEFORWARD = 0x0001, |
| @@ -1491,6 +1491,20 @@ | ||
| 1491 | 1491 | return GeHumanObject(Player_HumanID); |
| 1492 | 1492 | } |
| 1493 | 1493 | |
| 1494 | +//! @brief 指定したhumanポインタのデータ番号を取得 | |
| 1495 | +//! @param object 人オブジェクトのポインタ | |
| 1496 | +//! @return データ番号 (エラー:-1) | |
| 1497 | +int ObjectManager::GetHumanObjectID(human* object) | |
| 1498 | +{ | |
| 1499 | + for(int i=0; i<MAX_HUMAN; i++){ | |
| 1500 | + if( &(HumanIndex[i]) == object ){ | |
| 1501 | + return i; | |
| 1502 | + } | |
| 1503 | + } | |
| 1504 | + | |
| 1505 | + return -1; | |
| 1506 | +} | |
| 1507 | + | |
| 1494 | 1508 | //! @brief 指定したデータ番号のweaponクラスを取得 |
| 1495 | 1509 | //! @param id データ番号 |
| 1496 | 1510 | //! @return 武器オブジェクトのポインタ (無効なデータ番号で NULL) |
| @@ -179,6 +179,7 @@ | ||
| 179 | 179 | bool PlayerAI; //!< プレイヤー操作をAIに委ねる |
| 180 | 180 | bool AIstop; //!< AI処理を停止する |
| 181 | 181 | bool AINoFight; //!< AIが非戦闘化する(戦わない) |
| 182 | + int AIdebuginfoID; //!< AIのデバック情報表示 | |
| 182 | 183 | int start_framecnt; //!< メインゲーム開始時のカウント |
| 183 | 184 | int end_framecnt; //!< メインゲーム終了のカウント |
| 184 | 185 | bool EventStop; //!< イベント処理を停止する |