Awesome, working

actorid
Jason Hooks 13 years ago
parent 318355f1be
commit b9fabce9c4

@ -273,8 +273,8 @@ namespace MWClass
vector.y = getMovementSettings (ptr).mForwardBackward * 127;
vector.z = getMovementSettings(ptr).mUpDown * 127;
if (getStance (ptr, Run, false))
vector *= 2;
//if (getStance (ptr, Run, false))
// vector *= 2;
return vector;
}

@ -116,7 +116,6 @@ namespace MWWorld
pm_ref.upmove = dir1.y;
//std::cout << "Current angle" << yawQuat.getYaw().valueDegrees() - 90<< "\n";
//playerphysics->ps.viewangles.x = pitchQuat.getPitch().valueDegrees();
//std::cout << "Pitch: " << yawQuat.getPitch() << "Yaw:" << yawQuat.getYaw() << "Roll: " << yawQuat.getRoll() << "\n";
@ -124,11 +123,15 @@ namespace MWWorld
}
else
{
Ogre::Quaternion quat = yawNode->getOrientation();
Ogre::Vector3 dir1(iter->second.x,iter->second.z,-iter->second.y);
pm_ref.rightmove = -dir1.x;
pm_ref.forwardmove = dir1.z;
pm_ref.upmove = dir.y;
pm_ref.upmove = dir1.y;
dir = 0.025*(quat*dir1);
}

