From: Christian S. <blu...@us...> - 2005-03-26 11:54:36
|
Update of /cvsroot/planeshift/planeshift/src/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13613/src/client Modified Files: clientvitals.cpp pscharcontrol.cpp pscharcontrol.h Log Message: - Fixed the stamina penalty causing strafing to result in autorun - Autorun now stops if you are low on stamina - Made the regen progress a bit less jumpy - Fixed the .000000 bug in the numberpromptwindow (Thanks Kenny Graunke!) Index: clientvitals.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/clientvitals.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** clientvitals.cpp 13 Mar 2005 12:07:17 -0000 1.5 --- clientvitals.cpp 26 Mar 2005 11:54:24 -0000 1.6 *************** *** 89,93 **** // Stamina is low, stop running. // This MUST be checked by Paladin Jr ! psengine->GetCharControl()->EndManualMovement(); psengine->GetCharControl()->CancelRunTo(); pawsChatWindow* chatWindow = (pawsChatWindow*) psengine->GetPAWS()->FindWidget("ChatWindow"); --- 89,93 ---- // Stamina is low, stop running. // This MUST be checked by Paladin Jr ! psengine->GetCharControl()->EndManualMovement(true); psengine->GetCharControl()->CancelRunTo(); pawsChatWindow* chatWindow = (pawsChatWindow*) psengine->GetPAWS()->FindWidget("ChatWindow"); *************** *** 96,100 **** else if(vitals[VITAL_PYSSTAMINA].value < 0.50f) { ! psengine->GetCharControl()->SetRunningPenalty(0.06f * (30-(vitals[VITAL_PYSSTAMINA].value-0.20f)*100) ); } else if(vitals[VITAL_PYSSTAMINA].value >= 0.50f && psengine->GetCharControl()->GetRunningPenalty() != 0.0f ) --- 96,105 ---- else if(vitals[VITAL_PYSSTAMINA].value < 0.50f) { ! float percent; ! int value = vitals[VITAL_PYSSTAMINA].value * 100; ! percent = value - 20; // Get the range were we want to apply the penalty ! percent = 30 - percent; // Invert it (the lower %, the higher penalty) ! percent = percent/30; // turn into percent ! psengine->GetCharControl()->SetRunningPenalty( int(percent * 100)); } else if(vitals[VITAL_PYSSTAMINA].value >= 0.50f && psengine->GetCharControl()->GetRunningPenalty() != 0.0f ) Index: pscharcontrol.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/pscharcontrol.cpp,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** pscharcontrol.cpp 25 Mar 2005 10:25:43 -0000 1.93 --- pscharcontrol.cpp 26 Mar 2005 11:54:24 -0000 1.94 *************** *** 452,456 **** Velocity.x = -speed; else ! Velocity.x = speed; SetMoveVelocity(Velocity); --- 452,456 ---- Velocity.x = -speed; else ! Velocity.x = speed; SetMoveVelocity(Velocity); *************** *** 1558,1563 **** } ! void psCharControlManager::SetRunningPenalty(float mod) { runningSpeedMod = mod; if(isRunning) --- 1558,1573 ---- } ! void psCharControlManager::SetRunningPenalty(int percent) { + if(percent > 100) + percent = 100; + + float mod; + int max = runningSpeed - walkspeed; // We don't want to get under walk speed since that will mess stamina up + mod = (float(max)/100) * percent; + + if(runningSpeed - mod < walkspeed + 0.5f) + mod -= 0.1f; // to be safe + runningSpeedMod = mod; if(isRunning) *************** *** 1566,1573 **** csVector3 vel; movePropClass->GetVelocity(vel); ! if(direction == WALK_BACKWARD) ! vel.z = (0.75 * runningSpeed) - runningSpeedMod; ! else ! vel.z = (-runningSpeed) + runningSpeedMod; movePropClass->SetVelocity(vel); } --- 1576,1601 ---- csVector3 vel; movePropClass->GetVelocity(vel); ! ! // Z penalty ! if(isWalking) ! { ! if(direction == WALK_BACKWARD) ! vel.z = (0.75 * runningSpeed) - runningSpeedMod; ! else ! vel.z = (-runningSpeed) + runningSpeedMod; ! } ! ! // X penalty ! if(isStrafe) ! { ! float speed = ((isRunning ^ isRunningAsDefault) ! ? (runningSpeed - runningSpeedMod) * 0.5 : strafeSpeed); ! speed = (isWalking ? speed * 0.50 : speed); ! ! if ( strafeDir == STRAFE_RIGHT ) ! vel.x = -speed; ! else ! vel.x = speed; ! } movePropClass->SetVelocity(vel); } *************** *** 1591,1594 **** --- 1619,1623 ---- this->isLeftKey = false; this->isRightKey = false; + this->isAutoRunning = false; this->isWalkingWithoutKey = false; } Index: pscharcontrol.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/pscharcontrol.h,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** pscharcontrol.h 13 Mar 2005 12:07:18 -0000 1.44 --- pscharcontrol.h 26 Mar 2005 11:54:24 -0000 1.45 *************** *** 168,172 **** /// Doesn't affect mouse run (hence "ManualMovement") void EndManualMovement(bool stopAuto = true); ! void SetRunningPenalty(float mod); // Sets a penalty on the running speed float GetRunningPenalty(); // Sets a penalty on the running speed --- 168,172 ---- /// Doesn't affect mouse run (hence "ManualMovement") void EndManualMovement(bool stopAuto = true); ! void SetRunningPenalty(int percent); // Sets a penalty on the running speed float GetRunningPenalty(); // Sets a penalty on the running speed |