Page 1 of 1

The truth about xCoop v1.92

Posted: Tue Jan 01, 2008 9:38 am
by fxsr789
-

Re: The truth about xCoop v1.92

Posted: Tue Jan 01, 2008 9:45 am
by fxsr789
-

Variables necessary

Code: Select all

var bool bIsReallyWalking; //Different Walk flag.
var bool bCrouchStep; //To prevent telefragging from crouching.
var bool bWalkingStep; //Switch walking speed and vice versa.
var bool bCrouchChanging; //Changes the collision stuff, duh.
var float OldGroundSpeed,OldJumpZ,OldAccelRate,OldWaterSpeed,OldAirSpeed; //Old movement, used in walk changes.
Fixed Crouch

Code: Select all

//==============
// Encroachment
event bool EncroachingOn( actor Other )
{
      if ( bCrouchStep )
            return true;

      if ( (Other.Brush != None) || (Brush(Other) != None) )
            return true;
            
      if ( (!bIsPlayer || bWarping) && (Pawn(Other) != None))
            return true;
            
      return false;
}



function RemoteHandleCrouch()
{
            local float CrouchHeight;
            local vector CrouchLocation; //Defineing this because Sweeny made errors when using a simple float as a value in a vect() FUCK YOU SWEENY!


      if( Level.NetMode != NM_Standalone )
            return;

            CrouchHeight = Default.CollisionHeight * 0.65;
            
            CrouchLocation.X = 0.000000;
            CrouchLocation.Y = 0.000000;
            CrouchLocation.Z = Default.CollisionHeight - CrouchHeight;

            if( (bIsCrouching) && !bCrouchChanging )
            {
                  PrePivot = vect(0,0,1) * (Default.CollisionHeight - CrouchHeight);                  
                  SetCollisionSize(0.000000, 0.000000);
                  SetCollision(false,false,false);
                  bCollideWorld = false;                  
                  bCrouchStep = true;                  
                  SetLocation(Location-CrouchLocation);
                  bCrouchStep = false;
                  SetCollisionSize(Default.CollisionRadius, CrouchHeight);
                  SetCollision( Default.bCollideActors, Default.bBlockActors, Default.bBlockPlayers );
                  bCollideWorld = Default.bCollideWorld;
                  bCrouchChanging = true;            
            }
            else if( (!bIsCrouching) && bCrouchChanging )
            {
                  PrePivot = Default.PrePivot;                  
                  SetCollisionSize(0.000000, 0.000000);
                  SetCollision(false,false,false);
                  bCollideWorld = false;                  
                  bCrouchStep = true;                  
                  SetLocation(Location+CrouchLocation);
                  bCrouchStep = false;
                  SetCollisionSize(Default.CollisionRadius, Default.CollisionHeight);
                  SetCollision( Default.bCollideActors, Default.bBlockActors, Default.bBlockPlayers );
                  bCollideWorld = Default.bCollideWorld;
                  bCrouchChanging = False;                  
            }
}

function HandleCrouch()
{
            local float CrouchHeight;
            local vector CrouchLocation; //Defineing this because Sweeny made errors when using a simple float as a value in a vect() FUCK YOU SWEENY!


      if( (Role < ROLE_Authority) || (Level.NetMode != NM_DedicatedServer) )
            return;

            CrouchHeight = Default.CollisionHeight * 0.65;
            
            CrouchLocation.X = 0.000000;
            CrouchLocation.Y = 0.000000;
            CrouchLocation.Z = Default.CollisionHeight - CrouchHeight;

            if( (bIsCrouching) && !bCrouchChanging )
            {
                  PrePivot = vect(0,0,1) * (Default.CollisionHeight - CrouchHeight);                  
                  SetCollisionSize(0.000000, 0.000000);
                  SetCollision(false,false,false);
                  bCollideWorld = false;                  
                  bCrouchStep = true;                  
                  SetLocation(Location-CrouchLocation);
                  bCrouchStep = false;
                  SetCollisionSize(Default.CollisionRadius, CrouchHeight);
                  SetCollision( Default.bCollideActors, Default.bBlockActors, Default.bBlockPlayers );
                  bCollideWorld = Default.bCollideWorld;
                  bCrouchChanging = true;            
            }
            else if( (!bIsCrouching) && bCrouchChanging )
            {
                  PrePivot = Default.PrePivot;                  
                  SetCollisionSize(0.000000, 0.000000);
                  SetCollision(false,false,false);
                  bCollideWorld = false;                  
                  bCrouchStep = true;                  
                  SetLocation(Location+CrouchLocation);
                  bCrouchStep = false;
                  SetCollisionSize(Default.CollisionRadius, Default.CollisionHeight);
                  SetCollision( Default.bCollideActors, Default.bBlockActors, Default.bBlockPlayers );
                  bCollideWorld = Default.bCollideWorld;
                  bCrouchChanging = False;                  
            }
}

