new version of the environment modeler. redid a lot of stuff to incorporate rotation, only was doing translation before, then suddly realized, 'oh crap' things can be rotated too..so this code deals with that, also hooks into the client94 code's ClientEngine object in some key spots.

brs2001 [2002-06-19 05:43:18]
new version of the environment modeler. redid a lot of stuff to incorporate rotation, only was doing translation before, then suddly realized, 'oh crap' things can be rotated too..so this code deals with that, also hooks into the client94 code's ClientEngine object in some key spots.
Filename
client/em/EMAvatar.cpp
client/em/EMAvatar.h
client/em/EMDoor.cpp
client/em/EMDoor.h
client/em/EMElement.cpp
client/em/EMEntity.cpp
client/em/EMEntity.h
client/em/EMModel.cpp
client/em/EMModel.h
client/em/EMObject.cpp
client/em/EMObject.h
client/em/EnvironmentModeler.cpp
client/em/EnvironmentModeler.h
client/em/EnvironmentModeler.sln
client/em/EnvironmentModeler.vcproj
diff --git a/client/em/EMAvatar.cpp b/client/em/EMAvatar.cpp
index 2c30ca6..b982ca6 100644
--- a/client/em/EMAvatar.cpp
+++ b/client/em/EMAvatar.cpp
@@ -1,11 +1,12 @@
 #include "EnvironmentModeler.h"

 EMAvatar::EMAvatar( ChimeID setID, ChimeID setRoom, Coords setDim,
-				   Coords setCoords, ChimeID setModel ):
+			Coords setCoords, Coords setRotate, ChimeID setModel ):
 					EMElement( setID, setDim, setModel ), EMRoomList()
 {
 	next = NULL;
 	roomCoords = setCoords;
+	rotation = setRotate;
 	room = EnvironmentModeler::getRoom( setRoom );
 }

@@ -14,6 +15,11 @@ void EMAvatar::setRoomCoords( Coords theCoords )
 	roomCoords = theCoords;
 }

+void EMAvatar::setRotation( Coords theCoords )
+{
+	rotation = theCoords;
+}
+
 void EMAvatar::setRoom( EMRoom *theRoom )
 {
 	room = theRoom;
@@ -24,6 +30,11 @@ Coords EMAvatar::getRoomCoords( void )
 	return roomCoords;
 }

+Coords EMAvatar::getRotation( void )
+{
+	return rotation;
+}
+
 EMRoom *EMAvatar::getRoom( void )
 {
 	return room;
diff --git a/client/em/EMAvatar.h b/client/em/EMAvatar.h
index d8ef5ad..d148864 100644
--- a/client/em/EMAvatar.h
+++ b/client/em/EMAvatar.h
@@ -6,17 +6,20 @@ class EMAvatar: public EMElement, public EMRoomList
 {
 	public:
 		EMAvatar( ChimeID setID, ChimeID setRoom, Coords setDim,
-			Coords setCoords, ChimeID setModel );
+			Coords setCoords, Coords setRotate, ChimeID setModel );

 		void setRoomCoords( Coords theCoords );
+		void setRotation( Coords theCoords );
 		void setRoom( EMRoom *theRoom );

 		Coords getRoomCoords( void );
+		Coords getRotation( void );
 		EMRoom *getRoom( void );

 	protected:
 		EMRoom *room;
 		Coords roomCoords;
+		Coords rotation;
 };

 #endif
\ No newline at end of file
diff --git a/client/em/EMDoor.cpp b/client/em/EMDoor.cpp
index 6f0188c..c8b332d 100644
--- a/client/em/EMDoor.cpp
+++ b/client/em/EMDoor.cpp
@@ -1,7 +1,8 @@
 #include "EnvironmentModeler.h"

 EMDoor::EMDoor( ChimeID setID, ChimeID roomOne, ChimeID roomTwo,
-			   Coords setDim, Coords coordsOne, Coords coordsTwo, ChimeID setModel ):
+			   Coords setDim, Coords coordsOne, Coords coordsTwo,
+			   Coords rotOne, Coords rotTwo, ChimeID setModel ):
 				EMElement( setID, setDim, setModel )
 {
 	linkCoords[0] = coordsOne;
@@ -9,6 +10,9 @@ EMDoor::EMDoor( ChimeID setID, ChimeID roomOne, ChimeID roomTwo,

 	linkRooms[0] = EnvironmentModeler::getRoom( roomOne );
 	linkRooms[1] = EnvironmentModeler::getRoom( roomTwo );
+
+	linkRotation[0] = rotOne;
+	linkRotation[1] = rotTwo;
 }

 void EMDoor::setLinkRooms( EMRoom *roomOne, EMRoom *roomTwo )
@@ -23,6 +27,12 @@ void EMDoor::setLinkCoords( Coords coordsOne, Coords coordsTwo )
 	linkCoords[1] = coordsTwo;
 }

