| 319 | -------------------------------------------------------------------------------*/ |
| 320 | |
| 321 | int pathCheckObstacle(int x, int y, Entity* my, Entity* target) |
| 322 | { |
| 323 | const int u = std::min(std::max(0, x >> 4), (int)map.width - 1); |
| 324 | const int v = std::min(std::max(0, y >> 4), (int)map.height - 1); |
| 325 | const int index = v * MAPLAYERS + u * MAPLAYERS * map.height; |
| 326 | |
| 327 | if ( map.tiles[OBSTACLELAYER + index] || !map.tiles[index] || lavatiles[map.tiles[index]] ) |
| 328 | { |
| 329 | return 1; |
| 330 | } |
| 331 | |
| 332 | // entities not passable during this stage normally, hell generation makes entry gates passable |
| 333 | for ( node_t* node = map.entities->first; node != nullptr; node = node->next ) |
| 334 | { |
| 335 | Entity* entity = (Entity*)node->element; |
| 336 | if (entity == my || entity == target) |
| 337 | { |
| 338 | continue; |
| 339 | } |
| 340 | if ( entity->sprite == 179 ) // collider |
| 341 | { |
| 342 | if ( (int)floor(entity->x / 16) == u && (int)floor(entity->y / 16) == v ) |
| 343 | { |
| 344 | if ( entity->colliderHasCollision != 0 || entity->colliderDiggable != 0 ) |
| 345 | { |
| 346 | return 1; |
| 347 | } |
| 348 | auto find = EditorEntityData_t::colliderData.find(entity->colliderDamageTypes); |
| 349 | if ( find != EditorEntityData_t::colliderData.end() ) |
| 350 | { |
| 351 | auto& colliderDmgType = EditorEntityData_t::colliderDmgTypes[find->second.damageCalculationType]; |
| 352 | if ( !colliderDmgType.allowNPCPathing ) |
| 353 | { |
| 354 | return 1; |
| 355 | } |
| 356 | } |
| 357 | } |
| 358 | } |
| 359 | else if ( entity->sprite == 14 // fountain |
| 360 | || entity->sprite == 15 // sink |
| 361 | || (entity->sprite == 19 && !entity->flags[PASSABLE]) // gate |
| 362 | || (entity->sprite == 20 && !entity->flags[PASSABLE]) // gate 2 |
| 363 | || entity->sprite == 39 // head stone |
| 364 | || entity->sprite == 44 // boulder? |
| 365 | || entity->sprite == 106 // power crystal |
| 366 | || entity->sprite == 108 // stalag column |
| 367 | || entity->sprite == 109 // stalagmite |
| 368 | || entity->sprite == 110 // stalagmite |
| 369 | || entity->sprite == 116 // pedestal |
| 370 | || entity->sprite == 124 // column |
| 371 | || entity->sprite == 126 // piston |
| 372 | || entity->sprite == 169 // statue |
| 373 | || entity->sprite == 177 // shrine |
| 374 | || entity->sprite == 178 // spell shrine |
| 375 | || entity->sprite == 1481 // daedalus shrine |
| 376 | || entity->sprite == 217 // iron door |
| 377 | || entity->sprite == 218 // iron door |
| 378 | || entity->sprite == 300 // cauldron |
no test coverage detected