void ch_mode(int mode) { reset(); switch(mode){ case 1: search_max(); break; case 2: trace(); break; case 3: trace2(); break; case 4: line_check(); break; case 5: out_senc_drive_mot(); break; case 6: out_senc(); break; case 7: out_curve(); break; } }
bool MapCollision::line_of_movement(const float& x1, const float& y1, const float& x2, const float& y2, MOVEMENTTYPE movement_type) { if (is_outside_map(x2, y2)) return false; // intangible entities can always move if (movement_type == MOVEMENT_INTANGIBLE) return true; // if the target is blocking, clear it temporarily int tile_x = int(x2); int tile_y = int(y2); bool target_blocks = false; int target_blocks_type = colmap[tile_x][tile_y]; if (colmap[tile_x][tile_y] == BLOCKS_ENTITIES || colmap[tile_x][tile_y] == BLOCKS_ENEMIES) { target_blocks = true; unblock(x2,y2); } bool has_movement = line_check(x1, y1, x2, y2, CHECK_MOVEMENT, movement_type); if (target_blocks) block(x2,y2, target_blocks_type == BLOCKS_ENEMIES); return has_movement; }
bool MapCollision::line_of_sight(const float& x1, const float& y1, const float& x2, const float& y2) { return line_check(x1, y1, x2, y2, CHECK_SIGHT, MOVEMENT_NORMAL); }