+void EMDoor::setLinkRotation( Coords rotOne, Coords rotTwo )
+{
+	linkRotation[0] = rotOne;
+	linkRotation[1] = rotTwo;
+}
+
 EMRoom **EMDoor::getLinkRooms( void )
 {
 	return linkRooms;
@@ -31,4 +41,9 @@ EMRoom **EMDoor::getLinkRooms( void )
 Coords *EMDoor::getLinkCoords( void )
 {
 	return linkCoords;
+}
+
+Coords *EMDoor::getLinkRotation( void )
+{
+	return linkRotation;
 }
\ No newline at end of file
diff --git a/client/em/EMDoor.h b/client/em/EMDoor.h
index c72500e..6863339 100644
--- a/client/em/EMDoor.h
+++ b/client/em/EMDoor.h
@@ -6,17 +6,21 @@ class EMDoor: public EMElement
 {
 	public:
 		EMDoor( ChimeID setID, ChimeID roomOne, ChimeID roomTwo,
-			Coords setDim, Coords coordsOne, Coords coordsTwo, ChimeID setModel );
+			Coords setDim, Coords coordsOne, Coords coordsTwo,
+			Coords rotOne, Coords rotTwo, ChimeID setModel );

 		void setLinkRooms( EMRoom *roomOne, EMRoom *roomTwo );
 		void setLinkCoords( Coords coordsOne, Coords coordsTwo );
+		void setLinkRotation( Coords rotOne, Coords rotTwo );

 		EMRoom **getLinkRooms( void );
 		Coords *getLinkCoords( void );
+		Coords *getLinkRotation( void );

 	protected:
 		EMRoom *linkRooms[2];
 		Coords linkCoords[2];
+		Coords linkRotation[2];
 };

 #endif
diff --git a/client/em/EMElement.cpp b/client/em/EMElement.cpp
index 2d90f88..7caef6a 100644
--- a/client/em/EMElement.cpp
+++ b/client/em/EMElement.cpp
@@ -13,8 +13,7 @@ EMElement::EMElement( void )

 EMElement::~EMElement( void )
 {
-	if( model != NULL )
-		delete model;
+
 }

 void EMElement::setModel( ChimeID setModelID )
diff --git a/client/em/EMEntity.cpp b/client/em/EMEntity.cpp
index 13ba0fd..031fa7d 100644
--- a/client/em/EMEntity.cpp
+++ b/client/em/EMEntity.cpp
@@ -7,6 +7,11 @@ EMEntity::EMEntity( ChimeID setID )
 	hashNext = NULL;
 }

