Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addHook("PreThinkFrame", function()
- for player in players.iterate
- if player.jointime < 1 then
- player.oshStoreX = player.mo.x
- player.oshStoreY = player.mo.y
- player.oshStoreZ = player.mo.floorz
- player.oshMomXY = FRACUNIT
- player.oshRunState = 0
- player.oshOnGround = 0
- else
- player.oshStoreX = player.mo.x
- player.oshStoreY = player.mo.y
- player.oshStoreZ = player.mo.floorz
- player.cmd.forwardmove = $*player.oshCeilingValue
- player.cmd.sidemove = $*player.oshCeilingValue
- player.oshStickForce = FixedSqrt(((player.cmd.forwardmove*player.cmd.forwardmove)+(player.cmd.sidemove*player.cmd.sidemove))*FRACUNIT)
- player.oshStickAngle = R_PointToAngle2(0,0,player.cmd.sidemove*FRACUNIT,player.cmd.forwardmove*FRACUNIT)
- player.oshCamStick=camera.angle + R_PointToAngle2(0,0,player.cmd.sidemove*FRACUNIT,player.cmd.forwardmove*FRACUNIT)-ANGLE_90
- end
- end
- end)
- addHook("PlayerThink", function(player)
- if player.jointime < 1 then
- player.oshMoSlope = FixedAngle(0)
- //player.oshTotMom = FixedSqrt(FixedMul(player.mo.momx,player.mo.momx)+FixedMul(player.mo.momy,player.mo.momy)+FixedMul(player.mo.momz,player.mo.momz))
- player.oshMomXY = FixedSqrt(FixedMul(player.mo.momx,player.mo.momx)+FixedMul(player.mo.momy,player.mo.momy))
- player.oshWallAngle = FixedAngle(0)
- player.oshLineToStickTo=-1
- player.oshSideToStickTo=-1
- player.oshRunState = 0
- player.oshWallSpeed = FRACUNIT
- player.oshWallFriction = FRACUNIT
- player.oshTopSpeed = player.normalspeed
- player.oshWallMomX = FRACUNIT
- player.oshWallMomY = FRACUNIT
- player.oshWallMomZ = FRACUNIT
- player.oshCurrentState = 0
- player.oshDefaultGrav=P_MobjFlip(player.mo)
- player.oshHitGroundSpeed=FRACUNIT
- player.oshWallAngleCache=FixedAngle(0)
- player.oshGroundTimer = 2
- player.oshCeilingValue=1
- player.oshOnGroundC=0
- else
- --SET GENERAL VARIABLES--
- player.oshTotMom = FixedSqrt(FixedMul(player.mo.momx,player.mo.momx)+FixedMul(player.mo.momy,player.mo.momy)+FixedMul(player.mo.momz,player.mo.momz))
- player.oshMomXY = FixedSqrt(FixedMul(player.mo.momx,player.mo.momx)+FixedMul(player.mo.momy,player.mo.momy))
- player.oshAcceleration = ((FixedInt((player.thrustfactor * (player.accelstart+(player.oshWallSpeed>>FRACBITS)*player.acceleration))<<FRACBITS)*FixedInt(player.oshStickForce))/50)*2
- if player.powers[pw_sneakers] <= 0 and player.oshTopSpeed ~= player.oshNormSpeed then
- player.oshTopSpeed = player.normalspeed
- elseif player.powers[pw_sneakers] > 0 and player.oshTopSpeed ~= FixedDiv(FixedMul(player.oshNormSpeed,166*FRACUNIT),100*FRACUNIT) then
- player.oshTopSpeed = FixedDiv(FixedMul(player.normalspeed,166*FRACUNIT),100*FRACUNIT)
- end
- --END OF SET GENERAL VARIABLES--
- --DETECT IF SHOULD BE IN AIR--
- if player.oshRunState == 2 then
- player.oshOnGround = 1
- elseif P_MobjFlip(player.mo)==1 then --If Gravity is normal--
- if player.mo.momz > 0 and player.mo.standingslope == nil then
- player.oshOnGround = 0
- elseif FixedInt(player.mo.z)-FixedInt(player.mo.floorz) > 10 and player.mo.standingslope == nil then
- player.oshOnGround = 0
- elseif P_IsObjectOnGround(player.mo) then
- player.oshOnGround = 1
- elseif player.mo.standingslope ~= nil
- player.oshOnGround = 1
- end
- else --If Gravity is flipped--
- if player.mo.momz < 0 and player.mo.standingslope == nil then
- player.oshOnGround = 0
- elseif FixedInt(player.mo.ceilingz)-FixedInt(player.mo.height)-FixedInt(player.mo.z) > 10 and player.mo.standingslope == nil then
- player.oshOnGround = 0
- elseif P_IsObjectOnGround(player.mo) then
- player.oshOnGround = 1
- elseif player.mo.standingslope ~= nil
- player.oshOnGround = 1
- end
- end
- --END OF DETECT IF SHOULD BE IN AIR--
- --IGNORE GROUND UPHILL SLOPES PART 1--
- if P_MobjFlip(player.mo)==1 then --If Gravity is normal--
- print ("Down")
- if FixedInt(player.oshMomXY)>0 then
- player.oshMoAngle = R_PointToAngle2(0,0,player.mo.momx,player.mo.momy)
- player.oshMoSlope = R_PointToAngle2(0,P_FloorzAtPos(player.mo.x,player.mo.y,player.mo.z,player.mo.height),player.mo.radius,P_FloorzAtPos(player.mo.x+FixedMul(player.mo.radius,cos(player.oshMoAngle)), player.mo.y+FixedMul(player.mo.radius,sin(player.oshMoAngle)), player.mo.z+player.mo.height, player.mo.height))
- else
- player.oshMoAngle = player.mo.angle
- player.oshMoSlope = R_PointToAngle2(0,P_FloorzAtPos(player.mo.x,player.mo.y,player.mo.z,player.mo.height),player.mo.radius,P_FloorzAtPos(player.mo.x+FixedMul(player.mo.radius,cos(player.oshMoAngle)), player.mo.y+FixedMul(player.mo.radius,sin(player.oshMoAngle)), player.mo.z+player.mo.height, player.mo.height))
- end
- player.oshSlopeX = R_PointToAngle2(0,P_FloorzAtPos(player.mo.x-FixedDiv(player.mo.radius, 2*FRACUNIT),player.mo.y,player.mo.z,player.mo.height),player.mo.radius,P_FloorzAtPos(player.mo.x+FixedDiv(player.mo.radius, 2*FRACUNIT),player.mo.y,player.mo.z,player.mo.height))
- player.oshSlopeY = R_PointToAngle2(0,P_FloorzAtPos(player.mo.x,player.mo.y-FixedDiv(player.mo.radius, 2*FRACUNIT),player.mo.z,player.mo.height),player.mo.radius,P_FloorzAtPos(player.mo.x,player.mo.y+FixedDiv(player.mo.radius, 2*FRACUNIT),player.mo.z,player.mo.height))
- if player.oshOnGround == 1 and FixedInt(AngleFixed(player.oshMoSlope)) < 180 and player.oshRunState ~= 2 then
- player.mo.flags = $|MF_NOGRAVITY
- player.mo.z = player.mo.floorz
- elseif player.oshOnGround == 0 then
- player.mo.flags = $ & ~MF_NOGRAVITY
- end
- else --If Gravity is flipped--
- print ("Up")
- if FixedInt(player.oshMomXY)>0 then
- player.oshMoAngle = R_PointToAngle2(0,0,player.mo.momx,player.mo.momy)
- player.oshMoSlope = R_PointToAngle2(0,P_CeilingzAtPos(player.mo.x,player.mo.y,player.mo.z,player.mo.height),player.mo.radius,P_CeilingzAtPos(player.mo.x+FixedMul(player.mo.radius,cos(player.oshMoAngle)), player.mo.y+FixedMul(player.mo.radius,sin(player.oshMoAngle)), player.mo.z, player.mo.height))
- else
- player.oshMoAngle = player.mo.angle
- player.oshMoSlope = R_PointToAngle2(0,P_CeilingzAtPos(player.mo.x,player.mo.y,player.mo.z,player.mo.height),player.mo.radius,P_CeilingzAtPos(player.mo.x+FixedMul(player.mo.radius,cos(player.oshMoAngle)), player.mo.y+FixedMul(player.mo.radius,sin(player.oshMoAngle)), player.mo.z, player.mo.height))
- end
- player.oshSlopeX = R_PointToAngle2(0,P_CeilingzAtPos(player.mo.x-FixedDiv(player.mo.radius, 2*FRACUNIT),player.mo.y,player.mo.z,player.mo.height),player.mo.radius,P_CeilingzAtPos(player.mo.x+FixedDiv(player.mo.radius, 2*FRACUNIT),player.mo.y,player.mo.z,player.mo.height))
- player.oshSlopeY = R_PointToAngle2(0,P_CeilingzAtPos(player.mo.x,player.mo.y-FixedDiv(player.mo.radius, 2*FRACUNIT),player.mo.z,player.mo.height),player.mo.radius,P_CeilingzAtPos(player.mo.x,player.mo.y+FixedDiv(player.mo.radius, 2*FRACUNIT),player.mo.z,player.mo.height))
- if player.oshOnGround == 1 and FixedInt(AngleFixed(player.oshMoSlope)) > 180 and player.oshRunState ~= 2 then
- player.mo.flags = $|MF_NOGRAVITY
- player.mo.z = player.mo.ceilingz-player.mo.height
- elseif player.oshOnGround == 0 then
- player.mo.flags = $ & ~MF_NOGRAVITY
- end
- end
- --END OF IGNORE GROUND UPHILL SLOPES PART 1--
- --GETTING LINE TO STICK TO--
- if player.lastlinehit > -1 and player.climbing==0 then
- player.oshLineToStickTo=player.lastlinehit
- player.oshSideToStickTo=player.lastsidehit
- if lines[player.oshLineToStickTo].frontside == sides[player.oshSideToStickTo] then
- player.oshWallAngle = R_PointToAngle2(lines[player.oshLineToStickTo].v1.x,lines[player.oshLineToStickTo].v1.y,lines[player.oshLineToStickTo].v2.x,lines[player.oshLineToStickTo].v2.y)
- elseif lines[player.oshLineToStickTo].backside == sides[player.oshSideToStickTo] then
- player.oshWallAngle = R_PointToAngle2(lines[player.oshLineToStickTo].v2.x,lines[player.oshLineToStickTo].v2.y,lines[player.oshLineToStickTo].v1.x,lines[player.oshLineToStickTo].v1.y)
- end
- player.oshToWallSlope = ANGLE_180 - R_PointToAngle2(10*FRACUNIT,P_FloorzAtPos(player.mo.x-FixedMul(10*FRACUNIT,cos(player.oshWallAngle+ANGLE_90)), player.mo.y-FixedMul(10*FRACUNIT,sin(player.oshWallAngle+ANGLE_90)), player.mo.z+player.mo.height, player.mo.height),0,P_FloorzAtPos(player.mo.x,player.mo.y,player.mo.z,player.mo.height))
- player.oshCeilWallSlope = R_PointToAngle2(0,P_CeilingzAtPos(player.mo.x,player.mo.y,player.mo.z,player.mo.height),10*FRACUNIT, P_CeilingzAtPos(player.mo.x-FixedMul(10*FRACUNIT,cos(player.oshWallAngle+ANGLE_90)),player.mo.y-FixedMul(10*FRACUNIT,sin(player.oshWallAngle+ANGLE_90)),player.mo.z, player.mo.height))
- player.lastlinehit, player.lastsidehit = -1, -1
- elseif player.lastlinehit == -1 then
- player.oshLineToStickTo=-1
- player.oshSideToStickTo=-1
- end
- if player.oshOnGround==1 and player.oshRunState ~= 2 and player.oshLineToStickTo==-1 then
- player.oshWallSpeed = player.oshMomXY
- elseif player.oshRunState == 2 then
- if FixedSqrt(FixedMul(player.oshWallMomX,player.oshWallMomX)+FixedMul(player.oshWallMomY,player.oshWallMomY)+FixedMul(player.oshWallMomZ, player.oshWallMomZ)) > 10*FRACUNIT then
- player.oshWallSpeed = FixedSqrt(FixedMul(player.oshWallMomX,player.oshWallMomX)+FixedMul(player.oshWallMomY,player.oshWallMomY)+FixedMul(player.oshWallMomZ,player.oshWallMomZ))
- else
- player.oshWallSpeed = 10*FRACUNIT
- end
- end
- --END OF GETTING LINE TO STICK TO--
- --GET DEFAULT GRAVITY--
- if player.oshRunState == 2 and player.oshDefaultGrav== -1 then
- player.oshDefaultGrav = -2
- elseif player.oshRunState == 2 and player.oshDefaultGrav== 1 then
- player.oshDefaultGrav = 2
- elseif player.oshRunState ~= 2 and player.oshDefaultGrav == 2*P_MobjFlip(player.mo) then
- player.oshDefaultGrav = P_MobjFlip(player.mo)
- elseif player.oshRunState ~= 2 and player.oshDefaultGrav == -1*P_MobjFlip(player.mo) then
- player.oshDefaultGrav = P_MobjFlip(player.mo)
- end
- --END OF GET DEFAULT GRAVITY--
- --INTO WALL RUN--
- if player.oshLineToStickTo ~= -1 and P_MobjFlip(player.mo)==1 and player.powers[pw_justlaunched]== 1 then
- P_TeleportMove(player.mo, player.mo.x-FixedMul(10*FRACUNIT,cos(player.oshWallAngle+ANGLE_90)), player.mo.y-FixedMul(10*FRACUNIT,sin(player.oshWallAngle+ANGLE_90)), player.mo.z+(5*FRACUNIT))
- player.oshRunState = 2
- player.oshWallMomX = FixedMul(cos(player.oshWallAngle),FixedMul(cos(player.oshWallAngle-player.mo.angle),player.oshWallSpeed))
- player.oshWallMomY = FixedMul(sin(player.oshWallAngle),FixedMul(cos(player.oshWallAngle-player.mo.angle),player.oshWallSpeed))
- player.oshWallMomZ = FixedMul(FixedMul(sin(player.oshWallAngle-player.mo.angle),player.oshWallSpeed),(P_MobjFlip(player.mo))*(-1*FRACUNIT))
- player.oshToWallSlope = FixedAngle(0)
- elseif player.oshLineToStickTo ~= -1 and P_MobjFlip(player.mo)==-1 and player.powers[pw_justlaunched]== 1 then
- P_TeleportMove(player.mo, player.mo.x-FixedMul(10*FRACUNIT,cos(player.oshWallAngle+ANGLE_90)), player.mo.y-FixedMul(10*FRACUNIT,sin(player.oshWallAngle+ANGLE_90)), player.mo.z-(5*FRACUNIT))
- player.oshRunState = 2
- player.oshWallMomX = FixedMul(cos(player.oshWallAngle),FixedMul(cos(player.oshWallAngle-player.mo.angle),player.oshWallSpeed))
- player.oshWallMomY = FixedMul(sin(player.oshWallAngle),FixedMul(cos(player.oshWallAngle-player.mo.angle),player.oshWallSpeed))
- player.oshWallMomZ = FixedMul(FixedMul(sin(player.oshWallAngle-player.mo.angle),player.oshWallSpeed),(P_MobjFlip(player.mo))*(-1*FRACUNIT))
- player.oshCeilWallSlope = FixedAngle(0)
- elseif FixedInt(AngleFixed(player.oshToWallSlope)) > 30 and FixedInt(AngleFixed(player.oshToWallSlope)) < 180 and player.oshLineToStickTo ~= -1 and player.oshRunState == 1 and P_MobjFlip(player.mo)==1 then
- P_TeleportMove(player.mo, player.mo.x-FixedMul(10*FRACUNIT,cos(player.oshWallAngle+ANGLE_90)), player.mo.y-FixedMul(10*FRACUNIT,sin(player.oshWallAngle+ANGLE_90)), player.mo.z+(5*FRACUNIT))
- player.oshRunState = 2
- player.oshWallMomX = FixedMul(cos(player.oshWallAngle),FixedMul(cos(player.oshWallAngle-player.mo.angle),player.oshWallSpeed))
- player.oshWallMomY = FixedMul(sin(player.oshWallAngle),FixedMul(cos(player.oshWallAngle-player.mo.angle),player.oshWallSpeed))
- player.oshWallMomZ = FixedMul(FixedMul(sin(player.oshWallAngle-player.mo.angle),player.oshWallSpeed),(P_MobjFlip(player.mo))*(-1*FRACUNIT))
- player.oshToWallSlope = FixedAngle(0)
- elseif FixedInt(AngleFixed(player.oshCeilWallSlope)) > 30 and FixedInt(AngleFixed(player.oshCeilWallSlope)) < 180 and player.oshLineToStickTo ~= -1 and player.oshRunState == 1 and P_MobjFlip(player.mo)==-1 then
- P_TeleportMove(player.mo, player.mo.x-FixedMul(10*FRACUNIT,cos(player.oshWallAngle+ANGLE_90)), player.mo.y-FixedMul(10*FRACUNIT,sin(player.oshWallAngle+ANGLE_90)), player.mo.z-(5*FRACUNIT))
- player.oshRunState = 2
- player.oshWallMomX = FixedMul(cos(player.oshWallAngle),FixedMul(cos(player.oshWallAngle-player.mo.angle),player.oshWallSpeed))
- player.oshWallMomY = FixedMul(sin(player.oshWallAngle),FixedMul(cos(player.oshWallAngle-player.mo.angle),player.oshWallSpeed))
- player.oshWallMomZ = FixedMul(FixedMul(sin(player.oshWallAngle-player.mo.angle),player.oshWallSpeed),(P_MobjFlip(player.mo))*(-1*FRACUNIT))
- player.oshCeilWallSlope = FixedAngle(0)
- elseif player.oshOnGround == 0 and player.oshRunState ~= 2 then
- if player.oshDefaultGrav < 0 then
- A_SetObjectFlags2(player.mo,MF2_OBJECTFLIP,0)
- elseif player.oshDefaultGrav > 0 then
- A_SetObjectFlags2(player.mo,MF2_OBJECTFLIP,1)
- end
- elseif FixedInt(player.oshTotMom)>=10 and player.oshOnGround == 1 and player.oshRunState ~= 2 then
- player.oshWallFriction = player.mo.friction
- player.oshRunState = 1
- elseif FixedInt(player.oshTotMom)<10 and player.oshRunState ~= 0 and player.oshRunState ~= 2 then
- player.oshRunState = 1
- elseif player.oshRunState == 2 and P_IsObjectOnGround(player.mo) and P_MobjFlip(player.mo) == 1 and FixedInt(player.oshWallMomZ)<=0 then
- player.oshRunState = 1
- player.mo.z = P_FloorzAtPos(player.mo.x, player.mo.y, player.mo.z, player.mo.height)
- player.oshOnGround = 1
- player.mo.momy=FixedMul(cos(R_PointToAngle2(0,P_FloorzAtPos(player.mo.x,player.mo.y,player.mo.z,player.mo.height),player.mo.radius,P_FloorzAtPos(player.mo.x+FixedMul(player.mo.radius,cos(player.mo.angle)), player.mo.y+FixedMul(player.mo.radius,sin(player.mo.angle)), player.mo.z+player.mo.height, player.mo.height))),FixedMul(sin(player.mo.angle),player.oshWallSpeed))
- player.mo.momx=FixedMul(cos(R_PointToAngle2(0,P_FloorzAtPos(player.mo.x,player.mo.y,player.mo.z,player.mo.height),player.mo.radius,P_FloorzAtPos(player.mo.x+FixedMul(player.mo.radius,cos(player.mo.angle)), player.mo.y+FixedMul(player.mo.radius,sin(player.mo.angle)), player.mo.z+player.mo.height, player.mo.height))),FixedMul(cos(player.mo.angle),player.oshWallSpeed))
- player.mo.momz=FixedMul(sin(R_PointToAngle2(0,P_FloorzAtPos(player.mo.x,player.mo.y,player.mo.z,player.mo.height),player.mo.radius,P_FloorzAtPos(player.mo.x+FixedMul(player.mo.radius,cos(player.mo.angle)), player.mo.y+FixedMul(player.mo.radius,sin(player.mo.angle)), player.mo.z+player.mo.height, player.mo.height))),player.oshWallSpeed)
- elseif player.oshRunState == 2 and P_IsObjectOnGround(player.mo) and P_MobjFlip(player.mo) == -1 and FixedInt(player.oshWallMomZ)>=0 then
- player.oshOnGround = 1
- player.oshRunState = 1
- player.mo.z = P_CeilingzAtPos(player.mo.x, player.mo.y, player.mo.z, player.mo.height)-player.mo.height
- player.mo.momy=FixedMul(cos(R_PointToAngle2(0,P_CeilingzAtPos(player.mo.x,player.mo.y,player.mo.z,player.mo.height),player.mo.radius,P_CeilingzAtPos(player.mo.x-FixedMul(player.mo.radius,cos(player.mo.angle)), player.mo.y-FixedMul(player.mo.radius,sin(player.mo.angle)), player.mo.z+player.mo.height, player.mo.height))),FixedMul(sin(player.mo.angle),FixedMul(-1*FRACUNIT,player.oshWallSpeed)))
- player.mo.momx=FixedMul(cos(R_PointToAngle2(0,P_CeilingzAtPos(player.mo.x,player.mo.y,player.mo.z,player.mo.height),player.mo.radius,P_CeilingzAtPos(player.mo.x-FixedMul(player.mo.radius,cos(player.mo.angle)), player.mo.y-FixedMul(player.mo.radius,sin(player.mo.angle)), player.mo.z+player.mo.height, player.mo.height))),FixedMul(cos(player.mo.angle),FixedMul(-1*FRACUNIT,player.oshWallSpeed)))
- player.mo.momz=FixedMul(sin(R_PointToAngle2(0,P_CeilingzAtPos(player.mo.x,player.mo.y,player.mo.z,player.mo.height),player.mo.radius,P_CeilingzAtPos(player.mo.x-FixedMul(player.mo.radius,cos(player.mo.angle)), player.mo.y-FixedMul(player.mo.radius,sin(player.mo.angle)), player.mo.z+player.mo.height, player.mo.height))),player.oshWallSpeed)
- elseif player.oshRunState ~= 2 and player.oshOnGround == 0 and player.oshRunState ~= 0 then
- player.oshRunState = 3
- elseif player.oshLineToStickTo==-1 and player.oshRunState == 2 then
- player.oshRunState = 3
- elseif FixedInt(player.oshTotMom)<10 and player.oshRunState == 2 then
- player.oshRunState = 3
- A_SetObjectFlags2(player.mo,MF2_OBJECTFLIP,(oshDefaultGrav+2)/4)
- player.mo.momy=player.oshWallMomY--+FixedMul(sin(player.oshWallAngle+FixedAngle(90*FRACUNIT)),70*FRACUNIT)
- player.mo.momx=player.oshWallMomX--+FixedMul(cos(player.oshWallAngle+FixedAngle(90*FRACUNIT)),70*FRACUNIT)
- player.mo.momz=player.oshWallMomZ
- end
- if player.oshRunState == 2 then
- player.oshCeilingValue=1
- else
- player.oshCeilingValue=P_MobjFlip(player.mo)
- end
- if player.oshRunState == 3 then
- if player.oshDefaultGrav < 0 then
- A_SetObjectFlags2(player.mo,MF2_OBJECTFLIP,0)
- elseif player.oshDefaultGrav > 0 then
- A_SetObjectFlags2(player.mo,MF2_OBJECTFLIP,1)
- end
- player.oshRunState = 0
- end
- if player.oshRunState == 0 then
- player.oshDefaultGrav=P_MobjFlip(player.mo)
- end
- --END OF INTO WALL RUN--
- --THE WALL CRAWL--
- if player.mo and player.mo.valid and player.oshRunState == 2 and player.oshLineToStickTo >= 0 then
- print ("--ON THE WALL--")
- if player.oshRunState == 2 and player.mo.momz > 0 then
- A_SetObjectFlags2(player.mo,MF2_OBJECTFLIP,0)
- elseif player.oshRunState == 2 and player.mo.momz < 0 then
- A_SetObjectFlags2(player.mo,MF2_OBJECTFLIP,1)
- end
- if not P_IsObjectOnGround(player.mo) then
- player.oshHitGroundSpeed=player.oshWallSpeed
- player.oshWallAngleCache=player.oshWallAngle
- end
- --SPRITE ROTATION--
- if FixedInt(AngleFixed(R_PointToAngle(player.mo.x, player.mo.y)-player.oshWallAngle-FixedAngle(90*FRACUNIT)))>90 and FixedInt(AngleFixed(R_PointToAngle(player.mo.x,player.mo.y)-player.oshWallAngle-FixedAngle(90*FRACUNIT)))<=180 then
- player.mo.rollangle = FixedAngle(90*FRACUNIT)
- elseif FixedInt(AngleFixed(R_PointToAngle(player.mo.x, player.mo.y)-player.oshWallAngle-FixedAngle(90*FRACUNIT)))<270 and FixedInt(AngleFixed(R_PointToAngle(player.mo.x, player.mo.y)-player.oshWallAngle-FixedAngle(90*FRACUNIT)))>180 then
- player.mo.rollangle = ANGLE_270
- else
- player.mo.rollangle = R_PointToAngle(player.mo.x, player.mo.y)-player.oshWallAngle-FixedAngle(90*FRACUNIT)
- end
- --END OF SPRITE ROTATION--
- player.oshWallMomX = FixedDiv(FixedMul(player.oshWallMomX,29*FRACUNIT),32*FRACUNIT)
- player.oshWallMomY = FixedDiv(FixedMul(player.oshWallMomY,29*FRACUNIT),32*FRACUNIT)
- player.oshWallMomZ = FixedDiv(FixedMul(player.oshWallMomZ,29*FRACUNIT),32*FRACUNIT)
- if player.oshWallSpeed < player.oshTopSpeed and player.oshWallSpeed+FixedDiv(player.oshAcceleration*FRACUNIT,1000*FRACUNIT) < player.oshTopSpeed then
- player.oshWallMomX = player.oshWallMomX+FixedMul(cos(player.oshWallAngle),FixedMul(cos(player.oshWallAngle-player.oshCamStick),FixedDiv(player.oshAcceleration*FRACUNIT,1000*FRACUNIT)))
- player.oshWallMomY = player.oshWallMomY+FixedMul(sin(player.oshWallAngle),FixedMul(cos(player.oshWallAngle-player.oshCamStick),FixedDiv(player.oshAcceleration*FRACUNIT,1000*FRACUNIT)))
- player.oshWallMomZ = player.oshWallMomZ-FixedMul(sin(player.oshWallAngle-player.oshCamStick),FixedDiv(player.oshAcceleration*FRACUNIT,1000*FRACUNIT))
- elseif player.oshWallSpeed < player.oshTopSpeed and player.oshWallSpeed+FixedDiv(player.oshAcceleration*FRACUNIT,1000*FRACUNIT) == player.oshTopSpeed then
- player.oshWallMomX = player.oshWallMomX+FixedMul(cos(player.oshWallAngle),FixedMul(cos(player.oshWallAngle-player.oshCamStick),player.oshTopSpeed-player.oshWallSpeed))
- player.oshWallMomY = player.oshWallMomY+FixedMul(sin(player.oshWallAngle),FixedMul(cos(player.oshWallAngle-player.oshCamStick),player.oshTopSpeed-player.oshWallSpeed))
- player.oshWallMomZ = player.oshWallMomZ-FixedMul(sin(player.oshWallAngle-player.oshCamStick),player.oshTopSpeed-player.oshWallSpeed)
- end
- --SET THE ACTUAL MOMENTUMS--
- player.mo.momy=player.oshWallMomY--+FixedMul(sin(player.oshWallAngle+FixedAngle(90*FRACUNIT)),70*FRACUNIT)
- player.mo.momx=player.oshWallMomX--+FixedMul(cos(player.oshWallAngle+FixedAngle(90*FRACUNIT)),70*FRACUNIT)
- player.mo.momz=player.oshWallMomZ
- --END OF SET THE ACTUAL MOMENTUMS--
- --STICK TO THE WALL--
- player.mo.momx = player.mo.momx+FixedMul(75*FRACUNIT,cos(player.oshWallAngle+ANGLE_90))
- player.mo.momy = player.mo.momy+FixedMul(75*FRACUNIT,sin(player.oshWallAngle+ANGLE_90))
- --END OF STICK TO THE WALL--
- --CHANGING THE STATE--
- if player.mo.state ~= 21 and FixedInt(player.runspeed)>player.oshWallSpeed and player.dashmode <= 3*TICRATE then
- player.oshCurrentState = 13
- end
- if player.mo.state ~= 21 and FixedInt(player.runspeed)<=player.oshWallSpeed and player.dashmode <= 3*TICRATE then
- player.oshCurrentState = 15
- end
- if player.mo.state ~= 21 and player.dashmode > 3*TICRATE then
- player.oshCurrentState = 16
- end
- if player.mo.state == 21 then
- player.oshCurrentState = 21
- end
- if player.mo.state ~= 21 and player.oshCurrentState == 21 then
- player.oshCurrentState = 13
- end
- if player.oshRunState == 2 then
- player.mo.state = player.oshCurrentState
- end
- --END OF CHANGING THE STATE
- elseif player.oshGroundTimer > 0 then
- player.oshGroundTimer = player.oshGroundTimer -1
- end
- //if player.oshRunState == 2 and player.momz>0 then
- // A_SetObjectFlags2(player.mo,MF2_OBJECTFLIP,0)
- //elseif player.oshRunState == 2 and player.momz<0 then
- // A_SetObjectFlags2(player.mo,MF2_OBJECTFLIP,1)
- //end
- if not P_IsObjectOnGround(player.mo) and player.oshOnGround == 1 and player.oshRunState ~= 0 and player.oshRunState ~= 2 then
- if player.mo.state ~= 21 and FixedInt(player.runspeed)>player.oshWallSpeed and player.dashmode <= 3*TICRATE then
- player.oshCurrentState = 13
- end
- if player.mo.state ~= 21 and FixedInt(player.runspeed)<=player.oshWallSpeed and player.dashmode <= 3*TICRATE then
- player.oshCurrentState = 15
- end
- if player.mo.state ~= 21 and player.dashmode > 3*TICRATE then
- player.oshCurrentState = 16
- end
- if player.mo.state == 21 then
- player.oshCurrentState = 21
- end
- if player.mo.state ~= 21 and player.oshCurrentState == 21 then
- player.oshCurrentState = 13
- end
- player.mo.state = player.oshCurrentState
- end
- --END OF THE WALL CRAWL--
- end
- end)
- addHook("PostThinkFrame", function()
- for player in players.iterate
- if player.jointime < 1 then
- else
- --IGNORE GROUND UPHILL SLOPES PART 2--
- if P_MobjFlip(player.mo)==1 then --If Gravity is normal--
- if player.mo.momz<=0 and player.oshSlopeThing == 1 then
- P_TeleportMove(player.mo,player.oshStoreX+FixedMul((player.mo.x-player.oshStoreX),cos(player.oshSlopeX)),player.oshStoreY+FixedMul((player.mo.y-player.oshStoreY),cos(player.oshSlopeY)),P_FloorzAtPos(player.oshStoreX+FixedMul((player.mo.x-player.oshStoreX),cos(player.oshSlopeX)),player.oshStoreY+FixedMul((player.mo.y-player.oshStoreY),cos(player.oshSlopeY)),player.mo.z+player.mo.height,player.mo.height))
- end
- else --If Gravity is flipped--
- if player.mo.momz>=0 and player.oshSlopeThing == 1 then
- P_TeleportMove(player.mo,player.oshStoreX+FixedMul((player.mo.x-player.oshStoreX),cos(player.oshSlopeX)),player.oshStoreY+FixedMul((player.mo.y-player.oshStoreY),cos(player.oshSlopeY)),P_CeilingzAtPos(player.oshStoreX+FixedMul((player.mo.x-player.oshStoreX),cos(player.oshSlopeX)),player.oshStoreY+FixedMul((player.mo.y-player.oshStoreY),cos(player.oshSlopeY)),player.mo.z,player.mo.height))
- end
- end
- --END OF IGNORE GROUND UPHILL SLOPES PART 2--
- if player.oshRunState == 2 then
- player.mo.state = player.oshCurrentState
- end
- --PRINTER SECTION--
- print ("Total Speed: "..FixedInt(player.oshTotMom))
- print ("On Ground: "..player.oshOnGround)
- -- print ("Run State: "..player.oshRunState)
- print ("Player Z: "..FixedInt(player.mo.z))
- print ("Ceiling Z: "..FixedInt(player.mo.ceilingz))
- print ("ToWallSlope: "..FixedInt(AngleFixed(player.oshCeilWallSlope)))
- --END OF PRINTER SECTION--
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement