Beispiel #1
0
function dessine_lieux($x, $y, $taille, $pas, $info_text, $tab_couleur, $info, $nom_lieu)
{
    global $image;
    $x_min = $x - $taille / 2;
    $x_max = $x + $taille / 2;
    $y_min = $y - $taille / 2;
    $y_max = $y + $taille / 2;
    $lesLieux = selectDbGpsLieux($x_min, $x_max, $y_min, $y_max, $nom_lieu);
    $nbLieux = count($lesLieux);
    for ($i = 1; $i <= $nbLieux; $i++) {
        $res = $lesLieux[$i];
        if ($res[z_lieu] == '0') {
            $z = 0;
        } else {
            $z = $res[z_lieu];
        }
        if ($res[z_lieu] < 1) {
            $level = 0;
        } elseif ($res[z_lieu] < 2) {
            $level = 1;
        } else {
            if ($res[z_lieu] < 3) {
                $level = 2;
            } else {
                if ($res[z_lieu] < 5) {
                    $level = 3;
                } else {
                    $level = 4;
                }
            }
        }
        // Combien vaut x et y pour la map
        $x_map = D + TAILLE_MAP / 2 - $x * $pas + $pas * $res[x_lieu];
        $y_map = D + TAILLE_MAP / 2 + $y * $pas - $pas * $res[y_lieu];
        $img_file_lieux = imgLieu($res[nom_lieu]);
        switch ($img_file_lieux) {
            case "puit":
                $img_file_lieux = "puit.png";
                break;
            case "geyser":
                $img_file_lieux = "geyser.png";
                break;
            case "taniere-oqp":
                $img_file_lieux = "tanoqp.png";
                break;
            case "taniere-vide":
                $img_file_lieux = "tanvide.png";
                break;
            case "gowapier":
                $img_file_lieux = "gowapier.png";
                break;
            case "portail":
                $img_file_lieux = "portail.png";
                break;
            case "lieu":
                $img_file_lieux = "lieu.png";
                break;
        }
        $img_lieux = ImageCreateFromPng("images/gps/{$img_file_lieux}");
        $img_l_src_w = imagesx($img_lieux);
        $img_l_src_h = imagesy($img_lieux);
        $img_l_dest_w = imagesx($img_lieux) * $pas / 60;
        $img_l_dest_h = imagesy($img_lieux) * $pas / 60;
        // centrage de l'image sur la position de la tanière
        $x_l_map = $x_map - $img_l_dest_w / 2;
        $y_l_map = $y_map - $img_l_dest_h / 2;
        ImageCopyResized($image, $img_lieux, $x_l_map, $y_l_map, 0, 0, $img_l_dest_w, $img_l_dest_h, $img_l_src_w, $img_l_src_h);
        // On affiche le nom du troll si la vue est <= 50, soit la taille <=100.
        // et que la taille de la map est >= 400 Sinon, on voit rien
        // c'est devenu une option nommée info_text
        if ($taille <= $info_text * 2 && TAILLE_MAP >= 400) {
            imagestring($image, 2, $x_map, $y_map, stripslashes($res[nom_lieu]) . '(' . $res[x_lieu] . ',' . $res[y_lieu] . ',' . $z . ' )', $tab_couleur[$level]);
        }
    }
    affiche_texte_bottom($info . ":" . $nbLieux, $tab_couleur);
}
Beispiel #2
0
function vue2d_afficher_get_image_lieux($ax, $ay, $lieux, $min_z, $max_z, $zoom, $anim)
{
    global $imgSizes;
    $n_lieux = 0;
    if ($lieux[$ax + 100][$ay + 100]) {
        foreach ($lieux[$ax + 100][$ay + 100] as $lieu) {
            if ($lieu[z] >= $min_z && $lieu[z] <= $max_z) {
                echo "<a name='{$lieu['id']}'></a>";
                $n_lieux++;
            }
        }
    }
    if ($n_lieux > 0) {
        echo "<img src='images/";
        if ($anim == 'oui') {
            $img = imgLieu($lieu);
            echo $img . ".gif";
        } else {
            $img = imgLieu($lieu);
            echo $img . "-fixe.gif";
        }
        echo "' width='";
        echo $imgSizes[$img][0] / $zoom;
        echo "' border=0 alt='{$img}'>";
    }
}