+EMEntity::~EMEntity( void )
+{
+
+}
+
 EMEntity::EMEntity( void )
 {
 	//no
diff --git a/client/em/EMEntity.h b/client/em/EMEntity.h
index 5ca2557..3ef7459 100644
--- a/client/em/EMEntity.h
+++ b/client/em/EMEntity.h
@@ -5,6 +5,7 @@ class EMEntity
 {
 	public:
 		EMEntity( ChimeID setID );
+		virtual ~EMEntity( void );

 		void setID( ChimeID setID );
 		ChimeID getID( void );
diff --git a/client/em/EMModel.cpp b/client/em/EMModel.cpp
index a08e28f..ce4342b 100644
--- a/client/em/EMModel.cpp
+++ b/client/em/EMModel.cpp
@@ -1,21 +1,29 @@
+#include <stdio.h>
+#include <stdlib.h>
 #include "EnvironmentModeler.h"

+//crystal space stuff
+#include "client94/core.h"
+
+
 EMModel::EMModel( char *file, ChimeID setID ): EMEntity( setID )
 {
-
+	if( !updateModel( file ) )
+		EnvironmentModeler::requestModel( setID );
 }

 EMModel::~EMModel( void )
 {
-
+	//dont do anything
 }

-int EMModel::updateModel( char *file )
+bool EMModel::updateModel( char *file )
 {
-	return 0;
-}
+	char buff[100];

-void *EMModel::getModelData( int *length )
-{
-	return modelData;
+	//make the entity string
+	sprintf(buff, "%d", entityID);
+
+	//load the model and register it under the given ID
+	return gApp->LoadModel( file, buff );
 }
\ No newline at end of file
diff --git a/client/em/EMModel.h b/client/em/EMModel.h
index b77276e..14e5307 100644
--- a/client/em/EMModel.h
+++ b/client/em/EMModel.h
@@ -8,15 +8,9 @@ class EMModel: public EMEntity
 {
 	public:
 		EMModel( char *file, ChimeID setID );
-		~EMModel( void );
+		virtual ~EMModel( void );

-		int updateModel( char *file );
-
-		void *getModelData( int *length );
-
-	protected:
-		void *modelData;
-		unsigned int modelDataLength;
+		bool updateModel( char *file );
 };

 #endif
\ No newline at end of file
diff --git a/client/em/EMObject.cpp b/client/em/EMObject.cpp
index 9ef26d9..f424340 100644
--- a/client/em/EMObject.cpp
+++ b/client/em/EMObject.cpp
@@ -1,11 +1,12 @@
 #include "EnvironmentModeler.h"

 EMObject::EMObject( ChimeID setID, ChimeID setRoom, Coords setDim,
-				   Coords setCoords, ChimeID setModel ):
+				   Coords setCoords, Coords setRotate, ChimeID setModel ):
 					EMElement( setID, setDim, setModel ), EMRoomList()
 {
 	room = EnvironmentModeler::getRoom( setRoom );
 	roomCoords = setCoords;
+	rotation = setRotate;
 }

 void EMObject::setRoomCoords( Coords theCoords )
@@ -13,6 +14,11 @@ void EMObject::setRoomCoords( Coords theCoords )
 	roomCoords = theCoords;
 }

+void EMObject::setRotation( Coords theCoords )
+{
+	rotation = theCoords;
+}
+
 void EMObject::setRoom( EMRoom *theRoom )
 {
 	room = theRoom;
@@ -23,6 +29,11 @@ Coords EMObject::getRoomCoords( void )
 	return roomCoords;
 }

+Coords EMObject::getRotation( void )
+{
+	return rotation;
+}
+
 EMRoom *EMObject::getRoom( void )
 {
 	return room;
diff --git a/client/em/EMObject.h b/client/em/EMObject.h
index 5bcbd59..1e9e399 100644
--- a/client/em/EMObject.h
+++ b/client/em/EMObject.h
@@ -6,17 +6,20 @@ class EMObject: public EMElement, public EMRoomList
 {
 	public:
 		EMObject( ChimeID setID, ChimeID setRoom, Coords setDim,
-			Coords setCoords, ChimeID setModel );
+			Coords setCoords, Coords setRotate, ChimeID setModel );

 		void setRoomCoords( Coords theCoords );
+		void setRotation( Coords theCoords );
 		void setRoom( EMRoom *theRoom );

 		Coords getRoomCoords( void );
+		Coords getRotation( void );
 		EMRoom *getRoom( void );

 	protected:
 		EMRoom *room;
 		Coords roomCoords;
+		Coords rotation;
 };

 #endif
\ No newline at end of file
diff --git a/client/em/EnvironmentModeler.cpp b/client/em/EnvironmentModeler.cpp
index 4982e65..4c53815 100644
--- a/client/em/EnvironmentModeler.cpp
+++ b/client/em/EnvironmentModeler.cpp
@@ -1,5 +1,15 @@
 #include "EnvironmentModeler.h"