simulated function ClientHandleCrouch()
{
            local float CrouchHeight;
            local vector CrouchLocation; //Defineing this because Sweeny made errors when using a simple float as a value in a vect() FUCK YOU SWEENY!

      if( (Role >= ROLE_Authority) || (Level.NetMode != NM_Client) )
            return;

            CrouchHeight = Default.CollisionHeight * 0.65;
            
            CrouchLocation.X = 0.000000;
            CrouchLocation.Y = 0.000000;
            CrouchLocation.Z = Default.CollisionHeight - CrouchHeight;

            if( (bIsCrouching) && !bCrouchChanging )
            {
                  PrePivot = vect(0,0,1) * (Default.CollisionHeight - CrouchHeight);                  
                  SetCollisionSize(0.000000, 0.000000);
                  SetCollision(false,false,false);
                  bCollideWorld = false;                  
                  bCrouchStep = true;                  
                  SetLocation(Location-CrouchLocation);
                  bCrouchStep = false;
                  SetCollisionSize(Default.CollisionRadius, CrouchHeight);
                  SetCollision( Default.bCollideActors, Default.bBlockActors, Default.bBlockPlayers );
                  bCollideWorld = Default.bCollideWorld;
                  bCrouchChanging = true;            
            }
            else if( (!bIsCrouching) && bCrouchChanging )
            {
                  PrePivot = Default.PrePivot;                  
                  SetCollisionSize(0.000000, 0.000000);
                  SetCollision(false,false,false);
                  bCollideWorld = false;                  
                  bCrouchStep = true;                  
                  SetLocation(Location+CrouchLocation);
                  bCrouchStep = false;
                  SetCollisionSize(Default.CollisionRadius, Default.CollisionHeight);
                  SetCollision( Default.bCollideActors, Default.bBlockActors, Default.bBlockPlayers );
                  bCollideWorld = Default.bCollideWorld;
                  bCrouchChanging = False;                  
            }
}


//To bad Epic never had a hint from Valve and their Half-Life game.
// DUCK JUMPING!

//Player Jumped
function DoJump( optional float F )
{
      if ( CarriedDecoration != None )
            return;
      if ( Physics == PHYS_Walking )
      {
            if ( Role == ROLE_Authority )
                  PlaySound(JumpSound, SLOT_Talk, 1.5, true, 1200, 1.0 );
            if ( (Level.Game != None) && (Level.Game.Difficulty > 0) )
                  MakeNoise(0.1 * Level.Game.Difficulty);
            PlayInAir();
            if ( bCountJumps && (Role == ROLE_Authority) )
                  Inventory.OwnerJumped();
            Velocity.Z = JumpZ;
            if ( Base != Level )
                  Velocity.Z += Base.Velocity.Z; 
            SetPhysics(PHYS_Falling);
      }
}



Fixed walking

Code: Select all

