void ZCannon::SetAttackObject(ZObject *obj) { attack_object = obj; if(attack_object) { int tx, ty; int new_dir; attack_object->GetCenterCords(tx, ty); new_dir = DirectionFromLoc(tx - loc.x, ty - loc.y); if(new_dir != -1) direction = new_dir; } }
void ZMannedObject::SetAttackObject(ZObject *obj) { m_attacked_object = obj; if (m_attacked_object) { int tx, ty; m_attacked_object->GetCenterCords(tx, ty); int new_dir = DirectionFromLoc(tx - loc.x, ty - loc.y); if (new_dir != -1) { direction = new_dir; } } }
void ZVehicle::RecalcDirection() { int new_dir; new_dir = DirectionFromLoc(loc.dx, loc.dy); if(new_dir != -1) { moving = true; direction = new_dir; move_i = 0; //printf("mode:walking\n"); } else { moving = false; //printf("mode:standing\n"); } }