-
+#include "client94/core.h"
+
+//static variables
+EMModel *EnvironmentModeler::modelHash[EM_MODEL_HASH_SIZE];
+EMRoom *EnvironmentModeler::roomHash[EM_ROOM_HASH_SIZE];
+EMDoor *EnvironmentModeler::doorHash[EM_DOOR_HASH_SIZE];
+EMObject *EnvironmentModeler::objectHash[EM_OBJECT_HASH_SIZE];
+EMAvatar *EnvironmentModeler::avatarHash[EM_AVATAR_HASH_SIZE];
+Coords EnvironmentModeler::cameraLocation;
+Coords EnvironmentModeler::cameraFocus;
+EMRoom *EnvironmentModeler::cameraRoom;

 void EnvironmentModeler::initialize( void )
 {
@@ -9,13 +19,6 @@ void EnvironmentModeler::initialize( void )
 	EMEntity::initHash( (EMEntity **) &doorHash, EM_DOOR_HASH_SIZE );
 	EMEntity::initHash( (EMEntity **) &objectHash, EM_OBJECT_HASH_SIZE );
 	EMEntity::initHash( (EMEntity **) &avatarHash, EM_AVATAR_HASH_SIZE );
-
-	//init view
-	cameraLocation = Coords( 0, 0, 0 );
-	cameraFocus = Coords( 0, 0, 0 );
-	cameraRoom = NULL;
-
-	//init the engine
 }

 void EnvironmentModeler::shutdown( void )
@@ -26,8 +29,6 @@ void EnvironmentModeler::shutdown( void )
 	EMEntity::clearHash( (EMEntity **) &doorHash, EM_DOOR_HASH_SIZE );
 	EMEntity::clearHash( (EMEntity **) &objectHash, EM_OBJECT_HASH_SIZE );
 	EMEntity::clearHash( (EMEntity **) &avatarHash, EM_AVATAR_HASH_SIZE );
-
-	//shutdown the engine
 }

 void EnvironmentModeler::placeRoom( ChimeID setID, Coords setDim, ChimeID setModel )
@@ -39,17 +40,21 @@ void EnvironmentModeler::placeRoom( ChimeID setID, Coords setDim, ChimeID setMod

 	//just add it into the hash
 	EMEntity::addHashEntity( (EMEntity **) &roomHash, EM_ROOM_HASH_SIZE, tempRoom );
+
+	//inform the engine
+	ClientEngine::addRoom( tempRoom );
 }

 void EnvironmentModeler::placeDoor( ChimeID setID, ChimeID roomOne, ChimeID roomTwo,
-	Coords setDim, Coords coordsOne, Coords coordsTwo, ChimeID setModel )
+	Coords setDim, Coords coordsOne, Coords coordsTwo,
+	Coords rotOne, Coords rotTwo, ChimeID setModel )
 {
 	EMRoom *theRoom;
 	EMDoor *tempDoor;

 	//make the door
 	tempDoor = new EMDoor( setID, roomOne, roomTwo, setDim,
-							coordsOne, coordsTwo, setModel );
+							coordsOne, coordsTwo, rotOne, rotTwo, setModel );

 	//add it to the two rooms
 	theRoom = (EMRoom *) EMEntity::getHashEntity( (EMEntity **) &roomHash, EM_ROOM_HASH_SIZE, roomOne );
