Mercurial > LightClone
changeset 62:6d4437a24aeb
Added camera position to level definition
author | koryspansel |
---|---|
date | Mon, 03 Oct 2011 15:14:41 -0700 |
parents | 1fe27776627e |
children | 44dcff5abf12 |
files | Assets/Maps/map00.def Assets/Maps/map01.def Assets/Maps/map02.def Assets/Maps/map03.def Assets/Maps/map04.def Assets/Maps/map05.def Assets/Maps/map06.def Data/Maps/map00.map Data/Maps/map01.map Data/Maps/map02.map Data/Maps/map03.map Data/Maps/map04.map Data/Maps/map05.map Data/Maps/map06.map LightClone/Source/Loader.cpp LightClone/Source/Loader.h LightClone/Source/World.cpp LightTools/build.py |
diffstat | 18 files changed, 104 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/Assets/Maps/map00.def Mon Oct 03 15:05:09 2011 -0700 +++ b/Assets/Maps/map00.def Mon Oct 03 15:14:41 2011 -0700 @@ -5,6 +5,9 @@ 7,7 3,1 0 +10 +0.46 +0.57 (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0) (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0)
--- a/Assets/Maps/map01.def Mon Oct 03 15:05:09 2011 -0700 +++ b/Assets/Maps/map01.def Mon Oct 03 15:14:41 2011 -0700 @@ -5,6 +5,9 @@ 7,7 3,1 0 +10 +0.46 +0.57 (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0) (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0)
--- a/Assets/Maps/map02.def Mon Oct 03 15:05:09 2011 -0700 +++ b/Assets/Maps/map02.def Mon Oct 03 15:14:41 2011 -0700 @@ -5,6 +5,9 @@ 7,7 3,1 0 +10 +0.46 +0.57 (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0) (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0)
--- a/Assets/Maps/map03.def Mon Oct 03 15:05:09 2011 -0700 +++ b/Assets/Maps/map03.def Mon Oct 03 15:14:41 2011 -0700 @@ -5,6 +5,9 @@ 7,7 3,1 0 +10 +0.46 +0.57 (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0) (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0)
--- a/Assets/Maps/map04.def Mon Oct 03 15:05:09 2011 -0700 +++ b/Assets/Maps/map04.def Mon Oct 03 15:14:41 2011 -0700 @@ -5,6 +5,9 @@ 7,7 0,0 0 +10 +0.46 +0.57 (1,1)(1,1)(1,1)(1,1)(1,1)(1,1)(1,1) (1,1)(1,0)(1,0)(1,0)(1,0)(1,0)(1,1)
--- a/Assets/Maps/map05.def Mon Oct 03 15:05:09 2011 -0700 +++ b/Assets/Maps/map05.def Mon Oct 03 15:14:41 2011 -0700 @@ -5,6 +5,9 @@ 7,7 3,1 1 +10 +0.46 +0.57 (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0) (1,0)(1,0)(1,0)(1,0)(2,0)(1,0)(1,0)
--- a/Assets/Maps/map06.def Mon Oct 03 15:05:09 2011 -0700 +++ b/Assets/Maps/map06.def Mon Oct 03 15:14:41 2011 -0700 @@ -5,6 +5,9 @@ 7,7 3,1 0 +10 +0.46 +0.57 (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0) (1,0)(1,0)(4,1)(1,0)(2,0)(1,0)(1,0)
--- a/LightClone/Source/Loader.cpp Mon Oct 03 15:05:09 2011 -0700 +++ b/LightClone/Source/Loader.cpp Mon Oct 03 15:14:41 2011 -0700 @@ -17,6 +17,9 @@ kPosition.X = 0; kPosition.Y = 0; kDirection = Direction_North; + fCameraDistance = 10.0f; + fCameraYaw = 0.46f; + fCameraPitch = 0.57f; } /* @@ -71,6 +74,15 @@ if(kBuffer.Read(&kDirection) != Error_Success) return Error_Fail; + if(kBuffer.Read(&fCameraDistance) != Error_Success) + return Error_Fail; + + if(kBuffer.Read(&fCameraYaw) != Error_Success) + return Error_Fail; + + if(kBuffer.Read(&fCameraPitch) != Error_Success) + return Error_Fail; + if(kSize.X == 0 || kSize.Y == 0) return Error_Fail; @@ -133,3 +145,27 @@ { return kDirection; } + +/* + * GetCameraDistance + */ +float Loader::GetCameraDistance() const +{ + return fCameraDistance; +} + +/* + * GetCameraYaw + */ +float Loader::GetCameraYaw() const +{ + return fCameraYaw; +} + +/* + * GetCameraPitch + */ +float Loader::GetCameraPitch() const +{ + return fCameraPitch; +}
--- a/LightClone/Source/Loader.h Mon Oct 03 15:05:09 2011 -0700 +++ b/LightClone/Source/Loader.h Mon Oct 03 15:14:41 2011 -0700 @@ -37,6 +37,21 @@ */ Direction kDirection; + /* + * fCameraDistance + */ + float fCameraDistance; + + /* + * fCameraYaw + */ + float fCameraYaw; + + /* + * fCameraPitch + */ + float fCameraPitch; + public: /* @@ -78,6 +93,21 @@ * GetInitialDirection */ const Direction& GetInitialDirection() const; + + /* + * GetCameraDistance + */ + float GetCameraDistance() const; + + /* + * GetCameraYaw + */ + float GetCameraYaw() const; + + /* + * GetCameraPitch + */ + float GetCameraPitch() const; }; #endif //__LOADER_H__
--- a/LightClone/Source/World.cpp Mon Oct 03 15:05:09 2011 -0700 +++ b/LightClone/Source/World.cpp Mon Oct 03 15:14:41 2011 -0700 @@ -133,6 +133,8 @@ kBot.Setup(&kEnvironment); kBot.SetPosition(kLoader.GetInitialPosition()); kBot.SetDirection(kLoader.GetInitialDirection()); + + //kCameraController.SetDistance( } }
--- a/LightTools/build.py Mon Oct 03 15:05:09 2011 -0700 +++ b/LightTools/build.py Mon Oct 03 15:14:41 2011 -0700 @@ -14,10 +14,13 @@ class MapDefinition: Parse = functools.partial(string.split, sep=',') - def __init__(self, size, position, direction, grid): + def __init__(self, size, position, direction, distance, yaw, pitch, grid): self.Size = self._ParseVector(size) self.Position = self._ParseVector(position) self.Direction = self._ParseVector(direction) + self.Distance = self._ParseVectorF(distance) + self.Yaw = self._ParseVectorF(yaw) + self.Pitch = self._ParseVectorF(pitch) self.Grid = self._ParseList(grid) def Write(self, filename): @@ -25,6 +28,9 @@ handle.write(struct.pack('i' * len(self.Size), *self.Size)) # 8 handle.write(struct.pack('i' * len(self.Position), *self.Position)) # 8 handle.write(struct.pack('i' * len(self.Direction), *self.Direction)) # 4 + handle.write(struct.pack('f' * len(self.Distance), *self.Distance)) # 4 + handle.write(struct.pack('f' * len(self.Yaw), *self.Yaw)) # 4 + handle.write(struct.pack('f' * len(self.Pitch), *self.Pitch)) # 4 for tower in self.Grid: handle.write(struct.pack('i' * len(tower), *tower)) # 8 * Size.X * Size.Y @@ -32,6 +38,9 @@ def _ParseVector(self, line): return map(int, self.Parse(line)) + def _ParseVectorF(self, line): + return map(float, self.Parse(line)) + def _ParseList(self, lines): return [map(int, item.groups()) for item in _pattern.finditer(''.join(lines))] @@ -49,9 +58,12 @@ size = definition[0] position = definition[1] direction = definition[2] - grid = definition[3:] + distance = definition[3] + yaw = definition[4] + pitch = definition[5] + grid = definition[6:] - return MapDefinition(size, position, direction, grid) + return MapDefinition(size, position, direction, distance, yaw, pitch, grid) def Compile(input_map, output_map): if os.path.isfile(input_map): @@ -84,15 +96,3 @@ continue Compile(os.path.join(path_assets, filename), os.path.join(path_build, os.path.splitext(filename)[0] + '.map')) - #definition = ReadDefinition(os.path.join(path_assets, filename)) - #if not definition: - # continue - - #output = os.path.join(path_build, os.path.splitext(filename)[0] + '.map') - #folder = os.path.dirname(output) - - #if not os.path.isdir(folder): - # os.makedirs(folder) - - #print 'Building %s from %s' % (os.path.basename(output), os.path.basename(filename)) - #definition.Write(output)