@ -93,6 +93,7 @@ static inline void PM_ClipVelocity(const Ogre::Vector3& in, const Ogre::Vector3&
{
change = normal[i]*backoff;
out[i] = in[i] - change;
}*/
float changex = normal.x * backoff;
out.x = in.x - changex;
@ -178,7 +179,7 @@ bool PM_SlideMove( bool gravity )
float into;
Ogre::Vector3 endVelocity;
Ogre::Vector3 endClipVelocity;
std::cout << "Slide move" << pm->ps.velocity << "\n";
numbumps = 4;
// primal_velocity = pm->ps->velocity
@ -415,7 +416,7 @@ int PM_StepSlideMove( bool gravity )
// vec3_t delta, delta2;
Ogre::Vector3 up, down;
float stepSize;
std::cout << "Step Slide move" << pm->ps.velocity << "\n";
// start_o = pm->ps->origin
//VectorCopy (pm->ps->origin, start_o);
@ -543,7 +544,7 @@ int PM_StepSlideMove( bool gravity )
void PM_Friction(void)
{
std::cout << "Friction\n";
Ogre::Vector3 vec;
float* vel;
float speed, newspeed, control;
@ -639,7 +640,6 @@ static void PM_Accelerate( Ogre::Vector3& wishdir, float wishspeed, float accel
{
// int i;
float addspeed, accelspeed, currentspeed;
std::cout << "Accelerate\n";
// currentspeed = pm->ps->velocity dot wishdir
//currentspeed = DotProduct (pm->ps->velocity, wishdir);
@ -712,7 +712,7 @@ static void PM_WaterMove( playerMove* const pm )
Ogre::Vector3 wishdir;
float scale;
float vel;
std::cout << "Water moving";
/*if ( PM_CheckWaterJump() )
{
PM_WaterJumpMove();
@ -838,7 +838,7 @@ static void PM_WalkMove( playerMove* const pmove )
playerMove::playercmd cmd;
float accelerate;
float vel;
std::cout << "Walking" << pm->ps.velocity << "\n";
if ( pm->ps.waterlevel > 2 && //DotProduct( pml.forward, pml.groundTrace.plane.normal ) > 0 )
pml.forward.dotProduct(pml.groundTrace.planenormal) > 0.0f)
@ -851,6 +851,7 @@ static void PM_WalkMove( playerMove* const pmove )
if ( PM_CheckJump () )
{
// jumped away
if ( pm->ps.waterlevel > 1 )
PM_WaterMove(pmove);
@ -928,12 +929,13 @@ static void PM_WalkMove( playerMove* const pmove )
PM_Friction ();
std::cout << "After friction" << pm->ps.velocity << "\n";
//bprintf("vel: (%f, %f, %f)\n", pm->ps.velocity.x, pm->ps.velocity.y, pm->ps.velocity.z);
fmove = pm->cmd.forwardmove;
smove = pm->cmd.rightmove;
cmd = pm->cmd;
scale = PM_CmdScale( &cmd );
@ -953,22 +955,23 @@ static void PM_WalkMove( playerMove* const pmove )
// project the forward and right directions onto the ground plane
PM_ClipVelocity (pml.forward, pml.groundTrace.planenormal, pml.forward, OVERCLIP );
PM_ClipVelocity (pml.right, pml.groundTrace.planenormal, pml.right, OVERCLIP );
std::cout << "Clip velocity" << pm->ps.velocity << "\n";
//std::cout << "Clip velocity" << pm->ps.velocity << "\n";
//
VectorNormalize (pml.forward);
VectorNormalize (pml.right);
//pml.forward = pml.forward.normalise();
//pml.right = pml.right.normalise();
std::cout << "forward2" << pml.forward << "\n";
std::cout << "right2" << pml.right << "\n";
//std::cout << "forward2" << pml.forward << "\n";
//std::cout << "right2" << pml.right << "\n";
// wishvel = (pml.forward * fmove) + (pml.right * smove);
//for ( i = 0 ; i < 3 ; i++ )
//wishvel[i] = pml.forward[i] * fmove + pml.right[i] * smove;
wishvel = pml.forward * fmove + pml.right * smove;
std::cout << "WishVel" << wishvel << "\n";
//bprintf("f: (%f, %f, %f), s: (%f, %f, %f)\n", fmove, smove);
@ -981,9 +984,9 @@ static void PM_WalkMove( playerMove* const pmove )
wishdir = wishvel;
wishspeed = VectorNormalize(wishdir);
std::cout << "Wishspeed: " << wishspeed << "\n";
//std::cout << "Wishspeed: " << wishspeed << "\n";
wishspeed *= scale;
std::cout << "Wishspeed scaled:" << wishspeed << "\n";
//std::cout << "Wishspeed scaled:" << wishspeed << "\n";
// clamp the speed lower if ducking
if ( pm->cmd.ducking )
@ -1010,7 +1013,7 @@ static void PM_WalkMove( playerMove* const pmove )
PM_Accelerate (wishdir, wishspeed, accelerate);
std::cout << "Velocityafter: " << pm->ps.velocity << "\n";
//std::cout << "Velocityafter: " << pm->ps.velocity << "\n";
//Com_Printf("velocity = %1.1f %1.1f %1.1f\n", pm->ps->velocity[0], pm->ps->velocity[1], pm->ps->velocity[2]);
//Com_Printf("velocity1 = %1.1f\n", VectorLength(pm->ps->velocity));
@ -1025,18 +1028,18 @@ static void PM_WalkMove( playerMove* const pmove )
//vel = VectorLength(pm->ps->velocity);
vel = pm->ps.velocity.length();
std::cout << "The length" << vel << "\n";
//std::cout << "The length" << vel << "\n";
// slide along the ground plane
PM_ClipVelocity (pm->ps.velocity, pml.groundTrace.planenormal,
pm->ps.velocity, OVERCLIP );
std::cout << "Velocity clipped" << pm->ps.velocity << "\n";
//std::cout << "Velocity clipped" << pm->ps.velocity << "\n";
// don't decrease velocity when going up or down a slope
VectorNormalize(pm->ps.velocity);
//pm->ps.velocity = pm->ps.velocity.normalise();
std::cout << "Final:" << pm->ps.velocity << "\n";
//std::cout << "Final:" << pm->ps.velocity << "\n";
//VectorScale(pm->ps->velocity, vel, pm->ps->velocity);
pm->ps.velocity = pm->ps.velocity * vel;
@ -1048,7 +1051,7 @@ static void PM_WalkMove( playerMove* const pmove )
PM_StepSlideMove( false );
//Com_Printf("velocity2 = %1.1f\n", VectorLength(pm->ps->velocity));
std::cout << "Walk2" << pm->ps.velocity << "\n";
}
@ -1056,7 +1059,7 @@ void PM_UpdateViewAngles( playerMove::playerStruct* const ps, playerMove::player
{
short temp;
int i;
std::cout << "Updating viewangles\n";
//while(1);
//if ( ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPINTERMISSION)
@ -1178,7 +1181,6 @@ static bool PM_CorrectAllSolid(traceResults* const trace)
{
int i, j, k;
Ogre::Vector3 point;
std::cout << "Correct all solid\n";
//if ( pm->debugLevel )
//Com_Printf("%i:allsolid\n", c_pmove);
@ -1236,7 +1238,7 @@ static void PM_CrashLand( void )
float vel, acc;
float t;
float a, b, c, den;
std::cout << "Crash land\n";
// decide which landing animation to use
/*if ( pm->ps->pm_flags & PMF_BACKWARDS_JUMP )
PM_ForceLegsAnim( LEGS_LANDB );
@ -1378,7 +1380,6 @@ static void PM_CrashLand( void )
static void PM_GroundTrace( void )
{
std::cout << "Ground trace" << pm->ps.velocity << "\n";
Ogre::Vector3 point;
traceResults trace;
@ -1484,13 +1485,12 @@ static void PM_GroundTrace( void )
// don't reset the z velocity for slopes
// pm->ps->velocity[2] = 0;
std::cout << "Ground trace2" << pm->ps.velocity << "\n";
//PM_AddTouchEnt( trace.entityNum );
}
static void PM_AirMove()
{
std::cout << "Air move " << pm->ps.velocity << "\n";
//int i;
Ogre::Vector3 wishvel;
float fmove, smove;
@ -1516,8 +1516,8 @@ static void PM_AirMove()
//pml.right[2] = 0;
pml.right.z = 0;
//VectorNormalize (pml.forward);
pml.forward = Ogre::Vector3(pml.forward.normalise());
pml.right = Ogre::Vector3(pml.right.normalise());
VectorNormalize(pml.forward);
VectorNormalize(pml.right);
//VectorNormalize (pml.right);
//for ( i = 0 ; i < 2 ; i++ )
@ -1554,7 +1554,6 @@ static void PM_AirMove()
#endif*/
/*bprintf("%i ", */PM_StepSlideMove ( true )/* )*/;
std::cout << "Velocity 2 " << pm->ps.velocity << "\n";
}
static void PM_NoclipMove( void )
@ -1602,9 +1601,7 @@ static void PM_NoclipMove( void )
//for (i=0 ; i<3 ; i++)
//wishvel[i] = pml.forward[i] * fmove + pml.right[i] * smove;
std::cout << "Forward" << pml.forward << "\n";
std::cout << "Right" << pml.right << "\n";
std::cout << "Up" << pml.up << "\n";
wishvel = pml.forward * fmove + pml.right * smove;
//wishvel[2] += pm->cmd.upmove;
wishvel.z += pm->cmd.upmove;
@ -1614,6 +1611,7 @@ static void PM_NoclipMove( void )
wishspeed = VectorNormalize(wishdir);
wishspeed *= scale;
PM_Accelerate( wishdir, wishspeed, pm_accelerate );
// move
@ -1747,6 +1745,7 @@ void PM_SetWaterLevel( playerMove* const pm )
void PmoveSingle (playerMove* const pmove)
{
//pm = pmove;
// Aedra doesn't support Q3-style VM traps D: //while(1);
@ -1898,7 +1897,7 @@ void PmoveSingle (playerMove* const pmove)
if ( pm->ps.move_type == PM_SPECTATOR )
{
std::cout << "SPECTATOR\n";
//PM_CheckDuck ();
PM_FlyMove ();
PM_DropTimers ();
@ -1907,20 +1906,19 @@ void PmoveSingle (playerMove* const pmove)
if ( pm->ps.move_type == PM_NOCLIP )
{
std::cout << "NOCLIP\n";
PM_NoclipMove ();
PM_DropTimers ();
return;
}
if (pm->ps.move_type == PM_FREEZE){
std::cout << "FREEZE\n";
return; // no movement at all
}
if ( pm->ps.move_type == PM_INTERMISSION || pm->ps.move_type == PM_SPINTERMISSION){
std::cout << "INTERMISSION\n";
return; // no movement at all
}
@ -2006,6 +2004,7 @@ void Ext_UpdateViewAngles(playerMove* const pm)
void Pmove (playerMove* const pmove)
{
int fmove = pmove->cmd.forwardmove;
pm = pmove;
int finalTime;

@ -90,7 +90,7 @@ struct playerMove
{
struct playerStruct
{
playerStruct() : gravity(50.0f), speed(320.0f), pmove_framecount(20), groundEntityNum(ENTITYNUM_NONE), commandTime(40), move_type(PM_NOCLIP), pm_time(0)
playerStruct() : gravity(800.0f), speed(320.0f), pmove_framecount(20), groundEntityNum(ENTITYNUM_NONE), commandTime(40), move_type(PM_NOCLIP), pm_time(0)
{
origin = Ogre::Vector3(733.164f,900.0f, 839.432f);
velocity = Ogre::Vector3(0.0f, 0.0f, 0.0f);

@ -32,9 +32,8 @@ void newtrace(traceResults* const results, const Ogre::Vector3& start, const Ogr
//Ogre::Vector3 endReplace = startReplace;
//endReplace.z -= .25;
const bool hasHit = NewPhysicsTrace<collisionWorldTrace>(&out, start, end, BBHalfExtents, Ogre::Vector3(0.0f, rotation, 0.0f), isInterior, enginePass);
if(hasHit)
std::cout << "Has hit\n";
const bool hasHit = NewPhysicsTrace<collisionWorldTrace>(&out, start, end, BBHalfExtents, Ogre::Vector3(0.0f, 0.0, rotation), isInterior, enginePass);
if (out.fraction < 0.001f)
results->startsolid = true;
else
@ -180,8 +179,7 @@ const bool NewPhysicsTrace(NewPhysTraceResults* const out, const Ogre::Vector3&
const bool hasHit = newTraceCallback.hasHit();
if(hasHit)
std::cout << "HIT\n";
return hasHit;

Loading…
Cancel
Save