@@ -59,41 +64,50 @@ void EnvironmentModeler::placeDoor( ChimeID setID, ChimeID roomOne, ChimeID room
 	theRoom->addDoor( tempDoor );

 	//add it to the hash
-	EMEntity::addHashEntity( (EMEntity **) &doorHash, EM_DOOR_HASH_SIZE, tempDoor );
+	EMEntity::addHashEntity( (EMEntity **) &doorHash, EM_DOOR_HASH_SIZE, tempDoor );
+
+	//inform the engine
+	ClientEngine::addDoor( tempDoor );
 }

 void EnvironmentModeler::placeObject( ChimeID setID, ChimeID setRoom, Coords setDim,
-	Coords setCoords, ChimeID setModel )
+	Coords setCoords, Coords setRotate, ChimeID setModel )
 {
 	EMRoom *theRoom;
 	EMObject *tempObject;

 	//make the new object
-	tempObject = new EMObject( setID, setRoom, setDim, setCoords, setModel );
+	tempObject = new EMObject( setID, setRoom, setDim, setCoords, setRotate, setModel );

 	//put it in the room
 	theRoom = (EMRoom *) EMEntity::getHashEntity( (EMEntity **) &roomHash, EM_ROOM_HASH_SIZE, setRoom );
 	theRoom->addObject( tempObject );

 	//add it to the hash
-	EMEntity::addHashEntity( (EMEntity **) &objectHash, EM_OBJECT_HASH_SIZE, tempObject );
+	EMEntity::addHashEntity( (EMEntity **) &objectHash, EM_OBJECT_HASH_SIZE, tempObject );
+
+	//inform the engine
+	ClientEngine::addObject( tempObject );
 }

 void EnvironmentModeler::placeAvatar( ChimeID setID, ChimeID setRoom, Coords setDim,
-	Coords setCoords, ChimeID setModel )
+	Coords setCoords, Coords setRotate, ChimeID setModel )
 {
 	EMRoom *theRoom;
 	EMAvatar *tempAvatar;

 	//make the new avatar
-	tempAvatar = new EMAvatar( setID, setRoom, setDim, setCoords, setModel );
+	tempAvatar = new EMAvatar( setID, setRoom, setDim, setCoords, setRotate, setModel );

 	//put it in the room
 	theRoom = (EMRoom *) EMEntity::getHashEntity( (EMEntity **) &roomHash, EM_ROOM_HASH_SIZE, setRoom );
 	theRoom->addAvatar( tempAvatar );

 	//add to the hash
-	EMEntity::addHashEntity( (EMEntity **) &avatarHash, EM_AVATAR_HASH_SIZE, tempAvatar );
+	EMEntity::addHashEntity( (EMEntity **) &avatarHash, EM_AVATAR_HASH_SIZE, tempAvatar );
+
+	//inform the engine
+	ClientEngine::addAvatar( tempAvatar );
 }

 void EnvironmentModeler::updateRoom( ChimeID roomID, Coords setDim, ChimeID setModel )
