Ejemplo n.º 1
0
 def get_raw_tile(self):
     """
     Get this tile in raw binary data format.
     @return Raw tile.
     """
     return "%s%s%s%c%c%c%c" % (
         int_to_dword(self.tile_id), short_to_word(self.object_id), 
         short_to_word(self.event_id), chr(not collision), chr(height), chr(type),
         chr(effect));
Ejemplo n.º 2
0
 def create_from_ice_object(self, ice_map):
     """
     Helper function for converting a VTankObject::Map to a natively recognized map.
     @param ice_map VTankObject::Map object.
     """
     out = StringIO();
     out.write(chr(ice_map.version));
     out.write(ice_map.title);
     out.write('\n');
     out.write(int_to_dword(ice_map.width));
     out.write(int_to_dword(ice_map.height));
     out.write("".join([ chr(x) for x in ice_map.supportedGameModes ])); 
     out.write('\n');
     
     for tile in ice_map.tileData:
         out.write(int_to_dword(tile.id));
         out.write(short_to_word(tile.objectId));
         out.write(short_to_word(tile.eventId));
         out.write(chr(tile.passable));
         out.write(chr(tile.height));
         out.write(chr(tile.type));
         out.write(chr(tile.effect));
         
     self.read_map(out.getvalue());