Permalink
Browse files

fixed fife rotation bullshit (hopefully)

  • Loading branch information...
1 parent 9ce07bb commit b6a6c621923fc496746b141b973416a55fc9bfab @karottenreibe karottenreibe committed Jan 31, 2012
Showing with 18 additions and 1 deletion.
  1. BIN content/maps/quattro.sqlite
  2. +18 −1 editor/plugins/UHMapSaver.py
View
Binary file not shown.
@@ -42,9 +42,26 @@ def __init__(self, filepath, engine, map, importList):
self._map = map
self._mapDatabase = None
+ def _fixRotation(self, rotation):
+ """
+ Fixes FIFEs botched handling of rotations.
+ Rotations are a) 0, 90, 180 or 270 and b) sometimes
+ off by one.
+ """
+ rotation = rotation % 360
+ if (0 <= rotation and rotation < 45) or (315 <= rotation and rotation < 360):
+ rotation = 45
+ elif 45 <= rotation and rotation < 135:
+ rotation = 135
+ elif 135 <= rotation and rotation < 225:
+ rotation = 225
+ elif 225 <= rotation and rotation < 315:
+ rotation = 315
+ return rotation
+
def _extractPositionRotationFromInstance(self, instance):
"""Extracts the position and the rotation from an instance and returns it as a tuple"""
- rotation = instance.getRotation()
+ rotation = self._fixRotation(instance.getRotation())
position = instance.getLocationRef().getExactLayerCoordinates()
print "get", rotation
return (position, rotation)

0 comments on commit b6a6c62

Please sign in to comment.