@@ -109,7 +123,8 @@ void EnvironmentModeler::updateRoom( ChimeID roomID, Coords setDim, ChimeID setM
 }

 void EnvironmentModeler::updateDoor( ChimeID doorID, ChimeID roomOne, ChimeID roomTwo,
-	Coords setDim, Coords coordsOne, Coords coordsTwo, ChimeID setModel )
+	Coords setDim, Coords coordsOne, Coords coordsTwo,
+	Coords rotOne, Coords rotTwo, ChimeID setModel )
 {
 	EMDoor *theDoor;
 	EMRoom **curRooms;
@@ -127,6 +142,7 @@ void EnvironmentModeler::updateDoor( ChimeID doorID, ChimeID roomOne, ChimeID ro
 	theDoor->setDimensions( setDim );
 	theDoor->setModel( setModel );
 	theDoor->setLinkCoords( coordsOne, coordsTwo );
+	theDoor->setLinkRotation( rotOne, rotTwo );

 	//add it to the two new rooms
 	curRooms[0] = (EMRoom *) EMEntity::getHashEntity( (EMEntity **) &roomHash, EM_ROOM_HASH_SIZE, roomOne );
@@ -140,7 +156,7 @@ void EnvironmentModeler::updateDoor( ChimeID doorID, ChimeID roomOne, ChimeID ro
 }

 void EnvironmentModeler::updateObject( ChimeID objectID, ChimeID setRoom, Coords setDim,
-	Coords setCoords, ChimeID setModel )
+	Coords setCoords, Coords setRotate, ChimeID setModel )
 {
 	EMObject *theObject;
 	EMRoom *theRoom;
@@ -155,11 +171,12 @@ void EnvironmentModeler::updateObject( ChimeID objectID, ChimeID setRoom, Coords
 	theObject->setRoom( theRoom );
 	theObject->setDimensions( setDim );
 	theObject->setRoomCoords( setCoords );
+	theObject->setRotation( setRotate );
 	theObject->setModel( setModel );
 }

 void EnvironmentModeler::updateAvatar( ChimeID avatarID, ChimeID setRoom, Coords setDim,
-	Coords setCoords, ChimeID setModel )
+	Coords setCoords, Coords setRotate, ChimeID setModel )
 {
 	EMAvatar *theAvatar;
 	EMRoom *theRoom;
@@ -174,6 +191,7 @@ void EnvironmentModeler::updateAvatar( ChimeID avatarID, ChimeID setRoom, Coords
 	theAvatar->setRoom( theRoom );
 	theAvatar->setDimensions( setDim );
 	theAvatar->setRoomCoords( setCoords );
+	theAvatar->setRotation( setRotate );
 	theAvatar->setModel( setModel );
 }

@@ -265,11 +283,22 @@ EMObject *EnvironmentModeler::getObject( ChimeID objectID )

 EMModel *EnvironmentModeler::getModel( ChimeID modelID )
 {
+	EMModel *temp;
+
 	//pull it from the hash
-	return (EMModel *) EMEntity::getHashEntity( (EMEntity **) &modelHash, EM_MODEL_HASH_SIZE, modelID );
+	temp = (EMModel *) EMEntity::getHashEntity( (EMEntity **) &modelHash, EM_MODEL_HASH_SIZE, modelID );
+
+	//if it's not there, create it
+	if( temp == NULL )
+	{
+		temp = new EMModel( NULL, modelID );
+		EMEntity::addHashEntity( (EMEntity **) &modelHash, EM_MODEL_HASH_SIZE, temp );
+	}
+
+	return temp;
 }

-void EnvironmentModeler::moveAvatar( ChimeID avatarID, Coords setCoords )
+void EnvironmentModeler::moveAvatar( ChimeID avatarID, Coords setCoords, Coords setRotation )
 {
 	EMAvatar *theAvatar;

@@ -291,11 +320,18 @@ void EnvironmentModeler::updateModel( ChimeID modelID, char *file )

 	//update it, inform the engine of sucessful update
 	if( !theModel->updateModel( file ) )
+		EnvironmentModeler::requestModel( modelID );
+	else
 	{
-		//inform the engine
+		//tell the engine that it's now been loaded
 	}
 }

+void EnvironmentModeler::requestModel( ChimeID modelID )
+{
+
+}
+
 void EnvironmentModeler::flush( void )
 {
 	//clear all hashes
@@ -311,12 +347,34 @@ void EnvironmentModeler::flush( void )
 	cameraRoom = NULL;

 	//flush the engine
+	ClientEngine::flush();
+}
+
+void EnvironmentModeler::setCamera( ChimeID room, Coords location )
+{
+	EMRoom *tempRoom;
+
+	tempRoom = (EMRoom *) EMEntity::getHashEntity( (EMEntity **) &roomHash, EM_ROOM_HASH_SIZE, room );
+	if( tempRoom != NULL )
+		ClientEngine::moveToRoom( tempRoom, location.x, location.y, location.z );
+}
+
+void EnvironmentModeler::offsetCamera( Coords offset )
+{
+	ClientEngine::offsetCamera( offset.x, offset.y, offset.z );
+}
+
+void EnvironmentModeler::setCameraRotate( Coords amount )
+{
+	ClientEngine::setCameraRotate( amount.x, amount.y, amount.z );
+}
+
+void EnvironmentModeler::offsetCameraRotate( Coords offset )
+{
+	ClientEngine::offsetCameraRotate( offset.x, offset.y, offset.z );
 }

-void EnvironmentModeler::setCamera( ChimeID roomID, Coords location, Coords focus )
+void EnvironmentModeler::setCameraFocus( Coords focus )
 {
-	//set camera paramters
-	cameraLocation = location;
-	cameraFocus = focus;
-	cameraRoom = getRoom( roomID );
+	ClientEngine::setCameraFocus( focus.x, focus.y, focus.z );
 }
\ No newline at end of file
diff --git a/client/em/EnvironmentModeler.h b/client/em/EnvironmentModeler.h
index 98dc644..2748c72 100644
--- a/client/em/EnvironmentModeler.h
+++ b/client/em/EnvironmentModeler.h
@@ -20,6 +20,8 @@ class EMRoom;
 #define EM_DOOR_HASH_SIZE 64
 #define EM_OBJECT_HASH_SIZE 64

+#define EM_MODEL_DATA_DIR "./data/models/"
+

 //environment modeler definition
 class EnvironmentModeler
@@ -30,19 +32,21 @@ class EnvironmentModeler

 		static void placeRoom( ChimeID setID, Coords setDim, ChimeID setModel );
 		static void placeDoor( ChimeID setID, ChimeID roomOne, ChimeID roomTwo,
-			Coords setDim, Coords coordsOne, Coords coordsTwo, ChimeID setModel );
+			Coords setDim, Coords coordsOne, Coords coordsTwo,
+			Coords rotOne, Coords rotTwo, ChimeID setModel );
 		static void placeObject( ChimeID setID, ChimeID setRoom, Coords setDim,
-			Coords setCoords, ChimeID setModel );
+			Coords setCoords, Coords setRotate, ChimeID setModel );
 		static void placeAvatar( ChimeID setID, ChimeID setRoom, Coords setDim,
-			Coords setCoords, ChimeID setModel );
+			Coords setCoords, Coords setRotate, ChimeID setModel );

 		static void updateRoom( ChimeID roomID, Coords setDim, ChimeID setModel );
 		static void updateDoor( ChimeID doorID, ChimeID roomOne, ChimeID roomTwo,
-			Coords setDim, Coords coordsOne, Coords coordsTwo, ChimeID setModel );
+			Coords setDim, Coords coordsOne, Coords coordsTwo,
+			Coords rotOne, Coords rotTwo, ChimeID setModel );
 		static void updateObject( ChimeID objectID, ChimeID setRoom, Coords setDim,
-			Coords setCoords, ChimeID setModel );
+			Coords setCoords, Coords setRotate, ChimeID setModel );
 		static void updateAvatar( ChimeID avatarID, ChimeID setRoom, Coords setDim,
-			Coords setCoords, ChimeID setModel );
+			Coords setCoords, Coords setRotate, ChimeID setModel );

 		static void removeRoom( ChimeID elementID );
 		static void removeDoor( ChimeID elementID );