// Physics Changes.
function HandleWalking()
{
      local rotator carried;

      //Bla blah bla. BLAH BBLABH  BLAH Blah BLAH blah!! NO BLAH BLAH BLAH!
      Default.bAvoidLedges = false;
      Default.bStopAtLedges = false;      
      bAvoidLedges = false;
      bStopAtLedges = false;

      Default.bIsWalking = false;
      bIsWalking = false; //Never do this, screw this!
      
      bIsReallyWalking = ((bRun != 0) || (bDuck != 0)) && !Region.Zone.IsA('WarpZoneInfo');  
      
      // HERE IS THE BIG PART!
      
      if( (bIsReallyWalking) && !bWalkingStep )
      {
            OldGroundSpeed = GroundSpeed;
            OldJumpZ = JumpZ;
            OldAccelRate = AccelRate;
            OldWaterSpeed = WaterSpeed;
            OldAirSpeed = AirSpeed;
            
            // Cut everything in half!
            GroundSpeed = GroundSpeed * 0.25;
            JumpZ = JumpZ * 0.75; //Exception.
            AccelRate = AccelRate * 0.25;
            WaterSpeed = WaterSpeed * 0.25;
            AirSpeed = AirSpeed * 0.25;
            
            bWalkingStep = true;
      }
      else if( (!bIsReallyWalking) && bWalkingStep )
      {
            // I don't know why it would be less than or equal to 0 but just in case.
      
            if( OldGroundSpeed  0.1) )
                              PlayDuck();
                  }
            }
      }
                  
      event PlayerTick( float DeltaTime )
      {

            if( Level.NetMode == NM_Standalone )
                  RemoteHandleCrouch();
            else if( Level.NetMode == NM_DedicatedServer )
                  HandleCrouch();
            else if( Level.NetMode == NM_Client )
                  ClientHandleCrouch();
      
            if ( bUpdatePosition )
                  ClientUpdatePosition();

            PlayerMove(DeltaTime);
      }

      function PlayerMove( float DeltaTime )
      {
            local vector X,Y,Z, NewAccel;
            local EDodgeDir OldDodge;
            local eDodgeDir DodgeMove;
            local rotator OldRotation;
            local float Speed2D;
            local bool      bSaveJump;
            local name AnimGroupName;
            
            if( Level.NetMode == NM_Standalone )
                  RemoteHandleCrouch();
            else if( Level.NetMode == NM_DedicatedServer )
                  HandleCrouch();
            else if( Level.NetMode == NM_Client )
                  ClientHandleCrouch();

            GetAxes(Rotation,X,Y,Z);

            aForward *= 0.4;
            aStrafe  *= 0.4;
            aLookup  *= 0.24;
            aTurn    *= 0.24;

            // Update acceleration.
            NewAccel = aForward*X + aStrafe*Y; 
            NewAccel.Z = 0;
            // Check for Dodge move
            if ( DodgeDir == DODGE_Active )
                  DodgeMove = DODGE_Active;
            else
                  DodgeMove = DODGE_None;
            if (DodgeClickTime > 0.0)
            {
                  if ( DodgeDir < DODGE_Active )
                  {
                        OldDodge = DodgeDir;
                        DodgeDir = DODGE_None;
                        if (bEdgeForward && bWasForward)
                              DodgeDir = DODGE_Forward;
                        if (bEdgeBack && bWasBack)
                              DodgeDir = DODGE_Back;
                        if (bEdgeLeft && bWasLeft)
                              DodgeDir = DODGE_Left;
                        if (bEdgeRight && bWasRight)
                              DodgeDir = DODGE_Right;
                        if ( DodgeDir == DODGE_None)
                              DodgeDir = OldDodge;
                        else if ( DodgeDir != OldDodge )
                              DodgeClickTimer = DodgeClickTime + 0.5 * DeltaTime;
                        else 
                              DodgeMove = DodgeDir;
                  }
      
                  if (DodgeDir == DODGE_Done)
                  {
                        DodgeClickTimer -= DeltaTime;
                        if (DodgeClickTimer < -0.35) 
                        {
                              DodgeDir = DODGE_None;
                              DodgeClickTimer = DodgeClickTime;
                        }
                  }            
                  else if ((DodgeDir != DODGE_None) && (DodgeDir != DODGE_Active))
                  {
                        DodgeClickTimer -= DeltaTime;                  
                        if (DodgeClickTimer < 0)
                        {
                              DodgeDir = DODGE_None;
                              DodgeClickTimer = DodgeClickTime;
                        }
                  }
            }
            
            AnimGroupName = GetAnimGroup(AnimSequence);            
            if ( (Physics == PHYS_Walking) && (AnimGroupName != 'Dodge') )
            {
                  //if walking, look up/down stairs - unless player is rotating view
                  if ( !bKeyboardLook && (bLook == 0) )
                  {
                        if ( bLookUpStairs )
                              ViewRotation.Pitch = FindStairRotation(deltaTime);
                        else if ( bCenterView )
                        {
                              ViewRotation.Pitch = ViewRotation.Pitch & 65535;
                              if (ViewRotation.Pitch > 32768)
                                    ViewRotation.Pitch -= 65536;
                              ViewRotation.Pitch = ViewRotation.Pitch * (1 - 12 * FMin(0.0833, deltaTime));
                              if ( Abs(ViewRotation.Pitch) < 1000 )
                                    ViewRotation.Pitch = 0;      
                        }
                  }

                  Speed2D = Sqrt(Velocity.X * Velocity.X + Velocity.Y * Velocity.Y);
                  //add bobbing when walking
                  if ( !bShowMenu )
                  {
                        if ( Speed2D < 10 )
                              BobTime += 0.2 * DeltaTime;
                        else
                              BobTime += DeltaTime * (0.3 + 0.7 * Speed2D/GroundSpeed);
                        WalkBob = Y * 0.65 * Bob * Speed2D * sin(6.0 * BobTime);
                        if ( Speed2D < 10 )
                              WalkBob.Z = Bob * 30 * sin(12 * BobTime);
                        else
                              WalkBob.Z = Bob * Speed2D * sin(12 * BobTime);
                  }
            }      
            else if ( !bShowMenu )
            { 
                  BobTime = 0;
                  WalkBob = WalkBob * (1 - FMin(1, 8 * deltatime));
            }

            // Update rotation.
            OldRotation = Rotation;
            UpdateRotation(DeltaTime, 1);

            if ( bPressedJump && (AnimGroupName == 'Dodge') )
            {
                  bSaveJump = true;
                  bPressedJump = false;
            }
            else
                  bSaveJump = false;

            if ( Role < ROLE_Authority ) // then save this move and replicate it
                  ReplicateMove(DeltaTime, NewAccel, DodgeMove, OldRotation - Rotation);
            else
                  ProcessMove(DeltaTime, NewAccel, DodgeMove, OldRotation - Rotation);
            bPressedJump = bSaveJump;
      }

      function BeginState()
      {
            SetCollisionSize( Default.CollisionRadius, Default.CollisionHeight );
            SetCollision( Default.bCollideActors, Default.bBlockActors, Default.bBlockPlayers );
            bCollideWorld = Default.bCollideWorld;
            bProjTarget = Default.bProjTarget;
            
            WalkBob = vect(0,0,0);
            DodgeDir = DODGE_None;
            bIsCrouching = false;
            bIsTurning = false;
            bPressedJump = false;
            if (Physics != PHYS_Falling) SetPhysics(PHYS_Walking);
            if ( !IsAnimating() )
                  PlayWaiting();
      }
      
      function EndState()
      {
            SetCollisionSize( Default.CollisionRadius, Default.CollisionHeight );
            SetCollision( Default.bCollideActors, Default.bBlockActors, Default.bBlockPlayers );
            bCollideWorld = Default.bCollideWorld;
            bProjTarget = Default.bProjTarget;
                  
            WalkBob = vect(0,0,0);
            bIsCrouching = false;
      }
}

