Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addHook("ThinkFrame", do
- for player in players.iterate
- if player.mo
- //setting up variables
- //setting up prevz
- if player.mo.prevz == nil
- player.mo.prevz = 0
- end
- //setting up the check for our real speed
- player.rspeed = R_PointToDist2(0, 0, player.rmomx, player.rmomy)
- //print(player.rspeed/FRACUNIT, "speed", "", "")
- //setting up a check for conveyor speed
- player.conveyorspeed = R_PointToDist2(0, 0, player.cmomx, player.cmomy)
- //print(player.conveyorspeed/FRACUNIT, "CSPEED","","")
- //setting up default values for everyone to have
- if (player.mo.skin == "sonic")
- or (player.mo.skin == "fsonic")
- player.charability = CA_NONE
- if gametype ~= GT_COOP
- player.topspeed = 38*FRACUNIT
- else
- player.topspeed = 34*FRACUNIT
- end
- elseif (player.mo.skin == "tsonic") //Toei breaks counter: 1
- if (player.mo.toeipeel)
- player.thrustfactor = 0 //Just.... stop.
- player.jumpfactor = 0
- player.topspeed = 0
- player.normalspeed = 0
- player.mo.momx = 0
- player.mo.momy = 0
- player.accelstart = 0
- player.acceleration = 0
- else
- player.topspeed = skins[player.mo.skin].normalspeed // LET'S GET MOVING!
- player.jumpfactor = skins[player.mo.skin].jumpfactor
- end
- else
- player.topspeed = 34*FRACUNIT
- end
- player.maxspeed = 115*FRACUNIT //Because we can't just have Sonic zooming at an out-of-control speed
- /* ~TO DO~
- //Make an options screen to make certain aspects of this WAD togglable, akin to the level select in the Sonic 1/2 mobile ports.
- //Add abilities from other classic games for Sonic such as the Insta-Shield, My version of the Drop Dash script, the Super PeelOut (needs running animations) and possibly with Saph's permission, normal shields replaced with elemental shields.
- //Add support for Axis2D.
- //Possibly add in the air drag mechanic.
- //Possibly nerf slope acceleration in later versions when slopes become more widely used (I.E. closer to 2.2's release).
- */
- if not (player.mo.skin == "peach") //If you're not the exception, you're the rule
- and not (player.mo.skin == "toad")
- and not (player.mo.skin == "samus")
- and not (player.mo.skin == "marisa")
- and not (player.mo.skin == "alice")
- and not (player.mo.skin == "sonicrefancy")
- and not (player.mo.skin == "modernsonic")
- and not (player.mo.skin == "sonicre")
- and not (player.mo.skin == "tailsre")
- and not (player.mo.skin == "knuxre")
- and not (player.mo.skin == "silver")
- and not (player.mo.skin == "kirby")
- and not (player.isclassic == false)
- //Here's our base values for everyone, hopefully this is closer to Sonic 2/3's stats
- //KNOWN BUG: Running down ramp sectors will cause them to act like slopes
- //KNOWN BUG: Running on ice when changing sectors will sometimes cause the player to accelerate into infinity.
- //This also happens when running down slopes in Axis2D, I'll have to look at Axis2D's source code to figure out why this happens.
- //Breaking the vanilla speed cap
- if player.rspeed > player.topspeed //If the player is running faster than they can normally
- and not ((player.mo.eflags & MFE_JUSTHITFLOOR) and player.mo.friction != 59392)
- and not (player.mo.eflags & MFE_JUSTHITFLOOR)
- and (player.hasmomentum)
- and not (player.isclassic == false)
- and not (player.mo.skin == "dirk" and player.cmd.buttons & BT_USE)
- if not (player.powers[pw_sneakers])
- and not (player.powers[pw_super])
- if player.rspeed > player.normalspeed //If the player is going faster than their normalspeed
- and player.rspeed >= player.normalspeed - (6*FRACUNIT)
- and P_IsObjectOnGround(player.mo) //and the player is on the ground
- player.normalspeed = $1 + (player.rspeed - player.topspeed) + (6*FRACUNIT)
- elseif player.rspeed < player.normalspeed - 8*FRACUNIT
- player.normalspeed = $1 - 5*FRACUNIT
- end
- end
- elseif not (player.dashmode)
- player.normalspeed = player.topspeed
- end
- //Fixing slope physics slightly to play better with the new speed cap
- if player.mo.prevz > player.mo.z //if the player is going downhill
- and player.rspeed >= player.topspeed - 6*FRACUNIT //and the player is running as fast as they normally can
- and P_IsObjectOnGround(player.mo) //And the player is on the ground (kinda important)
- and player.rspeed < player.maxspeed //Don't accelerate if we're over max speed, this keeps control managable
- and (player.hasmomentum) //gives us support for other characters to utilize this
- and not (player.isclassic == false) //isclassic enables and disables the entire system
- player.normalspeed = player.prevnormspd + (((player.mo.prevz - player.mo.z)*2)/(player.normalspeed/FRACUNIT)) //MOAR SPED
- end
- //Experimental camera option that adjusts the camera up or down intended to depend on if you're running up or down a slope
- //Sadly, this also ends up messing with the camera when running up and down stairs which is unintended, thus why it defaults to off.
- if (cv_camadjust.value)
- if not (player.mo.eflags & MFE_JUSTHITFLOOR)
- and not (maptol & TOL_2D)
- and P_IsObjectOnGround(player.mo)
- COM_BufInsertText(player, "cam_height "..20+(((player.mo.prevz-player.mo.z)/FRACUNIT)*3))
- else
- COM_BufInsertText(player, "cam_height 20")
- end
- else
- end
- if (player.powers[pw_super]) //souped up acceleration for super players
- or (player.mo.skin == "metal_sonic") //metal sonic flies so he should have a bit more acceleration
- player.thrustfactor = 5
- else
- player.thrustfactor = 3
- end
- if not (player.mo.skin == "metal_sonic") //metal sonic does his own thing
- if not (player.mo.skin == "tsonic") //Toei breaks counter: 2
- player.runspeed = 24*FRACUNIT
- end
- player.accelstart = 178
- player.acceleration = 48
- end
- if player.spinitem == MT_THOK //unless you have a unique spintrail, you don't really need one
- player.spinitem = 0
- end
- if (player.classicanimations)
- player.revitem = 0
- end
- player.mo.prevz = player.mo.z
- player.prevnormspd = player.normalspeed
- //Buffing glide acceleration
- if player.charability == CA_GLIDEANDCLIMB
- and not P_IsObjectOnGround(player.mo)
- and player.pflags & PF_THOKKED
- and not (player.mo.state >= S_PLAY_CLIMB1 and player.mo.state <= S_PLAY_CLIMB5)
- if player.rspeed <= player.maxspeed/2
- player.actionspd = $+((player.glidetime^2)/20)
- end
- elseif not (player.mo.skin == "tsonic") //Toei breaks counter: 3
- player.actionspd = skins[player.mo.skin].actionspd
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement