comparison orpg/mapper/fog.py @ 140:e842a5f1b775 beta

Traipse Beta '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 (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:36:26 -0600
parents dcf4fbe09b70
children 6081bdc2b8d5
comparison
equal deleted inserted replaced
135:dcf4fbe09b70 140:e842a5f1b775
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>"
213 return "" 204 return ""
214 fog_string = "" 205 fog_string = ""
215 ri = wx.RegionIterator(self.fogregion) 206 ri = wx.RegionIterator(self.fogregion)
216 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")
217 while ri.HaveRects(): 208 while ri.HaveRects():
218 #if "__WXGTK__" not in wx.PlatformInfo:
219 x1 = ri.GetX()/COURSE 209 x1 = ri.GetX()/COURSE
220 x2 = x1+(ri.GetW()/COURSE)-1 210 x2 = x1+(ri.GetW()/COURSE)-1
221 y1 = ri.GetY()/COURSE 211 y1 = ri.GetY()/COURSE
222 y2 = y1+(ri.GetH()/COURSE)-1 212 y2 = y1+(ri.GetH()/COURSE)-1
223 #else:
224 # x1 = ri.GetX()
225 # x2 = x1+ri.GetW()-1
226 # y1 = ri.GetY()
227 # y2 = y1+ri.GetH()-1
228 poly = FogArea(str(x1) + "," + str(y1) + ";" + 213 poly = FogArea(str(x1) + "," + str(y1) + ";" +
229 str(x2) + "," + str(y1) + ";" + 214 str(x2) + "," + str(y1) + ";" +
230 str(x2) + "," + str(y2) + ";" + 215 str(x2) + "," + str(y2) + ";" +
231 str(x1) + "," + str(y2), self.log) 216 str(x1) + "," + str(y2), self.log)
232 fog_string += poly.toxml(action) 217 fog_string += poly.toxml(action)