image map util





PHPXRef 0.7 : NEABExplorer : /libs/image_map_util.php source









[ Index ]


PHP Cross Reference of NEABExplorer














if (gwGetCookie('xrefnav')=='off')
document.write('[ Show Explorer ]');
else
document.write('[ Hide Explorer ]');



[ Show Explorer ]
[ Hide Navbar ]





titleBody[close]
/libs/ -> image_map_util.php (source)

[Summary view]
[Print]
[Text view]


1 <?PHP
2 /**
3 * Used for the mini map drawing
4 */
5
6 function alloc_colors($img)
7 {
8 $cols=array();
9 // 0 1 2 3 4 5 6 7
10 $strcolors=array("78E317","98664E","6C4837","C7A392","EBC792","000000","F07D0B","0000FF",
11 // 8 9 10 11 12 13 14 15 16 17
12 "A0A0A0","009900","999999","996600","FFFFFF","D28080","C8EAF6","0000DD","A13815","DC5300");
13 foreach($strcolors as $v)
14 {
15 $r=hexdec(substr($v,0,2));
16 $g=hexdec(substr($v,2,2));
17 $b=hexdec(substr($v,4,2));
18 $cols[]=imagecolorallocate($img,$r,$g,$b);
19 }
20 return $cols;
21 }
22
23 function object_color($type)
24 {
25 global $uservals;
26
27 if($type >= 11 && $type <= 53) // Houses
28 return 13;
29 if($type >= 65 && $type <= 112) // Castle
30 return 13;
31 if($type >= 175 && $type <= 186) // Big house
32 return 13;
33 if($type >= 212 && $type <= 219) // Tower and house
34 return 13;
35 if($type >= 286 && $type <= 291) // House and sign
36 return 13;
37 if($type >= 224 && $type <= 227) // Smith
38 return 13;
39 if($type >= 229 && $type <= 244) // Fisherman, Token Shop, School
40 return 13;
41 if($type >= 343 && $type <= 354) // House
42 return 13;
43 if($type >= 323 && $type <= 328) // Waterfall
44 return 7;
45
46 if((($uservals['LOCATION']+0) < 0 || ($_GET["LOCATION"]+0) < 0 ) && $type >= 277 && $type <= 284)
47 return 6;
48
49 switch($type)
50 {
51 case 0:
52 return 0;
53 case 247: // Something to pick up... normaly.
54 return 9;
55 case 115: // Down
56 case 117:
57 case 114: // Up
58 case 118:
59 return 12;
60 case 54: // Only while editing
61 if($_GET["ADMIN"] != 0)
62 return 9;
63 return 0;
64 case 5: // Trees
65 case 57:
66 case 58:
67 case 62:
68 case 63:
69 case 329:
70 case 330:
71 case 331:
72 case 332:
73 case 333:
74 case 334:
75 case 335:
76 case 336:
77 case 337:
78 case 338:
79 case 339:
80 case 340:
81 case 341:
82 case 342:
83 case 402:
84 return 9;
85 case 292: // Shrine
86 return 13;
87 default:
88 return 0;
89 }
90 }
91
92
93 function title_color($type)
94 {
95 if($type == 42)
96 return 1;
97 if($type == 78)
98 return 2;
99 if($type == 72 || $type == 458 || $type == 465)
100 return 12;
101 if($type == 192)
102 return 13;
103 if($type == 92 || $type == 102 || $type == 103)
104 return 8;
105 if($type >= 8 && $type <= 22) // roads
106 return 3;
107 if($type >= 23 && $type <= 37) // sand
108 return 4;
109 if(($type >= 38 && $type != 42 && $type <= 51) || ($type >= 501 && $type <= 508)) // Cave
110 return 5;
111 if($type >= 88 && $type != 92 && $type != 102 && $type != 103 && $type <= 105) // Dungeon
112 return 5;
113 if($type >= 74 && $type != 78 && $type <= 87) // Magma
114 return 6;
115 if(($type >= 52 && $type <= 64) || ($type >= 493 && $type <= 500)) // Water
116 return 7;
117 if($type >= 376 && $type <= 388) //Deep water
118 return 15;
119 if(($type >= 65 && $type <= 73 && $type != 72) || ($type >= 424 && $type <= 457) || ($type >= 459 && $type <= 464) || ($type >= 468 && $type <= 469))
120 // Mountain (but not the cave)
121 return 8;
122 if($type >= 108 && $type <= 132) // Ice
123 return 14;
124 if($type >= 133 && $type <= 142) // Bridge
125 return 13;
126 if(($type >= 143 && $type <= 144) || ($type >= 370 && $type <= 375)
127 || ($type >= 422 && $type <= 423) || ($type >= 489 && $type <= 492)) // Dock
128 return 4;
129 if($type >= 173 && $type <= 187) // Ice road
130 return 3;
131 if($type >= 188 && $type <= 201 && $type != 192) // Sky
132 return 7;
133 if($type >= 389 && $type <= 421) //Ship
134 return 16;
135 if($type >= 470 && $type <= 487) // Carpet
136 return 17;
137 if(in_array($type,array(42,78,92,192,206,220,234,248,262,276,290,304,318,332,346,360))) // Dungeon
138 return 1;
139 if(($type >= 202 && $type <= 369) || $type == 488) // Dungeon walls
140 return 5;
141 return 0; // Grass
142 }
143
144 function draw_map($map,$obj)
145 {
146 $strcolors=array("78E317","98664E","6C4837","C7A392","EBC792","000000","F07D0B","0000FF","A0A0A0","009900","999999","996600","FFFFFF","D28080","C8EAF6","0000DD","A13815","DC5300");
147 foreach($strcolors as $v)
148 {
149 $r=hexdec(substr($v,0,2));
150 $g=hexdec(substr($v,2,2));
151 $b=hexdec(substr($v,4,2));
152 $cols[]=imagecolorallocate($im,$r,$g,$b);
153 }
154 for($i=0;$i < 99;$i++)
155 {
156 for($j=0;$j < 99;$j++)
157 {
158 $t=title_color($map[$i][$j]);
159 $o=object_color($obj[$i][$j]);
160 if($o != 0)
161 $t=$o;
162 imagefilledrectangle($im,$i*2,$j*2,$i*2+1,$j*2+1,$cols[$t]);
163 }
164 }
165 }
166 ?>



FUNC_DATA={
'object_color': ['object_color', '', [['libs','image_map_util.php',23]], 2],
'alloc_colors': ['alloc_colors', 'Used for the mini map drawing ', [['libs','image_map_util.php',2]], 1],
'draw_map': ['draw_map', '', [['libs','image_map_util.php',144]], 0],
'title_color': ['title_color', '', [['libs','image_map_util.php',93]], 2],
'substr': ['substr', '', [], 91],
'imagecolorallocate': ['imagecolorallocate', '', [], 4],
'in_array': ['in_array', '', [], 27],
'hexdec': ['hexdec', '', [], 16],
'imagefilledrectangle': ['imagefilledrectangle', '', [], 3]};
CLASS_DATA={
};
CONST_DATA={
};

titleDescriptionBody
titleDescriptionBody
titleDescriptionBody
titleBody



Generated: Sun Jul 8 18:11:25 2007
Cross-referenced by PHPXref 0.7





Wyszukiwarka

Podobne podstrony:
image map util
image map util
image map util
map util
map util
map util
map util
Util js
image
function pdf execute image
G28 Mirror Image
java awt image IndexColorModel

więcej podobnych podstron