Mercurial > traipse_dev
comparison orpg/mapper/fog.py @ 139:8e07c1a2c69b alpha
Traipse Alpha 'OpenRPG' {091123-00}
Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for
developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to
the code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the productivity of the user.
Update Summary (Cleaning up for Beta)
Added Bookmarks
Fix to Remote Admin Commands
Minor fix to text based Server
Fix to Pretty Print, from Core
Fix to Splitter Nodes not being created
Fix to massive amounts of images loading, from Core
Added 'boot' command to remote admin
Added confirmation window for sent nodes
Minor changes to allow for portability to an OpenSUSE linux OS
Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG
Zoom Mouse plugin added
Images added to Plugin UI
Switching to Element Tree
Map efficiency, from FlexiRPG
Added Status Bar to Update Manager
default_manifest.xml renamed to default_upmana.xml
Cleaner clode for saved repositories
New TrueDebug Class in orpg_log (See documentation for usage)
Mercurial's hgweb folder is ported to upmana
Pretty important update that can help remove thousands of dead children from your gametree.
Children, <forms />, <group_atts />, <horizontal />, <cols />, <rows />, <height />, etc... are all tags now. Check
your gametree and look for dead children!!
New Gametree Recursion method, mapping, and context sensitivity. !Infinite Loops return error instead of freezing the
software!
New Syntax added for custom PC sheets
Tip of the Day added, from Core and community
Fixed Whiteboard ID to prevent random line or text deleting. Modified ID's to prevent non updated clients from
ruining the fix.
author | sirebral |
---|---|
date | Mon, 23 Nov 2009 03:22:50 -0600 |
parents | 54446a995007 |
children | 06f10429eedc |
comparison
equal
deleted
inserted
replaced
138:1ed2feab0db9 | 139:8e07c1a2c69b |
---|---|
81 def __init__(self, canvas): | 81 def __init__(self, canvas): |
82 self.canvas = canvas | 82 self.canvas = canvas |
83 self.log = component.get('log') | 83 self.log = component.get('log') |
84 layer_base.__init__(self) | 84 layer_base.__init__(self) |
85 self.color = wx.Color(128, 128, 128) | 85 self.color = wx.Color(128, 128, 128) |
86 #if "__WXGTK__" not in wx.PlatformInfo: self.color = wx.Color(128,128,128, 128) | |
87 self.fogregion = wx.Region() | 86 self.fogregion = wx.Region() |
88 self.fogregion.Clear() | 87 self.fogregion.Clear() |
89 self.fog_bmp = None | 88 self.fog_bmp = None |
90 self.width = 0 | 89 self.width = 0 |
91 self.height = 0 | 90 self.height = 0 |
120 self.height = size[1] | 119 self.height = size[1] |
121 self.fog_bmp = wx.EmptyBitmap(self.width,self.height) | 120 self.fog_bmp = wx.EmptyBitmap(self.width,self.height) |
122 self.fill_fog() | 121 self.fill_fog() |
123 | 122 |
124 def fill_fog(self): | 123 def fill_fog(self): |
125 if not self.use_fog: | 124 if not self.use_fog: return |
126 return | |
127 mdc = wx.MemoryDC() | 125 mdc = wx.MemoryDC() |
128 mdc.SelectObject(self.fog_bmp) | 126 mdc.SelectObject(self.fog_bmp) |
129 mdc.SetPen(wx.TRANSPARENT_PEN) | 127 mdc.SetPen(wx.TRANSPARENT_PEN) |
130 if (self.canvas.frame.session.role == "GM"): color = self.color | 128 if (self.canvas.frame.session.role == "GM"): color = self.color |
131 else: color = wx.BLACK | 129 else: color = wx.BLACK |
142 | 140 |
143 def layerDraw(self, dc, topleft, size): | 141 def layerDraw(self, dc, topleft, size): |
144 if self.fog_bmp == None or not self.fog_bmp.Ok() or not self.use_fog: | 142 if self.fog_bmp == None or not self.fog_bmp.Ok() or not self.use_fog: |
145 return | 143 return |
146 if self.last_role != self.canvas.frame.session.role: self.fill_fog() | 144 if self.last_role != self.canvas.frame.session.role: self.fill_fog() |
147 | |
148 mdc = wx.MemoryDC() | 145 mdc = wx.MemoryDC() |
149 mdc.SelectObject(self.fog_bmp) | 146 mdc.SelectObject(self.fog_bmp) |
150 dc.Blit(0, 0, self.canvas.size[0], self.canvas.size[1], mdc, 0, 0, wx.AND) | 147 dc.Blit(0, 0, self.canvas.size[0], self.canvas.size[1], mdc, 0, 0, wx.AND) |
151 mdc.SelectObject(wx.NullBitmap) | 148 mdc.SelectObject(wx.NullBitmap) |
152 del mdc | 149 del mdc |
182 def scanConvert(self, polypt): | 179 def scanConvert(self, polypt): |
183 regn = wx.Region() | 180 regn = wx.Region() |
184 regn.Clear() | 181 regn.Clear() |
185 list = IRegion().scan_Convert(polypt) | 182 list = IRegion().scan_Convert(polypt) |
186 for i in list: | 183 for i in list: |
187 if regn.IsEmpty(): | 184 if regn.IsEmpty(): regn = wx.Region(i.left*COURSE, i.y*COURSE, i.right*COURSE+1-i.left*COURSE, 1*COURSE) |
188 #if "__WXGTK__" not in wx.PlatformInfo: | 185 else: regn.Union(i.left*COURSE, i.y*COURSE, i.right*COURSE+1-i.left*COURSE, 1*COURSE) |
189 regn = wx.Region(i.left*COURSE, i.y*COURSE, i.right*COURSE+1-i.left*COURSE, 1*COURSE) | |
190 #else: regn = wx.Region(i.left, i.y, i.right+1-i.left, 1) | |
191 else: | |
192 #if "__WXGTK__" not in wx.PlatformInfo: | |
193 regn.Union(i.left*COURSE, i.y*COURSE, i.right*COURSE+1-i.left*COURSE, 1*COURSE) | |
194 #else: regn.Union(i.left, i.y, i.right+1-i.left, 1) | |
195 return regn | 186 return regn |
196 | 187 |
197 def add_area(self, area="", show="Yes"): | 188 def add_area(self, area="", show="Yes"): |
198 poly = FogArea(area, self.log) | 189 poly = FogArea(area, self.log) |
199 xml_str = "<map><fog>" | 190 xml_str = "<map><fog>" |
207 xml_str += poly.toxml("del") | 198 xml_str += poly.toxml("del") |
208 xml_str += "</fog></map>" | 199 xml_str += "</fog></map>" |
209 if show == "Yes": self.canvas.frame.session.send(xml_str) | 200 if show == "Yes": self.canvas.frame.session.send(xml_str) |
210 | 201 |
211 def layerToXML(self, action="update"): | 202 def layerToXML(self, action="update"): |
212 if not self.use_fog: return "" | 203 if not self.use_fog: |
204 return "" | |
213 fog_string = "" | 205 fog_string = "" |
214 ri = wx.RegionIterator(self.fogregion) | 206 ri = wx.RegionIterator(self.fogregion) |
215 if not (ri.HaveRects()): fog_string = FogArea("all", self.log).toxml("del") | 207 if not (ri.HaveRects()): fog_string = FogArea("all", self.log).toxml("del") |
216 while ri.HaveRects(): | 208 while ri.HaveRects(): |
217 #if "__WXGTK__" not in wx.PlatformInfo: | |
218 x1 = ri.GetX()/COURSE | 209 x1 = ri.GetX()/COURSE |
219 x2 = x1+(ri.GetW()/COURSE)-1 | 210 x2 = x1+(ri.GetW()/COURSE)-1 |
220 y1 = ri.GetY()/COURSE | 211 y1 = ri.GetY()/COURSE |
221 y2 = y1+(ri.GetH()/COURSE)-1 | 212 y2 = y1+(ri.GetH()/COURSE)-1 |
222 #else: | |
223 # x1 = ri.GetX() | |
224 # x2 = x1+ri.GetW()-1 | |
225 # y1 = ri.GetY() | |
226 # y2 = y1+ri.GetH()-1 | |
227 poly = FogArea(str(x1) + "," + str(y1) + ";" + | 213 poly = FogArea(str(x1) + "," + str(y1) + ";" + |
228 str(x2) + "," + str(y1) + ";" + | 214 str(x2) + "," + str(y1) + ";" + |
229 str(x2) + "," + str(y2) + ";" + | 215 str(x2) + "," + str(y2) + ";" + |
230 str(x1) + "," + str(y2), self.log) | 216 str(x1) + "," + str(y2), self.log) |
231 fog_string += poly.toxml(action) | 217 fog_string += poly.toxml(action) |
242 def layerTakeDOM(self, xml_dom): | 228 def layerTakeDOM(self, xml_dom): |
243 try: | 229 try: |
244 if not self.use_fog: | 230 if not self.use_fog: |
245 self.use_fog = True | 231 self.use_fog = True |
246 self.recompute_fog() | 232 self.recompute_fog() |
247 if xml_dom.get('serial'): self.serial_number = int(xml_dom.get('serial')) | 233 if xml_dom.hasAttribute('serial'): self.serial_number = int(xml_dom.getAttribute('serial')) |
248 children = xml_dom.getchildren() | 234 children = xml_dom._get_childNodes() |
249 for l in children: | 235 for l in children: |
250 action = l.get("action") | 236 action = l.getAttribute("action") |
251 outline = l.get("outline") | 237 outline = l.getAttribute("outline") |
252 if (outline == "all"): | 238 if (outline == "all"): |
253 polyline = [IPoint().make(0,0), IPoint().make(self.width-1, 0), | 239 polyline = [IPoint().make(0,0), IPoint().make(self.width-1, 0), |
254 IPoint().make(self.width-1, self.height-1), | 240 IPoint().make(self.width-1, self.height-1), |
255 IPoint().make(0, self.height-1)] | 241 IPoint().make(0, self.height-1)] |
256 elif (outline == "none"): | 242 elif (outline == "none"): |
259 self.fog_bmp = None | 245 self.fog_bmp = None |
260 else: | 246 else: |
261 polyline = [] | 247 polyline = [] |
262 lastx = None | 248 lastx = None |
263 lasty = None | 249 lasty = None |
264 list = l.getchildren() | 250 list = l._get_childNodes() |
265 for point in list: | 251 for point in list: |
266 x = point.get( "x" ) | 252 x = point.getAttribute( "x" ) |
267 y = point.get( "y" ) | 253 y = point.getAttribute( "y" ) |
268 if (x != lastx or y != lasty): | 254 if (x != lastx or y != lasty): |
269 polyline.append(IPoint().make(int(x), int(y))) | 255 polyline.append(IPoint().make(int(x), int(y))) |
270 lastx = x | 256 lastx = x |
271 lasty = y | 257 lasty = y |
272 if (len(polyline) > 1): self.createregn2(polyline, action, "No") | 258 if (len(polyline) > 1): self.createregn2(polyline, action, "No") |