@@ -55,12 +59,18 @@ class EnvironmentModeler
 		static EMObject *getObject( ChimeID objectID );
 		static EMModel *getModel( ChimeID modelID );

-		static void moveAvatar( ChimeID avatarID, Coords setCoords );
+		static void moveAvatar( ChimeID avatarID, Coords setCoords, Coords setRotation );

 		static void updateModel( ChimeID modelID, char *file );
+		static void requestModel( ChimeID modelID );

 		static void flush( void );
-		static void setCamera( ChimeID roomID, Coords location, Coords focus );
+
+		static void setCamera( ChimeID room, Coords location );
+		static void offsetCamera( Coords offset );
+		static void setCameraRotate( Coords amount );
+		static void offsetCameraRotate( Coords offset );
+		static void setCameraFocus( Coords focus );

 	private:

diff --git a/client/em/EnvironmentModeler.sln b/client/em/EnvironmentModeler.sln
new file mode 100644
index 0000000..047330d
--- /dev/null
+++ b/client/em/EnvironmentModeler.sln
@@ -0,0 +1,21 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EnvironmentModeler", "EnvironmentModeler.vcproj", "{A366CFDD-B1AE-49D4-98F7-9E49ABC66451}"
+EndProject
+Global
+	GlobalSection(SolutionConfiguration) = preSolution
+		ConfigName.0 = Debug
+		ConfigName.1 = Release
+	EndGlobalSection
+	GlobalSection(ProjectDependencies) = postSolution
+	EndGlobalSection
+	GlobalSection(ProjectConfiguration) = postSolution
+		{A366CFDD-B1AE-49D4-98F7-9E49ABC66451}.Debug.ActiveCfg = Debug|Win32
+		{A366CFDD-B1AE-49D4-98F7-9E49ABC66451}.Debug.Build.0 = Debug|Win32
+		{A366CFDD-B1AE-49D4-98F7-9E49ABC66451}.Release.ActiveCfg = Release|Win32
+		{A366CFDD-B1AE-49D4-98F7-9E49ABC66451}.Release.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+	EndGlobalSection
+	GlobalSection(ExtensibilityAddIns) = postSolution
+	EndGlobalSection
+EndGlobal
diff --git a/client/em/EnvironmentModeler.vcproj b/client/em/EnvironmentModeler.vcproj
index 3660904..bb1f1eb 100644
--- a/client/em/EnvironmentModeler.vcproj
+++ b/client/em/EnvironmentModeler.vcproj
@@ -12,14 +12,14 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
+			OutputDirectory=".\"
 			IntermediateDirectory="Debug"
 			ConfigurationType="4"
 			CharacterSet="2">
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="../common"
+				AdditionalIncludeDirectories="..\;..\client94\crystalspace\include;..\common"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
 				MinimalRebuild="TRUE"
 				BasicRuntimeChecks="3"