There.

-Fenix

Re: The truth about xCoop v1.92

Posted: Tue Jan 01, 2008 12:50 pm
by Smirftsch
this is getting more and more interesting every day...
Anyway, I'm no judge in this matter, and I'm obviously not able to tell if this is the truth or not.
So I don't judge and won't judge, because I can't judge.
For my part I won't say anything about that, and will look into this code.

Re: The truth about xCoop v1.92

Posted: Tue Jan 01, 2008 1:33 pm
by mentalhunter
Nice.

Re: The truth about xCoop v1.92

Posted: Tue Jan 01, 2008 2:19 pm
by fxsr789
-

Re: The truth about xCoop v1.92

Posted: Tue Jan 01, 2008 2:40 pm
by fxsr789
I feel really stupid for posting all that BS aside from the code, I knew no one would necessarily take interest here (not like Leo(T.C.K.) still comes here, or does he? Never seen him around alot anymore.)

I guess I should rephrase the first post. I don't know.

- Fenix

Re: The truth about xCoop v1.92

Posted: Tue Jan 01, 2008 3:23 pm
by Leo T_C_K
I am still here, I returned when 227 came out.
And I know you added these functions back. But I don't get why at all, as I said already I am not fond of these functions and I think I even told you it like year back when you had that other mod from PCube installed on server which allowed to control players and steal stuff from them. I think it is wrong to use that against anyone.
On the other side you are very talented mod maker.

