|
@@ -137,25 +137,50 @@ void PlayerKam::doMausEreignis( Framework::MausEreignis& me )
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if( me.id == ME_Bewegung && kameraControll )
|
|
|
+ if( kameraControll )
|
|
|
{
|
|
|
- int yDir = lastMousePos.y - me.originalY;
|
|
|
- int xDir = lastMousePos.x - me.originalX;
|
|
|
- setRotation( { min( max( getRotation().x - yDir * 0.005f, 0.1f ), 2.5f ), getRotation().y, getRotation().z - xDir * 0.005f } );
|
|
|
- if( getRotation().z > 2 * PI )
|
|
|
- setRotation( { getRotation().x, getRotation().y, getRotation().z - 2.f * (float)PI } );
|
|
|
- if( getRotation().z < -2 * PI )
|
|
|
- setRotation( { getRotation().x, getRotation().y, getRotation().z + 2.f * (float)PI } );
|
|
|
- Vec3<float> direction = getWorldDirection( getScreenPos() + getScreenSize() / 2 );
|
|
|
- char action[ 13 ];
|
|
|
- action[ 0 ] = 2;
|
|
|
- *(float*)(action + 1) = direction.x;
|
|
|
- *(float*)(action + 5) = direction.y;
|
|
|
- *(float*)(action + 9) = direction.z;
|
|
|
- network->zFactoryClient()->sendPlayerAction( action, 13 );
|
|
|
- SetCursorPos( lastMousePos.x + window->getPosition().x, lastMousePos.y + window->getPosition().y );
|
|
|
- ShowCursor( false );
|
|
|
+ if( me.id == ME_Bewegung )
|
|
|
+ {
|
|
|
+ int yDir = lastMousePos.y - me.originalY;
|
|
|
+ int xDir = lastMousePos.x - me.originalX;
|
|
|
+ setRotation( { min( max( getRotation().x - yDir * 0.005f, 0.1f ), 2.5f ), getRotation().y, getRotation().z - xDir * 0.005f } );
|
|
|
+ if( getRotation().z > 2 * PI )
|
|
|
+ setRotation( { getRotation().x, getRotation().y, getRotation().z - 2.f * (float)PI } );
|
|
|
+ if( getRotation().z < -2 * PI )
|
|
|
+ setRotation( { getRotation().x, getRotation().y, getRotation().z + 2.f * (float)PI } );
|
|
|
+ Vec3<float> direction = getWorldDirection( getScreenPos() + getScreenSize() / 2 );
|
|
|
+ char action[ 13 ];
|
|
|
+ action[ 0 ] = 2;
|
|
|
+ *(float*)(action + 1) = direction.x;
|
|
|
+ *(float*)(action + 5) = direction.y;
|
|
|
+ *(float*)(action + 9) = direction.z;
|
|
|
+ network->zFactoryClient()->sendPlayerAction( action, 13 );
|
|
|
+ SetCursorPos( lastMousePos.x + window->getPosition().x, lastMousePos.y + window->getPosition().y );
|
|
|
+ ShowCursor( false );
|
|
|
+ }
|
|
|
+ if( me.id == ME_PLinks )
|
|
|
+ {
|
|
|
+ char action[ 2 ] = { 1, 8 };
|
|
|
+ network->zFactoryClient()->sendPlayerAction( action, 2 );
|
|
|
+
|
|
|
+ }
|
|
|
+ if( me.id == ME_RLinks )
|
|
|
+ {
|
|
|
+ char action[ 2 ] = { 0, 8 };
|
|
|
+ network->zFactoryClient()->sendPlayerAction( action, 2 );
|
|
|
+ }
|
|
|
+ if( me.id == ME_PRechts )
|
|
|
+ {
|
|
|
+ char action[ 2 ] = { 1, 9 };
|
|
|
+ network->zFactoryClient()->sendPlayerAction( action, 2 );
|
|
|
+ }
|
|
|
+ if( me.id == ME_RRechts )
|
|
|
+ {
|
|
|
+ char action[ 2 ] = { 0, 9 };
|
|
|
+ network->zFactoryClient()->sendPlayerAction( action, 2 );
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
me.verarbeitet = 1;
|
|
|
}
|