comparison orpg/mapper/fog.py @ 151:06f10429eedc alpha

Traipse Alpha 'OpenRPG' {091125-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 Wed, 25 Nov 2009 06:15:49 -0600
parents 8e07c1a2c69b
children 81d0bfd5e800
comparison
equal deleted inserted replaced
149:c2caca988a11 151:06f10429eedc
104 self.add_area("none") 104 self.add_area("none")
105 self.fog_bmp = None 105 self.fog_bmp = None
106 106
107 def resize(self, size): 107 def resize(self, size):
108 try: 108 try:
109 if self.width == size[0] and self.height == size[1]: 109 if self.width == size[0] and self.height == size[1]: return
110 return
111 self.recompute_fog() 110 self.recompute_fog()
112 except: pass 111 except: pass
113 112
114 def recompute_fog(self): 113 def recompute_fog(self):
115 if not self.use_fog: 114 if not self.use_fog:
137 mdc.DrawRectangle(0, 0, self.width+2, self.height+2) 136 mdc.DrawRectangle(0, 0, self.width+2, self.height+2)
138 mdc.SelectObject(wx.NullBitmap) 137 mdc.SelectObject(wx.NullBitmap)
139 del mdc 138 del mdc
140 139
141 def layerDraw(self, dc, topleft, size): 140 def layerDraw(self, dc, topleft, size):
142 if self.fog_bmp == None or not self.fog_bmp.Ok() or not self.use_fog: 141 if self.fog_bmp == None or not self.fog_bmp.Ok() or not self.use_fog: return
143 return
144 if self.last_role != self.canvas.frame.session.role: self.fill_fog() 142 if self.last_role != self.canvas.frame.session.role: self.fill_fog()
145 mdc = wx.MemoryDC() 143 mdc = wx.MemoryDC()
146 mdc.SelectObject(self.fog_bmp) 144 mdc.SelectObject(self.fog_bmp)
147 dc.Blit(0, 0, self.canvas.size[0], self.canvas.size[1], mdc, 0, 0, wx.AND) 145 dc.Blit(0, 0, self.canvas.size[0], self.canvas.size[1], mdc, 0, 0, wx.AND)
148 mdc.SelectObject(wx.NullBitmap) 146 mdc.SelectObject(wx.NullBitmap)
150 148
151 def createregn2(self, polyline, mode, show): 149 def createregn2(self, polyline, mode, show):
152 regn = self.scanConvert(polyline) 150 regn = self.scanConvert(polyline)
153 area = "" 151 area = ""
154 for i in polyline: 152 for i in polyline:
155 if (area != ""): 153 if (area != ""): area += ";"
156 area += ";"
157 area += str(i.X) + "," + str(i.Y) 154 area += str(i.X) + "," + str(i.Y)
158 if mode == 'new': 155 if mode == 'new':
159 if self.fogregion.IsEmpty(): 156 if self.fogregion.IsEmpty(): self.fogregion = regn
160 self.fogregion = regn
161 else: self.fogregion.UnionRegion(regn) 157 else: self.fogregion.UnionRegion(regn)
162 self.add_area(area, show) 158 self.add_area(area, show)
163 else: 159 else:
164 if not self.fogregion.IsEmpty(): 160 if not self.fogregion.IsEmpty(): self.fogregion.SubtractRegion(regn)
165 self.fogregion.SubtractRegion(regn)
166 else: 161 else:
167 self.fogregion = wx.Region(0, 0, self.canvas.size[0], self.canvas.size[1]) 162 self.fogregion = wx.Region(0, 0, self.canvas.size[0], self.canvas.size[1])
168 self.fogregion.SubtractRegion(regn) 163 self.fogregion.SubtractRegion(regn)
169 self.del_area(area, show) 164 self.del_area(area, show)
170 165
198 xml_str += poly.toxml("del") 193 xml_str += poly.toxml("del")
199 xml_str += "</fog></map>" 194 xml_str += "</fog></map>"
200 if show == "Yes": self.canvas.frame.session.send(xml_str) 195 if show == "Yes": self.canvas.frame.session.send(xml_str)
201 196
202 def layerToXML(self, action="update"): 197 def layerToXML(self, action="update"):
203 if not self.use_fog: 198 if not self.use_fog: return ""
204 return ""
205 fog_string = "" 199 fog_string = ""
206 ri = wx.RegionIterator(self.fogregion) 200 ri = wx.RegionIterator(self.fogregion)
207 if not (ri.HaveRects()): fog_string = FogArea("all", self.log).toxml("del") 201 if not (ri.HaveRects()): fog_string = FogArea("all", self.log).toxml("del")
208 while ri.HaveRects(): 202 while ri.HaveRects():
209 x1 = ri.GetX()/COURSE 203 x1 = ri.GetX()/COURSE
220 s = "<fog" 214 s = "<fog"
221 s += ">" 215 s += ">"
222 s += fog_string 216 s += fog_string
223 s += "</fog>" 217 s += "</fog>"
224 return s 218 return s
225 else: 219 else: return ""
226 return ""
227 220
228 def layerTakeDOM(self, xml_dom): 221 def layerTakeDOM(self, xml_dom):
229 try: 222 try:
230 if not self.use_fog: 223 if not self.use_fog:
231 self.use_fog = True 224 self.use_fog = True