Re: The truth about xCoop v1.92

Posted: Tue Jan 01, 2008 8:43 pm
by mentalhunter
Nice.
That better be a compliment... If it's sarcasm I'm going to be extremely mad with you...


-
this is getting more and more interesting every day...

Anyway, I'm no judge in this matter, and I'm obviously not able to tell if this is the truth or not.
So I don't judge and won't judge, because I can't judge.
For my part I won't say anything about that, and will look into this code.
Yeah... about all that I posted (aside from the code) You can ignore that, I was feeling rather depressed. I should edit it.... I had no idea what I was thinking at the moment so sorry.

Anyways, If you DO look into the code, I hope you didn't change anything drastic in Unreal's collision system, I saw someone post "Hixboxes?" in the 227 bug reports. That made me think that the crouch code would bust.

Thanks for considering.

- Fenix
Lol, you explain to me, how could that NOT be a compliment?
And you really think i F*cking hate you, do you?

Re: The truth about xCoop v1.92

Posted: Tue Jan 01, 2008 9:29 pm
by Leo T_C_K
Please, this is not a place for a chat like that.

Re: The truth about xCoop v1.92

Posted: Wed Jan 02, 2008 5:44 am
by DieHard SCWS
Smirftsch ment what he wrote and it was not sarcasm. Since nor he, nor anyone else not involded can say what the truth is, so Smirftsch is just being honest there.


As for this forum, it is not allowed to go start flamming eachother. If you guys stick to code alone and help improove Unreal than you are all welcome. And i agree with Leo her, its not the place to go fight out wars. Over time people got disapointed or angry about things that happened, and i guess it has happened to most of us somewhere in the pipeline.


You can always share PM with another to work out any dissapointment or problems. And hopefully have something good come out of it....


So please stick to the coding and let the rest for what it is, and go PM if you want to talk about it.
.
.
.

Re: The truth about xCoop v1.92

Posted: Wed Jan 02, 2008 6:20 am
by Pcube
Yeah, let the controversy die, please..

Re: The truth about xCoop v1.92

Posted: Sun Jan 06, 2008 10:32 pm
by Jâçkrâßßit
btw 227rox

Re: The truth about xCoop v1.92

Posted: Sun Jan 06, 2008 10:33 pm
by fxsr789
Wtf? Topic revival, I request a lock please.

Re: The truth about xCoop v1.92

Posted: Sun Jan 06, 2008 11:23 pm
by DieHard SCWS
Thread locked on request from the original poster.


:)

.
.
.