Uncompile mQuake

This commit is contained in:
Agent X 2024-03-22 14:45:48 -04:00
parent fab85ec9cc
commit 57af112f37
22 changed files with 2690 additions and 3 deletions

View File

@ -0,0 +1,585 @@
if SM64COOPDX_VERSION == nil then
local first = false
hook_event(HOOK_ON_LEVEL_INIT, function()
if not first then
first = true
play_sound(SOUND_MENU_CAMERA_BUZZ, { x = 0, y = 0, z = 0 })
djui_chat_message_create("\\#ff7f7f\\mQuake is not supported with sm64ex-coop as it uses sm64coopdx exclusive Lua functionality.\n\\#dcdcdc\\To play this mod, try out sm64coopdx, at\n\\#7f7fff\\https://sm64coopdx.com")
end
end)
return
end
local play_sound,clampf,allocate_mario_action,set_mario_action,vec3f_add,math_floor,get_id_from_behavior,obj_get_first,vec3f_dist,obj_get_next,obj_is_valid_for_interaction = play_sound,clampf,allocate_mario_action,set_mario_action,vec3f_add,math.floor,get_id_from_behavior,obj_get_first,vec3f_dist,obj_get_next,obj_is_valid_for_interaction
gLevelValues.fixCollisionBugs = 1
gLevelValues.fixCollisionBugsFalseLedgeGrab = 1
gLevelValues.fixCollisionBugsGroundPoundBonks = 1
gLevelValues.fixCollisionBugsPickBestWall = 1
gLevelValues.fixCollisionBugsRoundedCorners = 1
gLevelValues.fixVanishFloors = 1
gServerSettings.stayInLevelAfterStar = 2
gServerSettings.bubbleDeath = 0
if (network_is_server()) then
gGlobalSyncTable.Convar_StickySlope = false
gGlobalSyncTable.Convar_Gravity = 800
gGlobalSyncTable.Convar_AirAccelerate = 10
gGlobalSyncTable.Convar_AirClamp = 30
gGlobalSyncTable.Convar_Accelerate = 10
gGlobalSyncTable.Convar_PlayerSpeed = 1.0
gGlobalSyncTable.Convar_PlayerFriction = 1.0
gGlobalSyncTable.Convar_PlayerJumpHeight = 1.0
gGlobalSyncTable.Convar_PlayerAllow_GroundPound = true
gGlobalSyncTable.Convar_PlayerAllow_WallJump = true
gGlobalSyncTable.Convar_PlayerAllow_Interact = true
sv_sticky = false
sv_maxspeed = 180
sv_maxspeed_crouch = 80
sv_maxspeed_water = 180
sv_playerspeed = 90
sv_playerspeed_water = 90
sv_playerspeed_water_shell = 300
sv_upspeed_water = 180
sv_playerspeed_crouch = 40
sv_airaccelerate_value = 10
sv_accelerate = 10
sv_playerclamp_air = 30
sv_gravity = 800
sv_waterfriction = 2.5
sv_friction = 4
sv_crouchfriction_scale = 0
sv_groundpound = true
sv_walljump = true
sv_interact = true
sv_jumpheight = 1.0
else
sv_sticky = nil
sv_maxspeed = 0
sv_maxspeed_crouch = 0
sv_maxspeed_water = 0
sv_maxvelocity = 0
sv_playerspeed = 0
sv_playerspeed_water = 0
sv_playerspeed_water_shell = 0
sv_upspeed_water = 0
sv_playerspeed_crouch = 0
sv_airaccelerate_value = 0
sv_accelerate = 0
sv_playerclamp_air = 0
sv_gravity = 0
sv_waterfriction = 0
sv_friction = 0
sv_crouchfriction_scale = 0
sv_groundpound = nil
sv_walljump = nil
sv_interact = nil
sv_jumpheight = nil
end
interactOverrides = {
[1]=function(m,o)end
}
throwOverrides = {
[1]=function(m,o)end
}
dropOverrides = {
[1]=function(m,o)end
}
sv_maxvelocity = 1200
sv_stopmovement = false
sv_playerheight = 160
sv_crouchoffset = 60
sv_playersubmergelevel = 100
sv_camerayoffset = 8
sv_stopspeed = 20
sv_tickrate = 1/30
sv_gravity_scale = 0.5
sv_gaccel_scale = 0.75
sv_physics_scale = 2
sv_scalerate_inverse = 4
sv_scalerate = 1 / sv_scalerate_inverse
phys_friction_scale = sv_gaccel_scale * sv_physics_scale
phys_airaccel_scale = 4
cl_grounddefacto = 1
cl_localangles = {forward={x=0,y=0,z=0},right={x=0,y=0,z=0},rawForward={x=0,y=0,z=0}}
cl_speedbuffer = {x=0,y=0,z=0}
cl_upwarpfix_vel = {x=0,y=0,z=0}
cl_upwarpfix_pos = {x=0,y=0,z=0}
cl_bowserthrow = false
cl_bowserthrow_previousYaw = 0
cl_interacttimer = 0
cl_red = 0
cl_footstepTimer = 0
cl_airstrafelimiter = 0
cl_poleY = -1
cl_disableAccelPred = mod_storage_load_bool("mq_accelpred")
cl_altWalljumpKey = mod_storage_load_bool("mq_altwallj")
cl_fov = mod_storage_load_number("mq_fov")
if (cl_fov < 40 or cl_fov == nil) then cl_fov = 90 end
-- Physics helpers
SurfaceStandableMinimum = {
[SURFACE_CLASS_NOT_SLIPPERY] = 0.01,
[SURFACE_HARD_NOT_SLIPPERY] = 0.01,
[SURFACE_CLASS_SLIPPERY] = 0.7,
[SURFACE_HARD_SLIPPERY] = 0.7,
[SURFACE_NO_CAM_COL_SLIPPERY] = 0.7,
[SURFACE_NOISE_SLIPPERY] = 0.7,
[SURFACE_SLIPPERY] = 0.7,
[SURFACE_CLASS_VERY_SLIPPERY] = 0.8,
[SURFACE_HARD_VERY_SLIPPERY] = 0.8,
[SURFACE_NO_CAM_COL_VERY_SLIPPERY] = 0.8,
[SURFACE_VERY_SLIPPERY] = 0.8,
[SURFACE_NOISE_VERY_SLIPPERY] = 0.8,
[SURFACE_NOISE_VERY_SLIPPERY_73] = 0.8,
[SURFACE_NOISE_VERY_SLIPPERY_74] = 0.8
}
SurfaceFriction = {
[SURFACE_CLASS_NOT_SLIPPERY] = 1.0,
[SURFACE_HARD_NOT_SLIPPERY] = 1.0,
[SURFACE_CLASS_SLIPPERY] = 0.8,
[SURFACE_HARD_SLIPPERY] = 0.8,
[SURFACE_NO_CAM_COL_SLIPPERY] = 0.8,
[SURFACE_NOISE_SLIPPERY] = 0.8,
[SURFACE_SLIPPERY] = 0.8,
[SURFACE_CLASS_VERY_SLIPPERY] = 0.4,
[SURFACE_HARD_VERY_SLIPPERY] = 0.4,
[SURFACE_NO_CAM_COL_VERY_SLIPPERY] = 0.4,
[SURFACE_VERY_SLIPPERY] = 0.4,
[SURFACE_NOISE_VERY_SLIPPERY] = 0.4,
[SURFACE_NOISE_VERY_SLIPPERY_73] = 0.4,
[SURFACE_NOISE_VERY_SLIPPERY_74] = 0.4
}
AreaTypeFriction = {
[TERRAIN_SLIDE] = 0.225, -- incase i wanna give other types different friction values
[TERRAIN_SNOW] = 0.90 -- incase i wanna give other types different friction values
}
AreaTypeStandable = {
[TERRAIN_SLIDE] = 2.75,
[TERRAIN_SNOW] = 1.10
}
local function SV_GetAreaFriction(type)
if AreaTypeFriction[type] ~= nil then return AreaTypeFriction[type] end
return 1.0
end
local function SV_GetAreaStandable(type)
if AreaTypeStandable[type] ~= nil then return AreaTypeStandable[type] end
return 1.0
end
function SV_GetSurfaceStandableMinimum(type,areaType)
areaFactor = SV_GetAreaStandable(areaType)
standableMinimum = 0.675
if SurfaceStandableMinimum[type] ~= nil then standableMinimum = SurfaceStandableMinimum[type] end
return clampf(standableMinimum * areaFactor,0.01,0.999)
end
function SV_GetSurfaceStandableFrictionMultiplier(type,areaType)
areaFactor = SV_GetAreaFriction(areaType)
standableMinimum = 1.0
if SurfaceFriction[type] ~= nil then standableMinimum = SurfaceFriction[type] end
return clampf(standableMinimum * areaFactor,0.01,1.0)
end
sv_gunmod_loaded = (_G.gunModApi ~= nil)
-- Actions
ACT_DM_GROUNDED_MOVEMENT = allocate_mario_action(ACT_FLAG_MOVING | ACT_FLAG_CUSTOM_ACTION)
ACT_DM_GROUNDED_IDLE = allocate_mario_action(ACT_FLAG_MOVING | ACT_FLAG_IDLE | ACT_FLAG_CUSTOM_ACTION) -- fix for reading signs while moving on accident
ACT_DM_AIR_MOVEMENT = allocate_mario_action(ACT_GROUP_AIRBORNE | ACT_FLAG_MOVING | ACT_FLAG_AIR | ACT_FLAG_CUSTOM_ACTION)
ACT_DM_GROUND_POUND_METAL = allocate_mario_action(ACT_GROUP_SUBMERGED | ACT_FLAG_ATTACKING | ACT_FLAG_MOVING | ACT_FLAG_CUSTOM_ACTION)
ACT_DM_GROUNDED_MOVEMENT_METAL = allocate_mario_action(ACT_GROUP_SUBMERGED | ACT_FLAG_MOVING | ACT_FLAG_WATER_OR_TEXT | ACT_FLAG_CUSTOM_ACTION)
ACT_DM_AIR_MOVEMENT_METAL = allocate_mario_action(ACT_GROUP_SUBMERGED | ACT_FLAG_MOVING | ACT_FLAG_WATER_OR_TEXT | ACT_FLAG_CUSTOM_ACTION)
ACT_DM_WATER_MOVEMENT = allocate_mario_action(ACT_GROUP_SUBMERGED | ACT_FLAG_MOVING | ACT_FLAG_WATER_OR_TEXT | ACT_FLAG_CUSTOM_ACTION)
ACT_DM_POLE_MOVEMENT = allocate_mario_action(ACT_GROUP_CUTSCENE | ACT_FLAG_MOVING | ACT_FLAG_CUSTOM_ACTION)
-- Action helpers
DM_ACTIONS = {
[ACT_DM_GROUNDED_MOVEMENT] = 1,
[ACT_DM_GROUNDED_IDLE] = 1,
[ACT_DM_AIR_MOVEMENT] = 1,
[ACT_DM_GROUNDED_MOVEMENT_METAL] = 1,
[ACT_DM_AIR_MOVEMENT_METAL] = 1,
[ACT_DM_WATER_MOVEMENT] = 1,
[ACT_DM_POLE_MOVEMENT] = 1,
[ACT_TORNADO_TWIRLING] = 1,
[ACT_DM_GROUND_POUND_METAL] = 1,
[ACT_ELECTROCUTION] = 1,
[ACT_QUICKSAND_DEATH] = 1,
[ACT_SHOCKED] = 1,
[ACT_GRABBED] = 1,
[ACT_UNINITIALIZED] = 1,
[ACT_PULLING_DOOR] = 1,
[ACT_PUSHING_DOOR] = 1,
[ACT_EMERGE_FROM_PIPE] = 1,
[ACT_ENTERING_STAR_DOOR] = 1,
[ACT_SUFFOCATION] = 1,
[ACT_PUTTING_ON_CAP] = 1,
[ACT_DEATH_EXIT] = 1,
[ACT_DEATH_EXIT_LAND] = 1,
[ACT_SQUISHED] = 1,
[ACT_IDLE] = 1,
[ACT_DISAPPEARED] = 1,
[ACT_EXIT_AIRBORNE] = 1,
[ACT_EXIT_LAND_SAVE_DIALOG] = 1,
[ACT_HARD_BACKWARD_GROUND_KB] = 1,
[ACT_FALLING_DEATH_EXIT] = 1,
[ACT_FALLING_EXIT_AIRBORNE] = 1,
[ACT_DEATH_ON_BACK] = 1,
[ACT_DEATH_ON_STOMACH] = 1,
[ACT_DROWNING] = 1,
[ACT_BURNING_JUMP] = 1,
[ACT_SPECIAL_DEATH_EXIT] = 1,
[ACT_SPECIAL_EXIT_AIRBORNE] = 1,
[ACT_IN_CANNON] = 1,
[ACT_SHOT_FROM_CANNON] = 1,
[ACT_WAITING_FOR_DIALOG] = 1,
[ACT_READING_AUTOMATIC_DIALOG] = 1,
[ACT_READING_NPC_DIALOG] = 1,
[ACT_READING_SIGN] = 1,
[ACT_GRAB_POLE_FAST] = 1,
[ACT_GRAB_POLE_SLOW] = 1,
[ACT_CLIMBING_POLE] = 1,
[ACT_READING_SIGN] = 1,
[ACT_HOLDING_POLE] = 1,
[ACT_TOP_OF_POLE] = 1,
[ACT_TOP_OF_POLE_JUMP] = 1,
[ACT_WALL_KICK_AIR] = 1,
[ACT_TOP_OF_POLE_TRANSITION] = 1,
[ACT_GROUND_POUND] = 1, -- if marios y vel is low enough and you press crouch in the air while not holding jump, ground pound
[ACT_GROUND_POUND_LAND] = 1, -- manually added, if this is detected we can do a ground pound jump :3
[ACT_STANDING_DEATH] = 1,
[ACT_INTRO_CUTSCENE] = 1,
[ACT_CREDITS_CUTSCENE] = 1,
[ACT_END_WAVING_CUTSCENE] = 1,
[ACT_END_PEACH_CUTSCENE] = 1,
[ACT_JUMBO_STAR_CUTSCENE] = 1,
-- [ACT_SPAWN_NO_SPIN_AIRBORNE] = 1,
[ACT_HOLDING_BOWSER] = 1,
-- [ACT_SPAWN_SPIN_AIRBORNE] = 1,
[ACT_CRAZY_BOX_BOUNCE] = 1,
[ACT_BBH_ENTER_JUMP] = 1,
[ACT_BBH_ENTER_SPIN] = 1,
[ACT_THROWN_FORWARD] = 1,
[ACT_THROWN_BACKWARD] = 1,
[ACT_GETTING_BLOWN] = 1,
[ACT_TELEPORT_FADE_IN] = 1,
[ACT_TELEPORT_FADE_OUT] = 1
}
DM_ACTIONS_CROUCHAIR = {
[ACT_DM_AIR_MOVEMENT] = 1,
[ACT_DM_AIR_MOVEMENT_METAL] = 1,
[ACT_GROUND_POUND] = 1,
[ACT_DM_GROUND_POUND_METAL] = 1
}
DM_ACTIONS_ALLOWGRAB = {
[ACT_DM_GROUNDED_MOVEMENT] = 1,
[ACT_DM_GROUNDED_IDLE] = 1,
[ACT_DM_AIR_MOVEMENT] = 1,
[ACT_DM_GROUNDED_MOVEMENT_METAL] = 1,
[ACT_DM_AIR_MOVEMENT_METAL] = 1,
[ACT_DM_WATER_MOVEMENT] = 1,
[ACT_GROUND_POUND] = 1,
[ACT_DM_GROUND_POUND_METAL] = 1,
[ACT_GROUND_POUND_LAND] = 1
}
DM_ACTION_QPHYS = {
[ACT_DM_GROUNDED_MOVEMENT] = 1,
[ACT_DM_GROUNDED_IDLE] = 1,
[ACT_DM_AIR_MOVEMENT] = 1,
[ACT_DM_GROUNDED_MOVEMENT_METAL] = 1,
[ACT_DM_AIR_MOVEMENT_METAL] = 1,
[ACT_DM_WATER_MOVEMENT] = 1,
[ACT_GROUND_POUND] = 1,
[ACT_DM_GROUND_POUND_METAL] = 1,
[ACT_DM_POLE_MOVEMENT] = 1
}
DM_ACTION_DONT_OVERRIDE_FP = {}
DM_ACTION_FORCEANGLE = {
[ACT_GRAB_POLE_FAST] = 1,
[ACT_GRAB_POLE_SLOW] = 1,
[ACT_CLIMBING_POLE] = 1,
[ACT_HOLDING_POLE] = 1,
[ACT_TOP_OF_POLE] = 1
}
DM_ACTION_TRANSFERS = {
[ACT_TOP_OF_POLE_JUMP] = 1,
[ACT_WALL_KICK_AIR] = 1
}
DM_ACTION_PREFUNCS = {
[ACT_BURNING_JUMP] = function(m)
m.hurtCounter = 8
m.invincTimer = 10
-- if (m == gMarioStates[0]) then
gLakituState.roll = 1000
gLakituState.oldRoll = gLakituState.roll
cl_red = 128
-- end
return 1
end,
[ACT_IDLE] = function(m)
if (m.prevAction ~= ACT_SHOCKED) then SV_PlayerMovement_Store(m,true) end
end,
[ACT_WATER_PLUNGE] = function(m)
if (m.prevAction ~= ACT_IDLE) then SV_PlayerMovement_Store(m,true) end
end,
[ACT_TORNADO_TWIRLING] = function(m)
m.vel.y = m.vel.y + 14 ; if (m.vel.y > 400) then m.vel.y = 400 end
return 1
end,
[ACT_SHOCKED] = function(m)
SV_PlayerMovement_Store(m,true)
m.vel.y = m.vel.y * sv_scalerate
end,
[ACT_DEATH_ON_BACK] = function(m)
gFirstPersonCamera.offset.y = -110
gLakituState.roll = 0
m.invincTimer = 0
cl_red = 192
end,
[ACT_DEATH_ON_STOMACH] = function(m)
gFirstPersonCamera.offset.y = -110
gLakituState.roll = 0
m.invincTimer = 0
cl_red = 192
end,
[ACT_STANDING_DEATH] = function(m)
gFirstPersonCamera.offset.y = -110
gLakituState.roll = 0
m.invincTimer = 0
cl_red = 192
end,
[ACT_SUFFOCATION] = function(m)
gFirstPersonCamera.offset.y = -110
gLakituState.roll = 0
m.invincTimer = 0
cl_red = 192
end,
[ACT_DROWNING] = function(m)
gFirstPersonCamera.offset.y = -110
gLakituState.roll = 0
m.invincTimer = 0
cl_red = 192
end,
[ACT_ELECTROCUTION] = function(m)
gFirstPersonCamera.offset.y = -110
gLakituState.roll = 0
m.invincTimer = 0
cl_red = 192
end,
[ACT_TELEPORT_FADE_OUT] = function(m)
m.vel.x = 0
m.vel.y = 0
m.vel.z = 0
m.forwardVel = 0
end,
[ACT_ELECTROCUTION] = function(m)
gFirstPersonCamera.offset.y = -110
gLakituState.roll = 0
m.invincTimer = 0
cl_red = 192
end,
[ACT_QUICKSAND_DEATH] = function(m)
gFirstPersonCamera.offset.y = -110
gLakituState.roll = 0
m.invincTimer = 0
cl_red = 192
end
}
DM_ACTION_PREFUNCS_ALL = {
[ACT_STAR_DANCE_EXIT] = function(m)
return 1
end
}
DM_ACTION_FUNCTIONS = {
[ACT_HARD_BACKWARD_GROUND_KB] = function(m)
if (m.prevAction == ACT_SPECIAL_DEATH_EXIT) then m.healCounter = 32 end
set_mario_action(m, ACT_DM_GROUNDED_MOVEMENT, 0)
end,
[ACT_DEATH_EXIT_LAND] = function(m)
m.healCounter = 32
set_mario_action(m, ACT_DM_GROUNDED_MOVEMENT, 0)
end,
[ACT_IDLE] = function(m)
set_mario_action(m, ifelse(m.pos.y <= m.waterLevel-sv_playersubmergelevel,ifelse((m.flags & MARIO_METAL_CAP) ~= 0,ACT_DM_AIR_MOVEMENT_METAL,ACT_DM_WATER_MOVEMENT),ACT_DM_AIR_MOVEMENT), 0)
end,
[ACT_WATER_PLUNGE] = function(m)
set_mario_action(m, ifelse((m.flags & MARIO_METAL_CAP) ~= 0,ACT_DM_AIR_MOVEMENT_METAL,ACT_DM_WATER_MOVEMENT), 0)
end,
[ACT_GETTING_BLOWN] = function(m)
cl_airstrafelimiter = clampf(cl_airstrafelimiter + 0.256,0,2.5)
vec3f_add(m.vel,{x=-coss(m.faceAngle.y)*75,y=50,z=-sins(m.faceAngle.y)*75})
set_mario_action(m, ACT_DM_AIR_MOVEMENT, 0)
end,
[ACT_DM_WATER_MOVEMENT] = function(m)
if (m.prevAction == ACT_WATER_PLUNGE or m.prevAction == ACT_IDLE or m.prevAction == ACT_IDLE) then SV_PlayerMovement_Store(m,false) end
end
}
--- General helper functions
function ifelse(a,b,c)
if (a) then return b else return c end
end
function vec3_invert(a)
_x = a.x * -1.0
_y = a.y * -1.0
_z = a.z * -1.0
return {x=_x,y=_y,z=_z}
end
function vec3_qscale(a,b,c,d)
_x = a.x * b
_y = a.y * c
_z = a.z * d
return {x=_x,y=_y,z=_z}
end
function vec3_scale(a,b)
_x = a.x * b
_y = a.y * b
_z = a.z * b
return {x=_x,y=_y,z=_z}
end
function s16(num)
num = math.floor(num) & 0xFFFF
if num >= 32768 then return num - 65536 end
return num
end
function mario_holding_underwater_shell(m) -- direction is true then we're checking a small range behind, otherwise we're checking the inverse of that range
if (m.heldObj == nil) then return false end
return get_id_from_behavior(m.heldObj.behavior) == id_bhvKoopaShellUnderwater
end
function mario_is_within_object_angles(m, o, range, direction) -- direction is true then we're checking a small range behind, otherwise we're checking the inverse of that range
local dx = o.oPosX - m.pos.x
local dz = o.oPosZ - m.pos.z
local dYaw = s16(o.oMoveAngleYaw - atan2s(dz, dx))
if (dYaw >= -range and dYaw <= range) then
return direction
else
return not direction
end
end
function should_push_or_pull_door(m, o)
local dx = o.oPosX - m.pos.x
local dz = o.oPosZ - m.pos.z
local dYaw = s16(o.oMoveAngleYaw - atan2s(dz, dx))
if (dYaw >= -0x4000 and dYaw <= 0x4000) then
return 0x00000001
else
return 0x00000002
end
end
function get_object_closest_to_point(type,point)
local closestObj = nil
local obj = obj_get_first(type)
local minDist = 0x20000
while obj ~= nil do
local objDist = vec3f_dist({x=obj.oPosX,y=obj.oPosY,z=obj.oPosZ}, point)
if objDist < minDist then
local rad = obj.hitboxRadius+16
local hei = obj.hitboxHeight+16
if (vec3f_dist({x=obj.oPosX,y=0,z=obj.oPosZ}, {x=point.x,y=0,z=point.z}) <= rad and point.y >= obj.oPosY and point.y <= obj.oPosY+hei) then
closestObj = obj
minDist = objDist
end
end
obj = obj_get_next(obj)
end
return closestObj
end
ObjectLists = {
[0] = OBJ_LIST_PLAYER,
[1] = OBJ_LIST_DESTRUCTIVE,
[2] = OBJ_LIST_GENACTOR,
[3] = OBJ_LIST_PUSHABLE,
[4] = OBJ_LIST_LEVEL,
[5] = OBJ_LIST_DEFAULT,
[6] = OBJ_LIST_SURFACE,
[7] = OBJ_LIST_POLELIKE,
[8] = OBJ_LIST_SPAWNER,
[9] = OBJ_LIST_UNIMPORTANT
}
ObjectHeightAddon = {
[id_bhvPokey] = 30,
[id_bhvPokeyBodyPart] = 50,
[id_bhvGoomba] = 30,
[id_bhvSmallBully] = 30,
[id_bhvBobomb] = 30,
[id_bhvBigBully] = 50,
[id_bhvBigChillBully] = 50,
[id_bhvBobombBuddy] = 50,
[id_bhvMips] = 30,
[id_bhvBoo] = 30,
[id_bhvDoor] = 50,
[id_bhvDoorWarp] = 50,
[id_bhvStarDoor] = 50,
[id_bhvBowser] = 80,
[id_bhvKingBobomb] = 120,
[id_bhvChuckya] = 120,
}
function get_any_object_closest_to_point(point)
local lastList = 0
local closestObj = nil
local obj = obj_get_first(ObjectLists[lastList])
local minDist = 0x20000
while obj ~= nil do
if (obj_is_valid_for_interaction(obj)) then
local objDist = vec3f_dist({x=obj.oPosX,y=obj.oPosY,z=obj.oPosZ}, point)
if objDist < minDist then
local offset = ObjectHeightAddon[get_id_from_behavior(obj.behavior)] ; if offset == nil then offset = 0 end
local rad = obj.hitboxRadius+16
local hei = obj.hitboxHeight+16+offset
if (vec3f_dist({x=obj.oPosX,y=0,z=obj.oPosZ}, {x=point.x,y=0,z=point.z}) <= rad and point.y >= obj.oPosY and point.y <= obj.oPosY+hei) then
closestObj = obj
minDist = objDist
end
end
end
local nextObj = obj_get_next(obj)
if (nextObj == nil) then
while nextObj == nil and lastList < 9 do
lastList = lastList + 1
nextObj = obj_get_first(ObjectLists[lastList])
end
end
obj = nextObj
end
return closestObj
end

View File

@ -0,0 +1,370 @@
if SM64COOPDX_VERSION == nil then return end
local collision_find_surface_on_ray,vec3f_dist,vec3f_sub,vec3f_dot,vec3f_project,vec3f_add,vec3f_copy,level_trigger_warp,vec3f_length,clampf,is_game_paused,vec3f_normalize,vec3f_mul = collision_find_surface_on_ray,vec3f_dist,vec3f_sub,vec3f_dot,vec3f_project,vec3f_add,vec3f_copy,level_trigger_warp,vec3f_length,clampf,is_game_paused,vec3f_normalize,vec3f_mul
-- Helper functions
-- Replaced with simplified quake code
function PHYS_CollideWithNormal(vel,norm,bounceFactor)
local backoff = vec3f_dot(vel,norm) * (1.0+bounceFactor)
return {x=vel.x-(norm.x*backoff),y=vel.y-(norm.y*backoff),z=vel.z-(norm.z*backoff)}
end
SV_PlayerMovement_Scale = function(m,prescaled)
-- if (m.playerIndex ~= 0) then return end
if (sv_stopmovement) then return end
if (prescaled) then
m.vel.x = cl_speedbuffer.x
m.vel.y = cl_speedbuffer.y
m.vel.z = cl_speedbuffer.z
else
cl_speedbuffer.x = m.vel.x
cl_speedbuffer.y = m.vel.y
cl_speedbuffer.z = m.vel.z
m.vel.x = m.vel.x * sv_scalerate
m.vel.y = m.vel.y * sv_scalerate
m.vel.z = m.vel.z * sv_scalerate
end
end
function SV_PlayerMovement_Store(m,store)
if (m.playerIndex == 0) then
if (store) then
vec3f_copy(cl_upwarpfix_vel,m.vel)
vec3f_copy(cl_upwarpfix_pos,m.pos)
else
vec3f_copy(m.vel,cl_upwarpfix_vel)
vec3f_copy(m.pos,cl_upwarpfix_pos)
end
end
end
function SV_PlayerMovement_Relative(m)
-- if (m.playerIndex ~= 0) then return end
local obj = m.marioObj.platform
if (obj ~= nil) then
m.vel.y = m.vel.y + (obj.oVelY*4)
end
end
function SV_HandleSpecialFloors(m,bypassFloorCheck)
if (m.floor ~= nil) then
local type = m.floor.type
if (type == SURFACE_VERTICAL_WIND) then
m.vel.y = m.vel.y + 18
if (m.vel.y < -24) then
m.vel.y = -24
end
if (m.vel.y > 200) then
m.vel.y = 200
end
return true
end
if (type == SURFACE_HORIZONTAL_WIND and DM_ACTION_QPHYS[m.action] == 1) then
local pushAngle = m.floor.force << 8;
local amt = ifelse((m.action & ACT_FLAG_AIR) == 0,48,8)
m.vel.x = m.vel.x + (amt * sins(pushAngle))
m.vel.z = m.vel.z + (amt * coss(pushAngle))
return true
end
if (type == SURFACE_DEATH_PLANE or type == SURFACE_VERTICAL_WIND) and (m.pos.y < m.floorHeight + 2048) then
if (level_trigger_warp(m, WARP_OP_WARP_FLOOR) == 20 and (m.flags & MARIO_UNKNOWN_18) ~= 0) then
return true
end
end
if (type == SURFACE_BURNING) and (m.invincTimer == 0) and ((m.flags & MARIO_METAL_CAP == 0) and (((m.action & ACT_FLAG_AIR) == 0 and (m.input & INPUT_OFF_FLOOR) == 0) or bypassFloorCheck)) then
m.hurtCounter = 8
m.invincTimer = 15
cl_red = 128
end
if (type == SURFACE_INSTANT_QUICKSAND or type == SURFACE_INSTANT_MOVING_QUICKSAND) and (m.invincTimer == 0) and ((m.flags & MARIO_METAL_CAP == 0) and (((m.action & ACT_FLAG_AIR) == 0 and (m.input & INPUT_OFF_FLOOR) == 0) or bypassFloorCheck)) then
m.hurtCounter = 4
m.invincTimer = 10
cl_red = 128
end
end
return false
end
-- Player angle system
frameCalculatedAngles = false
local frameAngles = {}
function GetAngleVectors(m)
local s = gPlayerSyncTable[m.playerIndex]
local yaw = gFirstPersonCamera.yaw+0x8000
local pitch = -gFirstPersonCamera.pitch
if (m.playerIndex == 0) then
s.playerYaw = yaw
s.playerPitch = pitch
if (frameCalculatedAngles) then return frameAngles end
frameCalculatedAngles = true
else
yaw = s.playerYaw
pitch = s.playerPitch
end
local sinYaw = sins(yaw)
local cosYaw = coss(yaw)
local yawRight = yaw-0x4000
local cosYawRight = coss(yawRight)
local sinYawRight = sins(yawRight)
local cosPitch = coss(pitch)
local sinPitch = sins(pitch)
local _rawForward = {x=sinYaw*cosPitch,y=sinPitch,z=cosYaw*cosPitch} -- variable used this name, prevent old code from breaking; todo, rewrite?
local _forward = {x=sinYaw,y=0,z=cosYaw}
local _right = {x=sinYawRight,y=0,z=cosYawRight}
local returnValue = {
rawForward=_rawForward,
forward=_forward,
right=_right
}
if (m.playerIndex == 0) then
frameAngles = returnValue
end
return returnValue
end
-- Important Functions
-- Acceleration / Friction
function SV_UserFriction(m)
-- if (m.playerIndex ~= 0) then return end
local speed = vec3f_length(m.vel)
if (speed <= 0.00001) then return end
local friction = ((sv_friction*phys_friction_scale)+ifelse(gPlayerSyncTable[m.playerIndex].playerCrouching,sv_crouchfriction_scale,0))*SV_GetSurfaceStandableFrictionMultiplier(m.floor.type,m.area.terrainType)
local control = nil
if (speed <= sv_stopspeed) then
control = sv_stopspeed
else
control = speed
end
local newspeed = speed - sv_tickrate*control*friction
if (newspeed < 0) then newspeed = 0 end
if (newspeed > 0) then
newspeed = newspeed / speed
end
m.vel.x = m.vel.x * newspeed
m.vel.y = m.vel.y * newspeed
m.vel.z = m.vel.z * newspeed
end
-- Acceleration / Friction
function SV_UserGravity(m,scale)
m.vel.y = m.vel.y - (sv_gravity * sv_tickrate * scale * sv_gravity_scale)
if (m.vel.y < -sv_gravity) then m.vel.y = -sv_gravity end
end
function SV_UserGravityEx(m,scale,minovr)
m.vel.y = m.vel.y - (sv_gravity * sv_tickrate * scale * sv_gravity_scale)
if (m.vel.y < -sv_gravity*minovr) then m.vel.y = -sv_gravity*minovr end
end
function SV_Accelerate(m,wishDir,wishspeed)
-- if (m.playerIndex ~= 0) then return end
local addspeed,accelspeed,currentspeed = 0,0,0
currentspeed = vec3f_dot(m.vel,wishDir)
addspeed = wishspeed - currentspeed
if (addspeed <= 0) then return end
accelspeed = sv_accelerate * wishspeed * sv_tickrate
if (accelspeed > addspeed) then accelspeed = addspeed end
m.vel.x = m.vel.x + (accelspeed * wishDir.x)
m.vel.y = m.vel.y + (accelspeed * wishDir.y)
m.vel.z = m.vel.z + (accelspeed * wishDir.z)
end
function SV_AirAccelerate(m,wishDir,wishspeed)
-- Limiter code for wallkicks
local airLimiter_Frac = (1.0-clampf(cl_airstrafelimiter,0.0,1.0))
local addspeed,wishspd,accelspeed,currentspeed = 0,0,0,0
wishspd = wishspeed*airLimiter_Frac
-- Checks for a lack of acceleration
if (wishspeed == 0) then return end
if (wishspd > sv_playerclamp_air) then wishspd = sv_playerclamp_air end -- This is 30 in source, quake and other games
currentspeed = vec3f_dot(m.vel,wishDir)
addspeed = wishspd - currentspeed
if (addspeed <= 0) then return end
accelspeed = (sv_airaccelerate_value * phys_airaccel_scale) * (wishspd * airLimiter_Frac) * sv_tickrate
if (accelspeed > addspeed) then accelspeed = addspeed end
m.vel.x = m.vel.x + ((accelspeed * wishDir.x)*airLimiter_Frac)
m.vel.y = m.vel.y + ((accelspeed * wishDir.y)*airLimiter_Frac)
m.vel.z = m.vel.z + ((accelspeed * wishDir.z)*airLimiter_Frac)
end
-- Main movement functions
function SV_PlayerMovement(m)
-- if (m.playerIndex ~= 0) then return end
if (sv_stopmovement) then return end
local isPrediction = m.playerIndex ~= 0
-- if (isPrediction) then return end
local crouch = gPlayerSyncTable[m.playerIndex].playerCrouching
local playerSpeed = ifelse(crouch,sv_playerspeed_crouch,sv_playerspeed)
local maxSpeed = ifelse(crouch,sv_maxspeed_crouch,sv_maxspeed)
local vecInput = {x=0,y=0,z=0}
if ((not is_game_paused()) and m.health > 0xFF and not cl_bowserthrow and not cl_bowserthrow and not (not no_dialog_open() and not isPrediction)) then
vecInput.x = m.controller.rawStickX
vecInput.y = m.controller.rawStickY
end
if (not isPrediction) then
vec3f_normalize(vecInput)
vec3f_mul(vecInput,m.controller.stickMag)
end
local fmove = (vecInput.y/32)*playerSpeed -- what are the maximums of these again?
local smove = (vecInput.x/32)*playerSpeed
-- local fmove = (vecInput.y/64)*playerSpeed -- what are the maximums of these again?
-- local smove = (vecInput.x/64)*playerSpeed
local wishVel = {x=0,y=0,z=0}
local wishDir = {x=0,y=0,z=0}
local AngledVectors = GetAngleVectors(m)
wishVel.x = (AngledVectors.forward.x * fmove) + (AngledVectors.right.x * smove)
wishVel.y = (AngledVectors.forward.y * fmove) + (AngledVectors.right.y * smove)
wishVel.z = (AngledVectors.forward.z * fmove) + (AngledVectors.right.z * smove)
if (not isPrediction) then
if (m.action == ACT_DM_GROUNDED_MOVEMENT or m.action == ACT_DM_GROUNDED_MOVEMENT_METAL or m.action == ACT_DM_GROUNDED_IDLE) then
wishVel.y = 0
if (m.floor ~= nil) then
local tempNormal = vec3_invert(m.floor.normal)
tempNormal.y = 0 ; vec3f_normalize(tempNormal)
local amount = (cl_grounddefacto * clampf(vec3f_dot(wishVel,tempNormal),0,1)) * m.floor.normal.y
vec3f_sub(wishVel,vec3_scale(vec3f_project(wishVel, m.floor.normal), amount))
vec3f_add(wishVel,vec3_scale(m.floor.normal, amount*0.125))
end
end
end
local wishspeed = vec3f_length(wishVel)
vec3f_copy(wishDir, wishVel)
vec3f_normalize(wishDir)
if wishspeed > maxSpeed then
wishVel.x = wishVel.x * (maxSpeed / wishspeed)
wishVel.y = wishVel.y * (maxSpeed / wishspeed)
wishVel.z = wishVel.z * (maxSpeed / wishspeed)
wishspeed = maxSpeed
end
if (m.action == ACT_DM_GROUNDED_MOVEMENT or m.action == ACT_DM_GROUNDED_MOVEMENT_METAL or m.action == ACT_DM_GROUNDED_IDLE) then
SV_UserFriction(m,wishDir,wishspeed)
SV_Accelerate(m,wishDir,wishspeed)
elseif (m.action == ACT_DM_AIR_MOVEMENT or m.action == ACT_DM_AIR_MOVEMENT_METAL) then
SV_AirAccelerate(m,wishDir,wishspeed)
end
local finalVelLen = vec3f_length(m.vel)
if finalVelLen > sv_maxvelocity then
m.vel.x = m.vel.x * (sv_maxvelocity / finalVelLen)
m.vel.y = m.vel.y * (sv_maxvelocity / finalVelLen)
m.vel.z = m.vel.z * (sv_maxvelocity / finalVelLen)
end
end
function SV_WaterMovement(m)
-- if (m.playerIndex ~= 0) then return end
if (sv_stopmovement) then return end
local isPrediction = m.playerIndex ~= 0
local shellSpeed = mario_holding_underwater_shell(m)
local playerSpeed = ifelse(shellSpeed,sv_playerspeed_water_shell,sv_playerspeed_water)
local vecInput = {x=0,y=0,z=0}
if ((not is_game_paused()) and m.health > 0xFF) then
vecInput.x = m.controller.rawStickX
vecInput.y = m.controller.rawStickY
end
if (not isPrediction) then
vec3f_normalize(vecInput)
vec3f_mul(vecInput,m.controller.stickMag)
end
local fmove = (vecInput.y/32)*playerSpeed
local smove = (vecInput.x/32)*playerSpeed
local umove = 0
if (m.controller.buttonDown & A_BUTTON ~= 0) then umove = umove+1 end
if (m.controller.buttonDown & Z_TRIG ~= 0) then umove = umove-1 end
local wishVel = {x=0,y=0,z=0}
local AngledVectors = GetAngleVectors(m)
wishVel.x = (AngledVectors.rawForward.x * fmove) + (AngledVectors.right.x * smove)
wishVel.y = (AngledVectors.rawForward.y * fmove) + (AngledVectors.right.y * smove)
wishVel.z = (AngledVectors.rawForward.z * fmove) + (AngledVectors.right.z * smove)
if (fmove < 0.1 and smove < 0.1 and umove == 0) then
wishVel.y = wishVel.y - 30
else
wishVel.y = wishVel.y + sv_upspeed_water * umove
end
local wishspeed = vec3f_length(wishVel)
local maxspeed = ifelse(shellSpeed,sv_playerspeed_water_shell,sv_maxspeed_water)
if (wishspeed > maxspeed) then
vec3f_mul(wishVel,maxspeed/wishspeed)
wishspeed = maxspeed
end
wishspeed = wishspeed * 0.85
--
-- water friction
--
local speed = vec3f_length(m.vel)
local newspeed = 0
if (speed > 0.00001) then
newspeed = speed - sv_tickrate * speed * sv_waterfriction
if (newspeed < 0) then newspeed = 0 end
vec3f_mul(m.vel,newspeed/speed)
end
--
-- water acceleration
--
if (wishspeed < 0.00001) then return end
local addspeed = wishspeed - newspeed
if (addspeed <= 0) then return end
vec3f_normalize(wishVel)
local accelspeed = (sv_accelerate * wishspeed) * sv_tickrate
if (accelspeed > addspeed) then accelspeed = addspeed end
m.vel.x = m.vel.x + (accelspeed * wishVel.x)
m.vel.y = m.vel.y + (accelspeed * wishVel.y)
m.vel.z = m.vel.z + (accelspeed * wishVel.z)
end

View File

@ -0,0 +1,313 @@
if SM64COOPDX_VERSION == nil then return end
local get_dialog_box_state,get_dialog_id,disable_time_stop,save_file_get_flags,get_id_from_behavior,save_file_get_total_star_count,get_current_save_file_num,max,level_trigger_warp,obj_is_attackable,obj_is_breakable_object,obj_is_bully,obj_is_exclamation_box,bhv_spawn_star_no_level_exit,mario_drop_held_object,absf_2,clampf,set_mario_action,vec3f_add,mario_grab_used_object,mario_throw_held_object,play_character_sound,obj_is_grabbable,play_sound = get_dialog_box_state,get_dialog_id,disable_time_stop,save_file_get_flags,get_id_from_behavior,save_file_get_total_star_count,get_current_save_file_num,max,level_trigger_warp,obj_is_attackable,obj_is_breakable_object,obj_is_bully,obj_is_exclamation_box,bhv_spawn_star_no_level_exit,mario_drop_held_object,absf_2,clampf,set_mario_action,vec3f_add,mario_grab_used_object,mario_throw_held_object,play_character_sound,obj_is_grabbable,play_sound
cutsceneActns = {
[ACT_WAITING_FOR_DIALOG] = 1,
[ACT_READING_AUTOMATIC_DIALOG] = 1,
[ACT_READING_NPC_DIALOG] = 1,
[ACT_READING_SIGN] = 1,
[ACT_INTRO_CUTSCENE] = 1,
[ACT_JUMBO_STAR_CUTSCENE] = 1,
[ACT_CREDITS_CUTSCENE] = 1,
[ACT_END_WAVING_CUTSCENE] = 1,
[ACT_IN_CANNON] = 1,
[ACT_SPAWN_NO_SPIN_AIRBORNE] = 1,
[ACT_SPAWN_SPIN_AIRBORNE] = 1,
[ACT_SHOT_FROM_CANNON] = 1,
[ACT_END_PEACH_CUTSCENE] = 1
}
function obj_activate_door(m,door,bhv)
if (m.action == ACT_DM_WATER_MOVEMENT) then return false end
if door ~= nil then
local flags = save_file_get_flags()
-- local bhv = get_id_from_behavior(door)
if bhv == id_bhvDoor then
local doorStars = door.oBehParams >> 24
if (doorStars <= save_file_get_total_star_count(get_current_save_file_num()-1,0,255)) then
door.oAction = 1
door.header.gfx.animInfo.animFrame = max(door.header.gfx.animInfo.animFrame, 25)
end
return true
elseif bhv == id_bhvDoorWarp then
local wDoorID = door.oBehParams >> 24
if (wDoorID == 1 and (flags & SAVE_FLAG_UNLOCKED_UPSTAIRS_DOOR) == 0) then
return true
end
if (wDoorID == 2 and (flags & SAVE_FLAG_UNLOCKED_BASEMENT_DOOR) == 0) then
return true
end
door.oAction = 2
door.header.gfx.animInfo.animFrame = max(door.header.gfx.animInfo.animFrame, 10)
m.interactObj = door
m.usedObj = door
m.actionArg = should_push_or_pull_door(m, door)
level_trigger_warp(m, WARP_OP_WARP_DOOR)
return true
elseif (not obj_is_attackable(door)) and (not obj_is_breakable_object(door)) and (not obj_is_bully(door)) and (not obj_is_exclamation_box(door)) and (not obj_is_attackable(door)) and door.oAction == 0 then
local doorStars = door.oBehParams >> 24
if (doorStars <= save_file_get_total_star_count(get_current_save_file_num()-1,0,255)) then
door.oInteractStatus = 0x00010000
end
end
end
return false
end
function obj_is_toad(m,toad,bhv)
if (m.action == ACT_DM_WATER_MOVEMENT) then return false end
if toad ~= nil and bhv == id_bhvToadMessage then
local stars = save_file_get_total_star_count(get_current_save_file_num()-1,0,255)
if (toad.oToadMessageDialogId == gBehaviorValues.dialogs.ToadStar1Dialog and stars >= gBehaviorValues.ToadStar1Requirement) then
toad.oToadMessageDialogId = gBehaviorValues.dialogs.ToadStar1AfterDialog;
bhv_spawn_star_no_level_exit(m.marioObj, 0, true);
return true
end
if (toad.oToadMessageDialogId == gBehaviorValues.dialogs.ToadStar2Dialog and stars >= gBehaviorValues.ToadStar2Requirement) then
toad.oToadMessageDialogId = gBehaviorValues.dialogs.ToadStar2AfterDialog;
bhv_spawn_star_no_level_exit(m.marioObj, 1, true);
return true
end
if (toad.oToadMessageDialogId == gBehaviorValues.dialogs.ToadStar3Dialog and stars >= gBehaviorValues.ToadStar3Requirement) then
toad.oToadMessageDialogId = gBehaviorValues.dialogs.ToadStar3AfterDialog;
bhv_spawn_star_no_level_exit(m.marioObj, 2, true);
return true
end
return true
end
return false
end
function held_obj_update(m)
local obj = m.heldObj
local bhv = get_id_from_behavior(obj.behavior)
if (bhv == id_bhvBobomb) then
if (obj.oBobombFuseTimer >= 151) then
mario_drop_held_object(m)
end
end
if (bhv == id_bhvKoopaShellUnderwater) then
if (obj.oTimer >= 601 or m.action ~= ACT_DM_WATER_MOVEMENT) then
mario_drop_held_object(m)
end
obj.oTimer = obj.oTimer + 1
end
end
function mario_throw_object_ext(m,ang)
local obj = m.heldObj
local bhv = get_id_from_behavior(obj.behavior)
if (bhv == id_bhvBowser and cl_bowserthrow) then
local curFaceAngle = m.faceAngle.y
m.faceAngle.y = m.area.camera.yaw + 0x8000
mario_drop_held_object(m)
obj.oPosX = m.marioBodyState.heldObjLastPosition.x
obj.oPosY = m.marioBodyState.heldObjLastPosition.y
obj.oPosZ = m.marioBodyState.heldObjLastPosition.z
-- Todo ; How do we fix this shit maintaining the velocity?
m.marioObj.oAngleVelYaw = 0
m.marioObj.oMoveAnglePitch = 0
obj.oForwardVel = 0
obj.oVelY = 0
obj.oBowserHeldAngleVelYaw = clampf(absf_2(s16(cl_bowserthrow_previousYaw-curFaceAngle)),0x10,0x1000)
obj.oBowserHeldAnglePitch = clampf(-absf_2(s16(cl_bowserthrow_previousYaw-curFaceAngle)),-0x1000,-0x400)
network_send_object(obj,true)
return true
end
if (bhv == id_bhvJumpingBox) then
mario_drop_held_object(m)
set_mario_action(m, ACT_DM_AIR_MOVEMENT, 0)
vec3f_add(m.vel,vec3_scale(ang.forward,300))
vec3f_add(m.vel,{x=0,y=500,z=0})
obj.oPosX = m.pos.x
obj.oPosY = m.pos.y
obj.oPosZ = m.pos.z
return true
end
return false
end
function mario_drop_object_ext(m,ang)
local obj = m.heldObj
local bhv = get_id_from_behavior(obj.behavior)
if (bhv == id_bhvJumpingBox) then
return mario_throw_object_ext(m,ang)
end
return false
end
function mario_grab_used_object_ext(m,ang)
local o = m.usedObj
local bhv = get_id_from_behavior(o.behavior)
if (bhv == id_bhvBowser) then
if (not mario_is_within_object_angles(m, o, 0x2000, true)) then return false end
cl_bowserthrow = true
o.oForwardVel = 0
o.oVelY = 0
o.oBowserHeldAngleVelYaw = 0
o.oBowserHeldAnglePitch = 0
o.oMoveAnglePitch = 0
o.oMoveAngleYaw = 0
o.oForwardVelS32 = 0
o.oForwardVel = 0
m.marioObj.oAngleVelYaw = 0
m.marioObj.oMoveAnglePitch = 0
m.marioObj.oMoveAngleYaw = 0
m.marioObj.oForwardVelS32 = 0
m.marioObj.oForwardVel = 0
end
if (bhv == id_bhvKingBobomb) then
if (not mario_is_within_object_angles(m, o, 0x2000, true)) then return false end
mario_grab_used_object(m)
return false
end
if (bhv == id_bhvChuckya) then
if (not mario_is_within_object_angles(m, o, 0x2000, true)) then return false end
mario_grab_used_object(m)
return false
end
if (bhv == id_bhvKoopaShellUnderwater) then
if (m.action ~= ACT_DM_WATER_MOVEMENT) then return false end
o.oTimer = 0 -- ten seconds
end
mario_grab_used_object(m)
return o == m.heldObj
end
function mario_handle_grab_and_punch_custom(m)
if m.heldByObj ~= nil then return end
if m == nil then return end
local pressedB = (m.controller.buttonPressed & B_BUTTON) ~= 0
local pressedZ = (m.controller.buttonPressed & Z_TRIG) ~= 0
local ang = nil
if m.heldObj ~= nil and cutsceneActns[m.action] ~= 1 then
if (ang == nil) then ang = GetAngleVectors(m) end
local obj = m.heldObj
if (cl_bowserthrow) then
m.marioBodyState.heldObjLastPosition.x = m.area.camera.pos.x + (ang.forward.x * (160+(obj.hitboxRadius*0.5)))
m.marioBodyState.heldObjLastPosition.y = m.area.camera.pos.y + (ang.forward.y * (160+(obj.hitboxRadius*0.5))) - (obj.hitboxHeight*0.5) + 64
m.marioBodyState.heldObjLastPosition.z = m.area.camera.pos.z + (ang.forward.z * (160+(obj.hitboxRadius*0.5)))
else
m.marioBodyState.heldObjLastPosition.x = m.area.camera.pos.x + (ang.rawForward.x * (160+(obj.hitboxRadius*0.5))) + (m.vel.x*0.25)
m.marioBodyState.heldObjLastPosition.y = m.area.camera.pos.y + ((ang.rawForward.y * (160+(obj.hitboxRadius*0.5))) + (m.vel.y*0.25)) - (obj.hitboxHeight*0.5)
m.marioBodyState.heldObjLastPosition.z = m.area.camera.pos.z + (ang.rawForward.z * (160+(obj.hitboxRadius*0.5))) + (m.vel.z*0.25)
end
end
m.controller.buttonPressed = m.controller.buttonPressed & ~(B_BUTTON|Z_TRIG)
if (pressedB) then
if (ang == nil) then ang = GetAngleVectors(m) end
if m.heldObj ~= nil then
local bhv = get_id_from_behavior(m.heldObj.behavior)
if (throwOverrides[bhv] ~= nil) then
if (throwOverrides[bhv](m,m.heldObj)) then return end
end
if not mario_throw_object_ext(m,ang) then
local curFaceAngle = m.faceAngle.y
local obj = m.heldObj
m.faceAngle.y = m.area.camera.yaw + 0x8000
mario_throw_held_object(m)
obj.oPosX = m.marioBodyState.heldObjLastPosition.x
obj.oPosY = m.marioBodyState.heldObjLastPosition.y
obj.oPosZ = m.marioBodyState.heldObjLastPosition.z
obj.oVelX = (ang.rawForward.x * 160) + (m.vel.x*sv_scalerate)
obj.oVelY = (ang.rawForward.y * 160) + (m.vel.x*sv_scalerate)
obj.oVelZ = (ang.rawForward.z * 160) + (m.vel.x*sv_scalerate)
obj.oMoveAnglePitch = gLakituState.oldPitch
obj.oMoveAngleYaw = m.faceAngle.y
obj.oMoveAngleRoll = 0
obj.oFaceAnglePitch = 0
obj.oFaceAngleYaw = m.faceAngle.y
obj.oFaceAngleRoll = 0
m.faceAngle.y = curFaceAngle
end
elseif (cl_interacttimer == 0) then
-- play_character_sound(m,CHAR_SOUND_PUNCH_HOO)
-- cl_interacttimer = 5
m.marioBodyState.heldObjLastPosition.x = m.area.camera.pos.x + (ang.rawForward.x * 160)
m.marioBodyState.heldObjLastPosition.y = m.area.camera.pos.y + (ang.rawForward.y * 160)
m.marioBodyState.heldObjLastPosition.z = m.area.camera.pos.z + (ang.rawForward.z * 160)
local target = get_any_object_closest_to_point(m.marioBodyState.heldObjLastPosition)
if (target ~= nil) then
local bhv = get_id_from_behavior(target.behavior)
if (interactOverrides[bhv] ~= nil) then
if (interactOverrides[bhv](m,target)) then return end
end
if (not obj_activate_door(m,target,bhv) and not obj_is_toad(m,target,bhv)) then
if (obj_is_grabbable(target)) then
m.interactObj = target
m.usedObj = target
if (not mario_grab_used_object_ext(m,ang)) then
m.interactObj = nil
m.usedObj = nil
end
elseif (obj_is_attackable(target) or obj_is_exclamation_box(target) or obj_is_bully(target) or obj_is_breakable_object(target)) then
m.interactObj = target
m.usedObj = target
target.oInteractStatus = INT_STATUS_INTERACTED | INT_STATUS_WAS_ATTACKED | ATTACK_PUNCH
play_character_sound(m,CHAR_SOUND_PUNCH_HOO)
end
end
else
play_sound(CAM_SOUND_UNUSED_SELECT_FIXED, m.pos)
end
end
end
if (pressedZ) then
if m.heldObj ~= nil then
local bhv = get_id_from_behavior(m.heldObj.behavior)
if (dropOverrides[bhv] ~= nil) then
if (dropOverrides[bhv](m,m.heldObj)) then return end
end
if (not mario_drop_object_ext(m,ang)) then
local curFaceAngle = m.faceAngle.y
local obj = m.heldObj
m.faceAngle.y = m.area.camera.yaw + 0x8000
mario_drop_held_object(m)
obj.oPosX = m.marioBodyState.heldObjLastPosition.x
obj.oPosY = m.marioBodyState.heldObjLastPosition.y
obj.oPosZ = m.marioBodyState.heldObjLastPosition.z
obj.oMoveAnglePitch = gLakituState.oldPitch
obj.oMoveAngleYaw = m.faceAngle.y
obj.oMoveAngleRoll = 0
obj.oFaceAnglePitch = 0
obj.oFaceAngleYaw = m.faceAngle.y
obj.oFaceAngleRoll = 0
m.faceAngle.y = curFaceAngle
end
end
end
end

View File

@ -0,0 +1,517 @@
if SM64COOPDX_VERSION == nil then return end
local play_step_sound,set_mario_action,play_character_sound,vec3f_length,perform_ground_step,vec3f_copy,perform_air_step,clampf,vec3f_add,set_mario_particle_flags,play_mario_heavy_landing_sound = play_step_sound,set_mario_action,play_character_sound,vec3f_length,perform_ground_step,vec3f_copy,perform_air_step,clampf,vec3f_add,set_mario_particle_flags,play_mario_heavy_landing_sound
local function play_local_footstep_sounds(m,rate,max)
cl_footstepTimer = cl_footstepTimer + rate
if (cl_footstepTimer >= max) then
m.marioObj.header.gfx.animInfo.animFrame = 0
play_step_sound(m, 0, 1)
cl_footstepTimer = 0
end
end
-------------------------------
-- Code for our local player --
-------------------------------
--- @param m MarioState
local function local_act_dm_grounded_movement(m)
local valid_update = local_update(m)
local metal_underwater = (m.flags & MARIO_METAL_CAP) ~= 0 and m.pos.y <= m.waterLevel-sv_playersubmergelevel
local crouch = gPlayerSyncTable[m.playerIndex].playerCrouching
if (metal_underwater and m.action ~= ACT_DM_GROUNDED_MOVEMENT_METAL) then
SV_PlayerMovement_Store(m,true)
set_mario_action(m, ACT_DM_GROUNDED_MOVEMENT_METAL, 0)
m.action = ACT_DM_GROUNDED_MOVEMENT_METAL
SV_PlayerMovement_Store(m,false)
-- return
elseif (m.action == ACT_DM_GROUNDED_MOVEMENT_METAL and not metal_underwater) then
set_mario_action(m, ACT_DM_GROUNDED_MOVEMENT, 0)
m.action = ACT_DM_GROUNDED_MOVEMENT
-- return
end
if (m.floor ~= nil) then
if (m.floor.normal.y <= SV_GetSurfaceStandableMinimum(m.floor.type,m.area.terrainType)) then
SV_PlayerMovement_Relative(m)
set_mario_action(m, ACT_DM_AIR_MOVEMENT, 0)
act_dm_air_movement(m)
return
end
end
if (m.controller.buttonDown & A_BUTTON) ~= 0 and no_dialog_open() and m.floor ~= nil then
set_character_animation(m, CHAR_ANIM_IDLE_HEAD_CENTER)
-- m.controller.buttonPressed = m.controller.buttonPressed & ~A_BUTTON
if (m.vel.y < 0) then m.vel.y = m.vel.y * 0.33 end
m.vel.y = m.vel.y + ifelse(metal_underwater,135*sv_jumpheight,140*sv_jumpheight)
if (m.vel.y > 320*sv_jumpheight) then m.vel.y = 320*sv_jumpheight end
play_mario_jump_sound(m)
SV_PlayerMovement_Relative(m)
-- SV_PlayerMovement_Store(m,true)
set_mario_action(m, ACT_DM_AIR_MOVEMENT, 0)
act_dm_air_movement(m)
return
end
SV_PlayerMovement(m)
set_character_animation(m, CHAR_ANIM_A_POSE)
if (not cl_bowserthrow) then
local len = vec3f_length(vec3_qscale(m.vel,1,0,1))
if (len < 1) then
m.faceAngle.y = m.area.camera.yaw + 0x8000
if (m.action == ACT_DM_GROUNDED_MOVEMENT) then m.action = ACT_DM_GROUNDED_IDLE end
else
play_local_footstep_sounds(m,len * 0.08,60)
m.faceAngle.y = atan2s(m.vel.z, m.vel.x)
if (m.action == ACT_DM_GROUNDED_IDLE) then m.action = ACT_DM_GROUNDED_MOVEMENT end
end
end
if (valid_update) then
m.forwardVel = vec3f_length(vec3_qscale(m.vel,sv_scalerate,0,sv_scalerate))
else m.forwardVel = 0 end
SV_PlayerMovement_Scale(m,false)
local stepResult = perform_ground_step(m)
SV_PlayerMovement_Scale(m,true)
if (stepResult == GROUND_STEP_LEFT_GROUND) then
SV_PlayerMovement_Relative(m)
if (m.action == ACT_DM_GROUNDED_MOVEMENT_METAL) then
set_mario_action(m, ACT_DM_AIR_MOVEMENT_METAL, 0)
else
set_mario_action(m, ACT_DM_AIR_MOVEMENT, 0)
end
end
if m.wall ~= nil and (stepResult == GROUND_STEP_HIT_WALL) then --or (stepResult == GROUND_STEP_HIT_WALL_CONTINUE_QSTEPS) or (stepResult == GROUND_STEP_HIT_WALL_STOP_QSTEPS)) then
vec3f_copy(m.vel, PHYS_CollideWithNormal(m.vel,m.wall.normal,0.0))
end
if (m.pos.y <= m.waterLevel-sv_playersubmergelevel and m.waterLevel > m.floorHeight + sv_playersubmergelevel) and (m.flags & MARIO_METAL_CAP) == 0 then
if (m.action == ACT_DM_GROUNDED_MOVEMENT_METAL) then
set_mario_action(m, ACT_DM_AIR_MOVEMENT_METAL, 0)
else
set_mario_action(m, ACT_DM_WATER_MOVEMENT, 0)
end
end
end
--- @param m MarioState
local function local_act_dm_air_movement(m)
local valid_update = local_update(m)
-- AngleVectors(m)
local metal_underwater = (m.flags & MARIO_METAL_CAP) ~= 0 and m.pos.y <= m.waterLevel-sv_playersubmergelevel
local act = m.action
local crouch = gPlayerSyncTable[m.playerIndex].playerCrouching
if (metal_underwater and act ~= ACT_DM_AIR_MOVEMENT_METAL) then
SV_PlayerMovement_Store(m,true)
set_mario_action(m, ACT_DM_AIR_MOVEMENT_METAL, 0)
m.action = ACT_DM_AIR_MOVEMENT_METAL
SV_PlayerMovement_Store(m,false)
-- return
elseif (act == ACT_DM_AIR_MOVEMENT_METAL and not metal_underwater) then
set_mario_action(m, ACT_DM_AIR_MOVEMENT, 0)
m.action = ACT_DM_AIR_MOVEMENT
-- return
end
if (m.controller.buttonPressed & Z_TRIG) ~= 0 and (m.controller.buttonDown & A_BUTTON) == 0 and sv_groundpound and m.heldObj == nil and no_dialog_open() then --and m.prevAction ~= ACT_DM_WATER_MOVEMENT then
m.vel.y = 0
m.controller.buttonPressed = m.controller.buttonPressed & ~Z_TRIG
set_mario_action(m, ifelse(metal_underwater,ACT_DM_GROUND_POUND_METAL,ACT_GROUND_POUND), 1)
play_sound(SOUND_ACTION_TWIRL,m.marioObj.header.gfx.cameraToObject)
return
end
SV_PlayerMovement(m)
local len_spd = vec3f_length(vec3_qscale(m.vel,1,0,1))
if (len_spd < 1) then
m.faceAngle.y = m.area.camera.yaw + 0x8000
else
m.faceAngle.y = atan2s(m.vel.z, m.vel.x)
end
set_character_animation(m, CHAR_ANIM_A_POSE)
if (metal_underwater) then
SV_UserGravity(m,0.66)
else
SV_UserGravity(m,1.0)
end
if ((m.flags & MARIO_WING_CAP) ~= 0 and (m.controller.buttonPressed & A_BUTTON) ~= 0) and no_dialog_open() then
if (m.vel.y < 0) then m.vel.y = 0 end
m.vel.y = m.vel.y + ifelse(metal_underwater,100,200)
if (m.vel.y > 320) then m.vel.y = 320 end
set_mario_particle_flags(m, (PARTICLE_DUST | PARTICLE_MIST_CIRCLE), false)
end
local preStepYVel = m.vel.y
if (valid_update) then
m.forwardVel = len_spd*sv_scalerate
else m.forwardVel = 0 end
SV_PlayerMovement_Scale(m,false)
local stepResult = perform_air_step(m,0)
SV_PlayerMovement_Scale(m,true)
if (stepResult == AIR_STEP_LANDED) then
if (m.floor ~= nil) then
if (m.floor.normal.y > SV_GetSurfaceStandableMinimum(m.floor.type,m.area.terrainType) and ifelse(sv_sticky,m.vel.y < (sv_gravity*sv_tickrate)*2,true)) then
vec3f_copy(m.vel, PHYS_CollideWithNormal(m.vel,m.floor.normal,0.0))
-- SV_PlayerMovement_Store(m,true)
cl_airstrafelimiter = 0
m.marioObj.header.gfx.animInfo.animFrame = 0
play_step_sound(m, 0, 1)
gLakituState.roll = gLakituState.roll + clampf(-1.75*(preStepYVel+200),0,1000)
if (m.action == ACT_DM_AIR_MOVEMENT_METAL) then
set_mario_action(m, ACT_DM_GROUNDED_MOVEMENT_METAL, 0)
else
set_mario_action(m, ACT_DM_GROUNDED_MOVEMENT, 0)
end
return
else
vec3f_copy(m.vel, PHYS_CollideWithNormal(m.vel,m.floor.normal,0))
vec3f_add(m.pos,vec3_scale(m.floor.normal,6))
-- vec3f_add(m.vel,vec3_scale(m.floor.normal,clampf(preStepYVel*0.75,-1,1)))
return
end
end
end
if (stepResult == AIR_STEP_HIT_WALL) and m.wall ~= nil then
if (m.controller.buttonDown & ifelse(cl_altWalljumpKey,B_BUTTON,A_BUTTON)) ~= 0 and sv_walljump and no_dialog_open() and m.heldObj == nil and len_spd > 100 then
cl_airstrafelimiter = 0.66
vec3f_copy(m.vel, PHYS_CollideWithNormal(m.vel,m.wall.normal,0.965))
set_mario_particle_flags(m, (PARTICLE_VERTICAL_STAR | PARTICLE_DUST), false)
m.vel.y = 250*sv_jumpheight
play_sound(SOUND_ACTION_BONK,m.marioObj.header.gfx.cameraToObject)
play_character_sound(m,CHAR_SOUND_YAH_WAH_HOO)
else
vec3f_copy(m.vel, PHYS_CollideWithNormal(m.vel,m.wall.normal,0.05))
end
end
if (m.pos.y <= m.waterLevel-sv_playersubmergelevel and m.waterLevel > m.floorHeight + sv_playersubmergelevel) and (m.flags & MARIO_METAL_CAP) == 0 then
if (m.action ~= ACT_DM_AIR_MOVEMENT_METAL) then
set_mario_action(m, ACT_DM_WATER_MOVEMENT, 0)
end
end
end
--- @param m MarioState
local function local_act_dm_water_movement(m)
local valid_update = local_update(m)
-- AngleVectors(m)
SV_WaterMovement(m)
SV_PlayerMovement_Store(m,true)
if (m.playerIndex == 0) then
if (vec3f_length(vec3_qscale(m.vel,1,0,1)) < 1) then
m.faceAngle.y = m.area.camera.yaw + 0x8000
else
m.faceAngle.y = atan2s(m.vel.z, m.vel.x)
end
set_character_animation(m, CHAR_ANIM_A_POSE)
else
local scale = m.forwardVel
if (scale < 10) then
set_character_animation(m, CHAR_ANIM_WATER_IDLE)
else
set_character_anim_with_accel(m, CHAR_ANIM_FLUTTERKICK, scale*0x800)
end
end
if (valid_update) then
m.forwardVel = vec3f_length(vec3_qscale(m.vel,sv_scalerate,0,sv_scalerate))
else m.forwardVel = 0 end
if (m.pos.y+(m.vel.y*sv_scalerate) < m.floorHeight + 2) then
m.pos.y = m.floorHeight + 2
m.vel.y = 0
end
SV_PlayerMovement_Scale(m,false)
local stepResult = perform_air_step(m,0)
SV_PlayerMovement_Scale(m,true)
if (stepResult == AIR_STEP_HIT_WALL) and m.wall ~= nil then
vec3f_copy(m.vel, PHYS_CollideWithNormal(m.vel,m.wall.normal,0.05))
end
local isSnowy = ((m.area.terrainType & TERRAIN_MASK) == TERRAIN_SNOW)
if (m.area.camera.pos.y >= m.waterLevel - 15 and not isSnowy) or mario_holding_underwater_shell(m) then
m.healCounter = 1
if (m.controller.buttonDown & A_BUTTON) ~= 0 and m.vel.y > 0 then
m.vel.y = 180
end
elseif (not mario_holding_underwater_shell(m)) then
m.health = m.health - ifelse(isSnowy,3,1)
end
if (m.pos.y > m.waterLevel-sv_playersubmergelevel) then
set_mario_action(m, ACT_DM_AIR_MOVEMENT, 0)
return
end
end
--- @param m MarioState
local function local_act_dm_ground_pound(m)
local valid_update = local_update(m)
local metal_underwater = (m.flags & MARIO_METAL_CAP) ~= 0 and m.pos.y <= m.waterLevel-sv_playersubmergelevel
if (metal_underwater and act ~= ACT_DM_GROUND_POUND_METAL) then
SV_PlayerMovement_Store(m,true)
set_mario_action(m, ACT_DM_GROUND_POUND_METAL, 0)
SV_PlayerMovement_Store(m,false)
elseif (act == ACT_DM_AIR_MOVEMENT_METAL and not metal_underwater) then
set_mario_action(m, ACT_DM_GROUND_POUND, 0)
end
if (m.controller.buttonPressed & Z_TRIG) ~= 0 then
m.vel.x = 0
m.vel.z = 0
end
m.faceAngle.y = m.area.camera.yaw + 0x8000
set_character_animation(m, CHAR_ANIM_A_POSE)
SV_UserGravityEx(m,1.0,0.75)
SV_PlayerMovement_Scale(m,false)
local stepResult = perform_air_step(m,0)
SV_PlayerMovement_Scale(m,true)
if (stepResult == AIR_STEP_LANDED) then
if (m.floor ~= nil) then
play_mario_heavy_landing_sound(m, SOUND_ACTION_TERRAIN_HEAVY_LANDING)
set_mario_particle_flags(m, (PARTICLE_MIST_CIRCLE | PARTICLE_HORIZONTAL_STAR), false)
gLakituState.roll = gLakituState.roll + 500
if (m.controller.buttonDown & A_BUTTON) ~= 0 and m.health > 0xFF then
SV_HandleSpecialFloors(m,true)
local direction = GetAngleVectors(m).forward
local yV = m.vel.y * 0.32 * sv_scalerate
local len = vec3f_length(vec3_qscale(m.vel,1,0,1))
vec3f_copy(m.vel,vec3_scale(direction,len*0.895))
vec3f_add(m.vel,vec3_qscale(m.floor.normal,-0.3,85 * clampf((len+math.abs(yV)) / 320, 0.5, 1.0),-0.3))
m.vel.y = (m.vel.y + (250 * clampf((len+math.abs(yV)) / 320, 0.65, 1.0)))*sv_jumpheight
-- PHYS_CollideWithNormal(m.vel,m.floor.normal,0.0,1.0)
set_mario_action(m, ifelse(metal_underwater,ACT_DM_AIR_MOVEMENT_METAL,ACT_DM_AIR_MOVEMENT), 0)
play_character_sound(m,CHAR_SOUND_YAHOO)
else
m.forwardVel = 0
m.vel.x = 0
m.vel.y = 0
m.vel.z = 0
set_mario_action(m, ifelse(metal_underwater,ACT_DM_GROUNDED_MOVEMENT_METAL,ACT_GROUND_POUND_LAND), 0)
end
return;
end
end
end
--- @param m MarioState
local function local_act_dm_pole_movement(m)
local_update(m)
m.vel.x = 0
m.vel.z = 0
if (m.health <= 0xFF or m.usedObj == nil or (m.controller.buttonPressed & Z_TRIG) ~= 0) then
m.vel.y = 0
m.forwardVel = 3
m.controller.buttonPressed = m.controller.buttonPressed & ~(Z_TRIG|A_BUTTON)
return set_mario_action(m, ACT_DM_AIR_MOVEMENT, 0)
end
m.faceAngle.y = m.area.camera.yaw + 0x8000
if (m.controller.buttonPressed & A_BUTTON) ~= 0 then
m.vel.y = 12
m.forwardVel = 36
return set_mario_action(m, ACT_WALL_KICK_AIR, 0)
end
set_character_animation(m, CHAR_ANIM_A_POSE)
local o = m.usedObj
local i = ifelse(gFirstPersonCamera.pitch < 0,1.0,-1.0)
m.pos.y = m.pos.y + (m.usedObj.oPosY-cl_poleY)
cl_poleY = m.usedObj.oPosY
m.pos.x = o.oPosX + sins(m.faceAngle.y)
m.pos.z = o.oPosZ + coss(m.faceAngle.y)
m.vel.y = m.controller.rawStickY*0.66*i
local intendedPos = m.pos.y + (m.vel.y*sv_scalerate)
if (intendedPos < o.oPosY) then
m.vel.y = 0
m.pos.y = o.oPosY
end
if (intendedPos > o.oPosY+o.hitboxHeight) then
m.vel.y = 0
m.pos.y = o.oPosY+o.hitboxHeight
end
SV_PlayerMovement_Scale(m,false)
local stepResult = perform_air_step(m,0)
SV_PlayerMovement_Scale(m,true)
end
----------------------------------
-- Prediction for other players --
----------------------------------
--- @param m MarioState
local function prediction_act_dm_grounded_movement(m)
local crouch = gPlayerSyncTable[m.playerIndex].playerCrouching
if ((m.controller.buttonDown & A_BUTTON) ~= 0 or (m.controller.buttonPressed & A_BUTTON) ~= 0) and m.floor ~= nil then
play_character_sound(m,CHAR_SOUND_YAH_WAH_HOO)
-- return
end
if (not cl_disableAccelPred) then SV_PlayerMovement(m) end
local scale = m.forwardVel
if (scale < 5) then
set_character_animation(m, ifelse(crouch,CHAR_ANIM_CROUCHING,CHAR_ANIM_FIRST_PERSON))
else
play_step_sound(m, ifelse(crouch,26,9), ifelse(crouch,79,45))
set_character_anim_with_accel(m, ifelse(crouch,CHAR_ANIM_CRAWLING,CHAR_ANIM_RUNNING), scale*ifelse(crouch,0x4000,0x2600))
end
m.forwardVel = vec3f_length(vec3_qscale(m.vel,sv_scalerate,0,sv_scalerate))
SV_PlayerMovement_Scale(m,false)
local stepResult = perform_ground_step(m)
SV_PlayerMovement_Scale(m,true)
end
--- @param m MarioState
local function prediction_act_dm_air_movement(m)
local crouch = gPlayerSyncTable[m.playerIndex].playerCrouching
if (not cl_disableAccelPred) then SV_PlayerMovement(m) end
set_character_animation(m, ifelse(crouch,CHAR_ANIM_FAST_LONGJUMP,ifelse(m.vel.y < 0,CHAR_ANIM_DOUBLE_JUMP_FALL,CHAR_ANIM_DOUBLE_JUMP_RISE)))
if (metal_underwater) then
SV_UserGravity(m,0.66)
else
SV_UserGravity(m,1.0)
end
if ((m.flags & MARIO_WING_CAP) ~= 0 and (m.controller.buttonDown & A_BUTTON) ~= 0 and m.vel.y < 0) then m.vel.y = 0 end
m.forwardVel = vec3f_length(vec3_qscale(m.vel,sv_scalerate,0,sv_scalerate))
SV_PlayerMovement_Scale(m,false)
local stepResult = perform_air_step(m,0)
SV_PlayerMovement_Scale(m,true)
end
--- @param m MarioState
local function prediction_act_dm_water_movement(m)
if (not cl_disableAccelPred) then SV_WaterMovement(m) end
local scale = m.forwardVel
if (scale < 10) then
set_character_animation(m, CHAR_ANIM_WATER_IDLE)
else
set_character_anim_with_accel(m, CHAR_ANIM_FLUTTERKICK, scale*0x800)
end
if (vec3f_length(m.vel) <= 10) then
m.forwardVel = 0
return
end
m.forwardVel = vec3f_length(vec3_qscale(m.vel,sv_scalerate,0,sv_scalerate))
SV_PlayerMovement_Scale(m,false)
local stepResult = perform_air_step(m,0)
SV_PlayerMovement_Scale(m,true)
end
--- @param m MarioState
local function prediction_act_dm_ground_pound(m)
set_character_animation(m, CHAR_ANIM_TRIPLE_JUMP_GROUND_POUND)
SV_UserGravityEx(m,1.0,0.75)
SV_PlayerMovement_Scale(m,false)
local stepResult = perform_air_step(m,0)
SV_PlayerMovement_Scale(m,true)
if (stepResult == AIR_STEP_LANDED) then
if (m.floor ~= nil) then
play_mario_heavy_landing_sound(m, SOUND_ACTION_TERRAIN_HEAVY_LANDING)
set_mario_particle_flags(m, (PARTICLE_MIST_CIRCLE | PARTICLE_HORIZONTAL_STAR), false)
if (m.controller.buttonDown & A_BUTTON) ~= 0 then
play_character_sound(m,CHAR_SOUND_YAHOO)
end
end
end
end
--- @param m MarioState
local function prediction_act_dm_pole_movement(m)
set_character_animation(m, CHAR_ANIM_IDLE_ON_POLE)
SV_PlayerMovement_Scale(m,false)
local stepResult = perform_air_step(m,0)
SV_PlayerMovement_Scale(m,true)
end
--- @param m MarioState
function act_dm_grounded_movement(m)
if (m.playerIndex == 0) then return local_act_dm_grounded_movement(m) else return prediction_act_dm_grounded_movement(m) end
end
--- @param m MarioState
function act_dm_air_movement(m)
if (m.playerIndex == 0) then return local_act_dm_air_movement(m) else return prediction_act_dm_air_movement(m) end
end
--- @param m MarioState
function act_dm_water_movement(m)
if (m.playerIndex == 0) then return local_act_dm_water_movement(m) else return prediction_act_dm_water_movement(m) end
end
--- @param m MarioState
function act_dm_ground_pound(m)
if (m.playerIndex == 0) then return local_act_dm_ground_pound(m) else return prediction_act_dm_ground_pound(m) end
end
--- @param m MarioState
function act_dm_pole_movement(m)
if (m.playerIndex == 0) then return local_act_dm_pole_movement(m) else return prediction_act_dm_pole_movement(m) end
end

View File

@ -0,0 +1,666 @@
if SM64COOPDX_VERSION == nil then return end
local is_player_active,vec3f_copy,set_mario_action,perform_air_step,save_file_get_flags,save_file_set_flags,save_file_do_save,get_current_save_file_num,vec3f_dot,get_id_from_behavior,djui_hud_set_color,djui_hud_render_rect,djui_hud_print_text,djui_hud_set_resolution,djui_hud_get_screen_width,djui_hud_get_screen_height,djui_hud_set_font,vec3f_length,math_floor,djui_hud_measure_text,get_cutscene_from_mario_status,obj_get_first,obj_get_next,obj_get_nearest_object_with_behavior_id,obj_check_hitbox_overlap = is_player_active,vec3f_copy,set_mario_action,perform_air_step,save_file_get_flags,save_file_set_flags,save_file_do_save,get_current_save_file_num,vec3f_dot,get_id_from_behavior,djui_hud_set_color,djui_hud_render_rect,djui_hud_print_text,djui_hud_set_resolution,djui_hud_get_screen_width,djui_hud_get_screen_height,djui_hud_set_font,vec3f_length,math.floor,djui_hud_measure_text,get_cutscene_from_mario_status,obj_get_first,obj_get_next,obj_get_nearest_object_with_behavior_id,obj_check_hitbox_overlap
function no_dialog_open()
return not (get_dialog_id() >= 0 and get_dialog_box_state() < 3)
end
-- function remove_cutscenes(m)
-- todo: this shit breaks
-- if m.area ~= nil and m.area.camera ~= nil then
-- local lvl = gNetworkPlayers[m.playerIndex].currLevelNum
-- if (cutsceneActns[m.action] ~= 1 or not no_dialog_open()) and (lvl ~= LEVEL_BOWSER_1 and lvl ~= LEVEL_BOWSER_2 and lvl ~= LEVEL_BOWSER_3) then
-- disable_time_stop()
-- m.area.camera.cutscene = 0
-- m.statusForCamera.cameraEvent = 0
-- m.freeze = 0
-- end
-- end
-- end
local intFix = 0
--- @param m MarioState
function active_player(m)
local np = gNetworkPlayers[m.playerIndex]
if m.playerIndex == 0 then
return 1
end
if not np.connected then
return 0
end
if np.currCourseNum ~= gNetworkPlayers[0].currCourseNum then
return 0
end
if np.currActNum ~= gNetworkPlayers[0].currActNum then
return 0
end
if np.currLevelNum ~= gNetworkPlayers[0].currLevelNum then
return 0
end
if np.currAreaIndex ~= gNetworkPlayers[0].currAreaIndex then
return 0
end
return is_player_active(m)
end
function on_set_mario_action(m)
if (m.playerIndex == 0) then
if (DM_ACTION_TRANSFERS[m.action] == 1) then
local yVel = m.vel.y * sv_scalerate_inverse
local fVel = m.forwardVel * sv_scalerate_inverse
local s = gPlayerSyncTable[m.playerIndex]
local direction = GetAngleVectors(m).forward
vec3f_copy(m.vel,vec3_scale(direction,m.forwardVel*sv_scalerate_inverse))
m.vel.y = yVel
local is_underwater = m.pos.y <= m.waterLevel-sv_playersubmergelevel
local metal_underwater = (m.flags & MARIO_METAL_CAP) ~= 0
if ((m.action & ACT_FLAG_AIR) ~= 0) then
set_mario_action(m, ACT_DM_AIR_MOVEMENT, 0)
return 1
elseif ((m.action & ACT_GROUP_SUBMERGED) ~= 0) then
if (not metal_underwater) and (is_underwater) then
set_mario_action(m, ACT_DM_WATER_MOVEMENT, 0)
return 1
end
if (metal_underwater) and (is_underwater) then
set_mario_action(m, ACT_DM_AIR_MOVEMENT_METAL, 0)
return 1
end
end
set_mario_action(m, ACT_DM_GROUNDED_MOVEMENT, 0)
return 1
end
if (DM_ACTION_FUNCTIONS[m.action] ~= nil) then
local val = DM_ACTION_FUNCTIONS[m.action](m)
if (val == 1) then return 1 end
end
end
end
function allow_voice(m,s)
if (s == CHAR_SOUND_ON_FIRE or s == CHAR_SOUND_ATTACKED or s == CHAR_SOUND_EEUH) then
return 0
end
end
function override_defacto(m)
-- if m.action == ACT_DM_AIR_MOVEMENT or m.action == ACT_DM_GROUNDED_MOVEMENT or
-- m.action == ACT_DM_AIR_MOVEMENT_METAL or m.action == ACT_DM_GROUNDED_MOVEMENT_METAL or m.action == ACT_DM_GROUNDED_IDLE then
return 1
-- end
end
function on_player_connected(m)
gPlayerSyncTable[m.playerIndex].playerCrouching = false
gPlayerSyncTable[m.playerIndex].playerPitch = 1
gPlayerSyncTable[m.playerIndex].playerYaw = 1
end
function before_set_mario_action(m,incoming)
if (DM_ACTION_PREFUNCS_ALL[incoming] ~= nil) then
local val = DM_ACTION_PREFUNCS_ALL[incoming](m)
if (val == 1) then return 1 end
end
if (m.playerIndex == 0) then
if (DM_ACTION_PREFUNCS[incoming] ~= nil) then
return DM_ACTION_PREFUNCS[incoming](m)
elseif (DM_ACTIONS[incoming] ~= 1) then
m.controller.buttonPressed = 0
local is_underwater = m.pos.y <= m.waterLevel-sv_playersubmergelevel
local metal_underwater = (m.flags & MARIO_METAL_CAP) ~= 0
if ((incoming & ACT_FLAG_AIR) ~= 0) then
set_mario_action(m, ACT_DM_AIR_MOVEMENT, 0)
return 1
elseif ((incoming & ACT_FLAG_SWIMMING) ~= 0) or ((incoming & ACT_GROUP_SUBMERGED) ~= 0) then
if (not metal_underwater) and (is_underwater) then
set_mario_action(m, ACT_DM_WATER_MOVEMENT, 0)
return 1
end
if (metal_underwater) and (is_underwater) then
set_mario_action(m, ACT_DM_AIR_MOVEMENT_METAL, 0)
return 1
end
end
set_mario_action(m, ACT_DM_GROUNDED_MOVEMENT, 0)
return 1
end
end
end
function before_phys_step(m)
local act = m.action
if (DM_ACTIONS[act] ~= 1) then return 0 end
if ((act == ACT_DM_AIR_MOVEMENT or act == ACT_DM_AIR_MOVEMENT_METAL or act == ACT_DM_WATER_MOVEMENT or act == ACT_GROUND_POUND) and m.playerIndex == 0 and m.ceil ~= nil) then
local h = m.marioObj.hitboxHeight
if (m.ceilHeight <= m.pos.y + h) then
m.pos.y = m.ceilHeight - h - 4
return 0
end
if (m.pos.y + h + 4 + sv_camerayoffset > m.ceilHeight) then
SV_PlayerMovement_Scale(m,true)
vec3f_copy(m.vel, PHYS_CollideWithNormal(m.vel,m.ceil.normal,0.25))
SV_PlayerMovement_Scale(m,false)
m.pos.y = m.pos.y - 4
return perform_air_step(m,0)
end
end
end
function on_interact(m,o,i,b)
if (intFix > 0) then return end
if DM_ACTION_QPHYS[m.action] == 1 then
if (i == INTERACT_BOUNCE_TOP or i == INTERACT_BOUNCE_TOP2) and not (m.action == ACT_GROUND_POUND or m.action == ACT_DM_GROUND_POUND_METAL) then
if (o.oInteractStatus & INT_STATUS_WAS_ATTACKED) ~= 0 then
m.vel.y = 160
return
end
end
if (o.oInteractStatus & INT_STATUS_ATTACKED_MARIO) ~= 0 and m.health > 0xFF then
m.invincTimer = 30
gLakituState.roll = 2730*(m.hurtCounter*0.25)
gLakituState.oldRoll = gLakituState.roll
cl_red = 128
return
end
if i == INTERACT_STAR_OR_KEY then
local lvl = gNetworkPlayers[m.playerIndex].currLevelNum
if (lvl == LEVEL_BOWSER_1) then
if ((save_file_get_flags() & (SAVE_FLAG_UNLOCKED_BASEMENT_DOOR)) == 0) then
save_file_set_flags(SAVE_FLAG_UNLOCKED_BASEMENT_DOOR)
save_file_do_save(get_current_save_file_num()-1,true)
end
end
if (lvl == LEVEL_BOWSER_2) then
if ((save_file_get_flags() & (SAVE_FLAG_UNLOCKED_UPSTAIRS_DOOR)) == 0) then
save_file_set_flags(SAVE_FLAG_UNLOCKED_UPSTAIRS_DOOR)
save_file_do_save(get_current_save_file_num()-1,true)
end
end
return
end
end
end
function allow_interact(m,o,i)
if (intFix > 0) then return end
if DM_ACTION_QPHYS[m.action] == 1 then
if (i == INTERACT_POLE and no_dialog_open()) then
if (vec3f_dot({x=o.oPosX-m.pos.x,y=0,z=o.oPosZ-m.pos.z},{x=m.vel.x,y=0,z=m.vel.z}) > 0) and (m.controller.buttonDown & B_BUTTON) ~= 0 then
m.usedObj = o
cl_poleY = o.oPosY
set_mario_action(m,ACT_DM_POLE_MOVEMENT,0)
end
return false
end
if (i == INTERACT_IGLOO_BARRIER) then
if (m.controller.buttonDown & Z_TRIG ~= 0) then
return false
end
end
if (m.action == ACT_DM_GROUND_POUND_METAL) then
o.oInteractStatus = (o.oInteractStatus | INT_GROUND_POUND)
end
end
if (get_id_from_behavior(o.behavior) == id_bhvToadMessage) then
return false
end
end
function on_pvp(m,v)
if (intFix > 0) then return end
if DM_ACTION_QPHYS[v.action] == 1 then
v.invincTimer = 30
if (v.playerIndex == 0) then
gLakituState.roll = 2730*(v.hurtCounter*0.25)
gLakituState.oldRoll = gLakituState.roll
cl_red = 128
end
end
end
local function render_speed(w2,h2,textWidth,h_offset,hspeed_text,scale,height)
local scale1 = scale*0.5
djui_hud_set_color(0,0,0,100)
djui_hud_render_rect((w2*0.5) - (textWidth*scale1) - 1,(h2*h_offset),textWidth*scale + 2,height)
djui_hud_set_color(255,255,255,255)
djui_hud_print_text(hspeed_text, (w2*0.5) - (textWidth*scale1),(h2*h_offset),scale)
end
function render_hud_effects()
local m = gMarioStates[0]
if (m ~= nil) then
djui_hud_set_resolution(RESOLUTION_DJUI)
local w = djui_hud_get_screen_width()
local h = djui_hud_get_screen_height()
if (cl_red > 0) then
djui_hud_set_color(255,0,0,cl_red*0.5)
djui_hud_render_rect(0,0,w,h)
end
local c = m.area.camera
if (c ~= nil) then
if (c.pos.y < m.waterLevel) then
djui_hud_set_color(38,139,255,100)
djui_hud_render_rect(0,0,w,h)
end
end
if (m.health <= 0xFF or m.action == ACT_UNINITIALIZED or m.action == ACT_DISAPPEARED) then return end
djui_hud_set_resolution(RESOLUTION_N64)
djui_hud_set_font(FONT_NORMAL)
local w2 = djui_hud_get_screen_width()
local h2 = djui_hud_get_screen_height()
local hspeed = m.forwardVel*sv_scalerate_inverse ; if (DM_ACTION_QPHYS[m.action] == 1) then hspeed = vec3f_length({x=m.vel.x,y=0,z=m.vel.z}) end
local hspeed_text = tostring(math.floor(hspeed))
local textWidth = djui_hud_measure_text(hspeed_text)
render_speed(w2,h2,textWidth,0.8,hspeed_text,0.5,15)
local vspeed = m.vel.y ; if (DM_ACTION_QPHYS[m.action] ~= 1) then vspeed = vspeed * sv_scalerate_inverse end
local vspeed_text = tostring(math.floor(vspeed))
local vtextWidth = djui_hud_measure_text(vspeed_text)
render_speed(w2,h2,vtextWidth,0.75,vspeed_text,0.25,7.5)
-- local vspeed_text = tostring(m.area.camera.cutscene)
-- local vTextWidth = djui_hud_measure_text(vspeed_text)
-- render_speed(w2,h2,vTextWidth,0.75,vspeed_text,0.25,7.5)
-- local usedObjT = tostring(m.usedObj ~= nil)
-- local usedObj = djui_hud_measure_text(usedObjT)
-- render_speed(w2,h2,usedObj,0.6,usedObjT,0.25,7.5)
-- local usedObjT2 = tostring(get_cutscene_from_mario_status(m.area.camera))
-- local usedObj2 = djui_hud_measure_text(usedObjT2)
-- render_speed(w2,h2,usedObj2,0.55,usedObjT2,0.25,7.5)
if (m.capTimer > 0) then
local capTimer_Seconds = math.floor(m.capTimer * 0.03333333333333333)
local capText = "Cap Timer: " .. tostring(capTimer_Seconds)
local capWidth = djui_hud_measure_text(capText)
render_speed(w2,h2,capWidth,0.875,capText,0.5,15)
end
-- m.area.camera.cutscene = 0
-- m.statusForCamera.cameraEvent = 0
-- if (m.area.camera.cutscene > 0) then
-- local at = "Area Cutscene: " .. tostring(m.area.camera.cutscene)
-- local aw = djui_hud_measure_text(at)
-- render_speed(w2,h2,aw,0.1,at,0.5,15)
-- end
-- if (m.statusForCamera.cameraEvent > 0) then
-- local at2 = "Mario Cutscene: " .. tostring(m.statusForCamera.cameraEvent)
-- local aw2 = djui_hud_measure_text(at2)
-- render_speed(w2,h2,aw2,0.2,at2,0.5,15)
-- end
if (not sv_gunmod_loaded) then -- crosshair
-- djui_hud_set_color(0,0,0,255)
-- djui_hud_render_rect((w2*0.5) - 6,(h2*0.5) - 1,11,3)
-- djui_hud_render_rect((w2*0.5) - 2,(h2*0.5) - 5,3,11)
djui_hud_set_color(255,255,255,255)
djui_hud_render_rect((w2*0.5) - 5,(h2*0.5),9,1)
djui_hud_render_rect((w2*0.5) - 1,(h2*0.5) - 4,1,9)
end
end
end
function allow_pvp(m,v)
if (intFix > 0) then return end
if (m.action == ACT_DM_AIR_MOVEMENT or m.action == ACT_DM_AIR_MOVEMENT_METAL or m.action == ACT_DM_WATER_MOVEMENT) then
return false
end
end
function on_object_render(o)
if (get_id_from_behavior(o.behavior) == id_bhvMario) then
local m = gMarioStates[0]
if (o == m.marioObj) then
o.header.gfx.shadowInvisible = true
o.header.gfx.disableAutomaticShadowPos = true
local flag = cutsceneActns[m.action] ~= 1
if (m.heldObj ~= nil and flag) then
local cYaw = m.area.camera.yaw + 0x8000
local fA = m.faceAngle.y + 0x4000
local offsetX_FaceAngle = 40 * sins(fA)
local offsetZ_FaceAngle = 40 * coss(fA)
local factorY_CameraAngle = sins(gLakituState.oldPitch)
local offsetX_CameraAngle_Fixup = (sins(cYaw)) * factorY_CameraAngle
local offsetZ_CameraAngle_Fixup = (coss(cYaw)) * factorY_CameraAngle
local finalOffsetX = offsetX_FaceAngle + offsetX_CameraAngle_Fixup
local finalOffsetY = -60
local finalOffsetZ = offsetZ_FaceAngle + offsetZ_CameraAngle_Fixup
m.marioObj.header.gfx.pos.x = m.marioBodyState.heldObjLastPosition.x + finalOffsetX
m.marioObj.header.gfx.pos.y = m.marioBodyState.heldObjLastPosition.y + finalOffsetY
m.marioObj.header.gfx.pos.z = m.marioBodyState.heldObjLastPosition.z + finalOffsetZ
elseif (m.heldObj == nil and m.heldByObj ~= nil and flag) then
vec3f_copy(m.pos,m.marioObj.header.gfx.pos)
end
end
end
end
local modLoad = false
function on_level_init()
gFirstPersonCamera.offset.y = sv_camerayoffset
gLakituState.roll = 0
cl_red = 0
intFix = 10
local lastList = 0
local obj = obj_get_first(ObjectLists[lastList])
while obj ~= nil do
obj.header.gfx.skipInViewCheck = true
local nextObj = obj_get_next(obj)
if (nextObj == nil) then
while nextObj == nil and lastList < 9 do
lastList = lastList + 1
nextObj = obj_get_first(ObjectLists[lastList])
end
end
obj = nextObj
end
if (not modLoad) then
djui_chat_message_create("\\#FFE0A0\\Welcome to \\#FFAA00\\mQuake\\#FFE0A0\\!\nPlease check the list of commands with '/mq list'.")
end
if (not modLoad and network_is_server()) then
djui_chat_message_create("\\#A0FFE0\\Please check the server settings with '/mq_server list'.")
end
modLoad = true
end
function local_update(m)
if (m == nil) then return true end
if (m.health <= 0xFF) then
gFirstPersonCamera.offset.y = -110
gLakituState.roll = 0
m.invincTimer = 0
cl_red = 192
return false
end
if (cl_airstrafelimiter > 0) then
cl_airstrafelimiter = cl_airstrafelimiter * 0.95
if (cl_airstrafelimiter <= 0.1) then cl_airstrafelimiter = 0 end
end
local btnDown = m.controller.buttonDown
local btnPressed = m.controller.buttonPressed
-- if (cl_interacttimer > 0) then cl_interacttimer = cl_interacttimer - 1 end
if (cl_red > 0) then cl_red = cl_red - 32 end
m.marioObj.hookRender = 1
if (m.heldObj ~= nil) then
held_obj_update(m)
end
if (m.usedObj ~= nil and cl_toadTalkedTo and no_dialog_open()) then
m.usedObj.oToadMessageState = 4
m.usedObj = nil
cl_toadTalkedTo = false
end
if (DM_ACTION_QPHYS[m.action] == 1) then
if (m.controller.buttonDown & B_BUTTON) ~= 0 and (m.flags & MARIO_UNKNOWN_31) == 0 then
m.flags = m.flags | MARIO_UNKNOWN_31
elseif (m.flags & MARIO_UNKNOWN_31) ~= 0 then
m.flags = m.flags & ~MARIO_UNKNOWN_31
end
end
if (cl_bowserthrow) then
cl_bowserthrow_previousYaw = m.faceAngle.y
cl_bowserthrow = m.heldObj ~= nil
m.faceAngle.y = m.area.camera.yaw + 0x8000
end
SV_HandleSpecialFloors(m,false)
local shouldCrouch = ((((m.controller.buttonDown & Z_TRIG) ~= 0 and m.health > 0xFF) or m.action == ACT_GROUND_POUND or m.action == ACT_DM_GROUND_POUND_METAL) and m.action ~= ACT_DM_WATER_MOVEMENT) or (gPlayerSyncTable[m.playerIndex].playerCrouching and m.ceilHeight < m.pos.y + m.marioObj.hitboxHeight)
if (DM_ACTION_FORCEANGLE[m.action] ~= nil and not cl_bowserthrow) then
m.faceAngle.y = m.area.camera.yaw + (0x8000*DM_ACTION_FORCEANGLE[m.action])
end
if (DM_ACTIONS_CROUCHAIR[m.action] == 1) then
if (shouldCrouch ~= gPlayerSyncTable[m.playerIndex].playerCrouching) then
if (shouldCrouch) then
m.pos.y = m.pos.y + sv_crouchoffset
else
if (m.pos.y - sv_crouchoffset < m.floorHeight) then
m.pos.y = m.floorHeight
else
m.pos.y = m.pos.y - sv_crouchoffset
end
end
end
end
gPlayerSyncTable[m.playerIndex].playerCrouching = shouldCrouch
if (m.action ~= ACT_SQUISHED) then gFirstPersonCamera.offset.y = ifelse(shouldCrouch, sv_camerayoffset-sv_crouchoffset, sv_camerayoffset) end
-- if (m.health <= 0xFF) then
gLakituState.roll = gLakituState.roll * 0.75
if (DM_ACTIONS_ALLOWGRAB[m.action] == 1 and no_dialog_open() and sv_interact) then
mario_handle_grab_and_punch_custom(m)
end
-- end
m.marioObj.hitboxHeight = ifelse(shouldCrouch, sv_playerheight-sv_crouchoffset, sv_playerheight)
local warp = obj_get_nearest_object_with_behavior_id(m.marioObj, id_bhvFadingWarp)
if warp ~= nil and m.heldObj == nil and m.action ~= ACT_TELEPORT_FADE_OUT and m.action ~= ACT_TELEPORT_FADE_IN and obj_check_hitbox_overlap(m.marioObj, warp) and vec3f_length(m.vel) < sv_stopspeed and gPlayerSyncTable[m.playerIndex].playerCrouching then
m.interactObj = warp
m.usedObj = warp
m.forwardVel = 0
set_mario_action(m, ACT_TELEPORT_FADE_OUT, 0)
m.controller.buttonDown = btnDown
m.controller.buttonPressed = btnPressed
frameCalculatedAngles = false
return false
end
m.controller.buttonDown = btnDown
m.controller.buttonPressed = btnPressed
frameCalculatedAngles = false
return true
end
function on_game_update(m)
local m = gMarioStates[0]
if (m == nil) then return end
m.peakHeight = m.pos.y
local a = m.action
if (DM_ACTION_DONT_OVERRIDE_FP[a] ~= 1) then set_first_person_enabled(true) end
-- remove_cutscenes(m)
gFirstPersonCamera.forceRoll = false
gFirstPersonCamera.fov = cl_fov
if (a == ACT_SQUISHED and m.ceil ~= nil) then
gFirstPersonCamera.offset.y = m.ceilHeight - m.pos.y - 120
end
if (intFix > 0) then intFix = intFix -1 end
end
--- commands
function mquake(msg)
if msg == 'list' then
djui_chat_message_create("\\#FFE0A0\\'/mq alt_walljump [on/off]'\\#FFFFFF\\ - Set alternate walljump key (Holding B)")
djui_chat_message_create("\\#FFE0A0\\'/mq predict [on/off]'\\#FFFFFF\\ - Set prediction for acceleration")
djui_chat_message_create("\\#FFE0A0\\'/mq moveset'\\#FFFFFF\\ - A short tutorial on the moveset")
djui_chat_message_create("\\#FFE0A0\\'/mq fov [45-120]'\\#FFFFFF\\ - Set the FOV")
return true
elseif msg == 'alt_walljump off' then
djui_chat_message_create("\\#FFE0A0\\Alternative Walljump Key:\\#FF1414\\ Off")
mod_storage_save_bool("mq_altwallj",false)
cl_altWalljumpKey = false
return true
elseif msg == 'predict off' then
djui_chat_message_create("\\#FFE0A0\\Acceleration Prediction:\\#FF1414\\ Off")
mod_storage_save_bool("mq_accelpred",true)
cl_disableAccelPred = true
return true
elseif msg == 'alt_walljump on' then
djui_chat_message_create("\\#FFE0A0\\Alternative Walljump Key:\\#14FF14\\ On")
mod_storage_save_bool("mq_altwallj",true)
cl_altWalljumpKey = true
return true
elseif msg == 'predict on' then
djui_chat_message_create("\\#FFE0A0\\Acceleration Prediction:\\#14FF14\\ On")
mod_storage_save_bool("mq_accelpred",true)
cl_disableAccelPred = true
return true
elseif msg == 'moveset' then
djui_chat_message_create("\\#FFE0A0\\Ground Pound - \\#FFFFFF\\Let go of (A) and press [Z] to start a ground pound.\nPressing [Z] again will cancell all horizontal velocity, sending you straight down!")
djui_chat_message_create("\\#FFE0A0\\Ground Pound Jump - \\#FFFFFF\\Hold (A) after starting a ground pound to ground pound jump when you land. \nThis converts some velocity to upwards momentum while carrying the rest!")
djui_chat_message_create("\\#FFE0A0\\Crouch Jump - \\#FFFFFF\\Continue to hold (A) after jumping then press and hold [Z] to stay in the air longer and land on higher up platforms!")
djui_chat_message_create("\\#FFE0A0\\Interacting - \\#FFFFFF\\Pressing (B) will interact with objects.\nLook at the object you wish to either punch, grab or talk to and press (B).\nHolding (B) will let you push metal boxes around and grab trees or poles!")
djui_chat_message_create("\\#FFE0A0\\Throwing Bowser - \\#FFFFFF\\To throw bowser, flick your view to the left or right and press (B)!")
return true
end
local space = string.find(msg,' ')
if (space == nil or space < 1) then return end
local args = {[1]=string.sub(msg,1,space-1),[2]=string.sub(msg,-(string.len(msg)-space))}
if (args[2] == nil or args[2] == "") then return false end
if (args[1] == nil or args[1] == "") then return false end
if args[1] == "fov" and args[2] ~= nil then
cl_fov = clampf(tonumber(args[2]),45,120)
mod_storage_save_number("mq_fov",cl_fov)
return true
end
return false
end
if (network_is_server()) then
function mquake_server(msg)
if msg == 'list' then
djui_chat_message_create("\\#A0FFE0\\'/mq_server StickySlope [on/off]'\\#FFFFFF\\ - Default is off")
djui_chat_message_create("\\#A0FFE0\\'/mq_server Accelerate [value]'\\#FFFFFF\\ - Default is 10")
djui_chat_message_create("\\#A0FFE0\\'/mq_server AirAccelerate [value]'\\#FFFFFF\\ - Default is 10")
djui_chat_message_create("\\#A0FFE0\\'/mq_server AirClamp [value]'\\#FFFFFF\\ - Default is 30")
djui_chat_message_create("\\#A0FFE0\\'/mq_server Gravity [value]'\\#FFFFFF\\ - Default is 800")
djui_chat_message_create("\\#A0FFE0\\'/mq_server PlayerSpeed [value]'\\#FFFFFF\\ - Default is 1.0")
djui_chat_message_create("\\#A0FFE0\\'/mq_server PlayerFriction [value]'\\#FFFFFF\\ - Default is 1.0")
djui_chat_message_create("\\#A0FFE0\\'/mq_server PlayerJumpHeight [value]'\\#FFFFFF\\ - Default is 1.0")
djui_chat_message_create("\\#A0FFE0\\'/mq_server GroundPound [on/off]'\\#FFFFFF\\ - Default is on")
djui_chat_message_create("\\#A0FFE0\\'/mq_server WallJump [on/off]'\\#FFFFFF\\ - Default is on")
djui_chat_message_create("\\#A0FFE0\\'/mq_server Interact [on/off]'\\#FFFFFF\\ - Default is on")
djui_chat_message_create("\\#A0FFE0\\'/mq_server SaveConfig [name]'\\#FFFFFF\\ - Save the current server settings to mod storage ")
djui_chat_message_create("\\#A0FFE0\\'/mq_server LoadConfig [name]'\\#FFFFFF\\ - Load settings from mod storage")
return true
end
local space = string.find(msg,' ')
if (space == nil or space < 1) then return end
local args = {[1]=string.sub(msg,1,space-1),[2]=string.sub(msg,-(string.len(msg)-space))}
if (args[2] == nil or args[2] == "") then return false end
if (args[1] == nil or args[1] == "") then return false end
if args[1] == "StickySlope" and args[2] ~= nil then
gGlobalSyncTable.Convar_StickySlope = args[2]=="on"
return true
end
if args[1] == "Accelerate" and args[2] ~= nil then
gGlobalSyncTable.Convar_Accelerate = tonumber(args[2])
return true
end
if args[1] == "AirAccelerate" and args[2] ~= nil then
gGlobalSyncTable.Convar_AirAccelerate = tonumber(args[2])
return true
end
if args[1] == "AirClamp" and args[2] ~= nil then
gGlobalSyncTable.Convar_AirClamp = tonumber(args[2])
return true
end
if args[1] == "Gravity" and args[2] ~= nil then
gGlobalSyncTable.Convar_Gravity = tonumber(args[2])
return true
end
if args[1] == "PlayerSpeed" and args[2] ~= nil then
gGlobalSyncTable.Convar_PlayerSpeed = tonumber(args[2])
return true
end
if args[1] == "PlayerFriction" and args[2] ~= nil then
gGlobalSyncTable.Convar_PlayerFriction = tonumber(args[2])
return true
end
if args[1] == "PlayerJumpHeight" and args[2] ~= nil then
gGlobalSyncTable.Convar_PlayerJumpHeight = tonumber(args[2])
return true
end
if args[1] == "GroundPound" and args[2] ~= nil then
gGlobalSyncTable.Convar_PlayerAllow_GroundPound = args[2]=="on"
return true
end
if args[1] == "WallJump" and args[2] ~= nil then
gGlobalSyncTable.Convar_PlayerAllow_WallJump = args[2]=="on"
return true
end
if args[1] == "Interact" and args[2] ~= nil then
gGlobalSyncTable.Convar_PlayerAllow_Interact = args[2]=="on"
return true
end
if args[1] == "SaveConfig" and args[2] ~= nil then
mod_storage_save_bool(args[2] .. ".ss",gGlobalSyncTable.Convar_StickySlope)
mod_storage_save_bool(args[2] .. ".gp",gGlobalSyncTable.Convar_PlayerAllow_GroundPound)
mod_storage_save_bool(args[2] .. ".wj",gGlobalSyncTable.Convar_PlayerAllow_WallJump)
mod_storage_save_bool(args[2] .. ".i",gGlobalSyncTable.Convar_PlayerAllow_Interact)
mod_storage_save_number(args[2] .. ".j",gGlobalSyncTable.Convar_PlayerJumpHeight)
mod_storage_save_number(args[2] .. ".f",gGlobalSyncTable.Convar_PlayerFriction)
mod_storage_save_number(args[2] .. ".s",gGlobalSyncTable.Convar_PlayerSpeed)
mod_storage_save_number(args[2] .. ".aa",gGlobalSyncTable.Convar_AirAccelerate)
mod_storage_save_number(args[2] .. ".a",gGlobalSyncTable.Convar_Accelerate)
mod_storage_save_number(args[2] .. ".ac",gGlobalSyncTable.Convar_AirClamp)
mod_storage_save_number(args[2] .. ".g",gGlobalSyncTable.Convar_Gravity)
djui_chat_message_create("\\#A0FFE0\\Saved settings to '" .. args[2] .. "'")
return true
end
if args[1] == "LoadConfig" and args[2] ~= nil then
if (mod_storage_load_number(args[2] .. ".s") ~= nil) then
gGlobalSyncTable.Convar_Gravity = mod_storage_load_number(args[2] .. ".g")
gGlobalSyncTable.Convar_Accelerate = mod_storage_load_number(args[2] .. ".a")
gGlobalSyncTable.Convar_AirAccelerate = mod_storage_load_number(args[2] .. ".aa")
gGlobalSyncTable.Convar_AirClamp = mod_storage_load_number(args[2] .. ".ac")
gGlobalSyncTable.Convar_PlayerSpeed = mod_storage_load_number(args[2] .. ".s")
gGlobalSyncTable.Convar_PlayerFriction = mod_storage_load_number(args[2] .. ".f")
gGlobalSyncTable.Convar_PlayerJumpHeight = mod_storage_load_number(args[2] .. ".j")
gGlobalSyncTable.Convar_PlayerAllow_GroundPound = mod_storage_load_bool(args[2] .. ".gp")
gGlobalSyncTable.Convar_PlayerAllow_WallJump = mod_storage_load_bool(args[2] .. ".wj")
gGlobalSyncTable.Convar_PlayerAllow_Interact = mod_storage_load_bool(args[2] .. ".i")
gGlobalSyncTable.Convar_StickySlope = mod_storage_load_bool(args[2] .. ".ss")
djui_chat_message_create("\\#A0FFE0\\Loaded settings from '" .. args[2] .. "'")
return true
end
end
end
else
function mquake_server(msg)
return false
end
end

View File

@ -0,0 +1,95 @@
if SM64COOPDX_VERSION == nil then return end
hook_mario_action(ACT_DM_GROUNDED_MOVEMENT, act_dm_grounded_movement)
hook_mario_action(ACT_DM_GROUNDED_IDLE, act_dm_grounded_movement)
hook_mario_action(ACT_DM_AIR_MOVEMENT, act_dm_air_movement)
hook_mario_action(ACT_GROUND_POUND, act_dm_ground_pound)
hook_mario_action(ACT_DM_GROUND_POUND_METAL, act_dm_ground_pound)
hook_mario_action(ACT_DM_GROUNDED_MOVEMENT_METAL, act_dm_grounded_movement)
hook_mario_action(ACT_DM_AIR_MOVEMENT_METAL, act_dm_air_movement)
hook_mario_action(ACT_DM_POLE_MOVEMENT, act_dm_pole_movement)
hook_mario_action(ACT_DM_WATER_MOVEMENT, act_dm_water_movement)
hook_event(HOOK_ON_PLAYER_CONNECTED, on_player_connected)
hook_event(HOOK_OVERRIDE_PHYS_STEP_DEFACTO_SPEED, override_defacto)
hook_event(HOOK_CHARACTER_SOUND, allow_voice)
hook_event(HOOK_BEFORE_SET_MARIO_ACTION, before_set_mario_action)
hook_event(HOOK_ON_SET_MARIO_ACTION, on_set_mario_action)
hook_event(HOOK_ON_LEVEL_INIT, on_level_init)
hook_event(HOOK_BEFORE_PHYS_STEP, before_phys_step)
hook_event(HOOK_ALLOW_HAZARD_SURFACE, function(m) return false end)
hook_event(HOOK_ON_INTERACT, on_interact)
hook_event(HOOK_ALLOW_INTERACT, allow_interact)
hook_event(HOOK_ON_PVP_ATTACK, on_pvp)
hook_event(HOOK_ALLOW_PVP_ATTACK, allow_pvp)
hook_event(HOOK_ON_OBJECT_RENDER, on_object_render)
hook_event(HOOK_ON_HUD_RENDER_BEHIND, render_hud_effects)
hook_event(HOOK_UPDATE, on_game_update)
hook_chat_command('mq', "[list] - \\#FFE0A0\\List all commands", mquake)
--- Server ---
if (network_is_server()) then
hook_chat_command('mq_server', "[list] - \\#A0FFE0\\List all convars/settings", mquake_server)
end
hook_on_sync_table_change(gGlobalSyncTable, 'Convar_StickySlope', 'server', function(tag, oldVal, newVal)
if (oldVal ~= newVal) and (oldVal ~= nil) then djui_chat_message_create("\\#A0FFE0\\Cvar \\#14FF14\\'StickySlope'\\#A0FFE0\\ changed from \\#14FF14\\'"..tostring(oldVal==true).."'\\#A0FFE0\\ to \\#14FF14\\'"..tostring(newVal==true).."'\\#A0FFE0\\.") end
sv_sticky = newVal
end)
hook_on_sync_table_change(gGlobalSyncTable, 'Convar_AirAccelerate', 'server', function(tag, oldVal, newVal)
if (oldVal ~= newVal) and (oldVal ~= nil) then djui_chat_message_create("\\#A0FFE0\\Cvar \\#14FF14\\'AirAccelerate'\\#A0FFE0\\ changed from \\#14FF14\\'"..tostring(oldVal).."'\\#A0FFE0\\ to \\#14FF14\\'"..tostring(newVal).."'\\#A0FFE0\\.") end
sv_airaccelerate_value = newVal
end)
hook_on_sync_table_change(gGlobalSyncTable, 'Convar_Accelerate', 'server', function(tag, oldVal, newVal)
if (oldVal ~= newVal) and (oldVal ~= nil) then djui_chat_message_create("\\#A0FFE0\\Cvar \\#14FF14\\'Accelerate'\\#A0FFE0\\ changed from \\#14FF14\\'"..tostring(oldVal).."'\\#A0FFE0\\ to \\#14FF14\\'"..tostring(newVal).."'\\#A0FFE0\\.") end
sv_accelerate = newVal
end)
hook_on_sync_table_change(gGlobalSyncTable, 'Convar_AirClamp', 'server', function(tag, oldVal, newVal)
if (oldVal ~= newVal) and (oldVal ~= nil) then djui_chat_message_create("\\#A0FFE0\\Cvar \\#14FF14\\'AirClamp'\\#A0FFE0\\ changed from \\#14FF14\\'"..tostring(oldVal).."'\\#A0FFE0\\ to \\#14FF14\\'"..tostring(newVal).."'\\#A0FFE0\\.") end
sv_playerclamp_air = newVal
end)
hook_on_sync_table_change(gGlobalSyncTable, 'Convar_PlayerSpeed', 'server', function(tag, oldVal, newVal)
if (oldVal ~= newVal) and (oldVal ~= nil) then djui_chat_message_create("\\#A0FFE0\\Cvar \\#14FF14\\'PlayerSpeed'\\#A0FFE0\\ changed from \\#14FF14\\'"..tostring(oldVal).."'\\#A0FFE0\\ to \\#14FF14\\'"..tostring(newVal).."'\\#A0FFE0\\.") end
sv_maxspeed = 180*newVal
sv_maxspeed_crouch = 80*newVal
sv_maxspeed_water = 180*newVal
sv_playerspeed = 90*newVal
sv_playerspeed_water = 90*newVal
sv_playerspeed_water_shell = 300*newVal
sv_upspeed_water = 180*newVal
sv_playerspeed_crouch = 40*newVal
end)
hook_on_sync_table_change(gGlobalSyncTable, 'Convar_Gravity', 'server', function(tag, oldVal, newVal)
if (oldVal ~= newVal) and (oldVal ~= nil) then djui_chat_message_create("\\#A0FFE0\\Cvar \\#14FF14\\'Gravity'\\#A0FFE0\\ changed from \\#14FF14\\'"..tostring(oldVal).."'\\#A0FFE0\\ to \\#14FF14\\'"..tostring(newVal).."'\\#A0FFE0\\.") end
sv_gravity = newVal
end)
hook_on_sync_table_change(gGlobalSyncTable, 'Convar_PlayerFriction', 'server', function(tag, oldVal, newVal)
if (oldVal ~= newVal) and (oldVal ~= nil) then djui_chat_message_create("\\#A0FFE0\\Cvar \\#14FF14\\'PlayerFriction'\\#A0FFE0\\ changed from \\#14FF14\\'"..tostring(oldVal).."'\\#A0FFE0\\ to \\#14FF14\\'"..tostring(newVal).."'\\#A0FFE0\\.") end
sv_friction = 4*newVal
sv_waterfriction = 2.5*newVal
end)
hook_on_sync_table_change(gGlobalSyncTable, 'Convar_PlayerJumpHeight', 'server', function(tag, oldVal, newVal)
if (oldVal ~= newVal) and (oldVal ~= nil) then djui_chat_message_create("\\#A0FFE0\\Cvar \\#14FF14\\'PlayerJumpHeight'\\#A0FFE0\\ changed from \\#14FF14\\'"..tostring(oldVal).."'\\#A0FFE0\\ to \\#14FF14\\'"..tostring(newVal).."'\\#A0FFE0\\.") end
sv_jumpheight =newVal
end)
hook_on_sync_table_change(gGlobalSyncTable, 'Convar_PlayerAllow_GroundPound', 'server', function(tag, oldVal, newVal)
if (oldVal ~= newVal) and (oldVal ~= nil) then djui_chat_message_create("\\#A0FFE0\\Cvar \\#14FF14\\'PlayerAllow_GroundPound'\\#A0FFE0\\ changed from \\#14FF14\\'"..tostring(oldVal==true).."'\\#A0FFE0\\ to \\#14FF14\\'"..tostring(newVal==true).."'\\#A0FFE0\\.") end
sv_groundpound = newVal==true
end)
hook_on_sync_table_change(gGlobalSyncTable, 'Convar_PlayerAllow_WallJump', 'server', function(tag, oldVal, newVal)
if (oldVal ~= newVal) and (oldVal ~= nil) then djui_chat_message_create("\\#A0FFE0\\Cvar \\#14FF14\\'PlayerAllow_WallJump'\\#A0FFE0\\ changed from \\#14FF14\\'"..tostring(oldVal==true).."'\\#A0FFE0\\ to \\#14FF14\\'"..tostring(newVal==true).."'\\#A0FFE0\\.") end
sv_walljump = newVal==true
end)
hook_on_sync_table_change(gGlobalSyncTable, 'Convar_PlayerAllow_Interact', 'server', function(tag, oldVal, newVal)
if (oldVal ~= newVal) and (oldVal ~= nil) then djui_chat_message_create("\\#A0FFE0\\Cvar \\#14FF14\\'PlayerAllow_Interact'\\#A0FFE0\\ changed from \\#14FF14\\'"..tostring(oldVal==true).."'\\#A0FFE0\\ to \\#14FF14\\'"..tostring(newVal==true).."'\\#A0FFE0\\.") end
sv_interact = newVal==true
end)

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,143 @@
local function sv_get_gravity() return gGlobalSyncTable.Convar_Gravity end
local function sv_get_air_accel() return gGlobalSyncTable.Convar_AirAccelerate end
local function sv_get_air_clamp() return gGlobalSyncTable.Convar_AirClamp end
local function sv_get_ground_accel() return gGlobalSyncTable.Convar_Accelerate end
local function sv_get_speed() return gGlobalSyncTable.Convar_PlayerSpeed end
local function sv_get_friction() return gGlobalSyncTable.Convar_PlayerFriction end
local function sv_get_jump_height() return gGlobalSyncTable.Convar_PlayerJumpHeight end
local function sv_get_allow_groundpound() return gGlobalSyncTable.Convar_PlayerAllow_GroundPound end
local function sv_get_allow_walljump() return gGlobalSyncTable.Convar_PlayerAllow_WallJump end
local function sv_get_allow_interact() return gGlobalSyncTable.Convar_PlayerAllow_Interact end
local function sv_set_gravity(v) gGlobalSyncTable.Convar_Gravity = v end
local function sv_set_air_accel(v) gGlobalSyncTable.Convar_AirAccelerate = v end
local function sv_set_air_clamp(v) gGlobalSyncTable.Convar_AirClamp = v end
local function sv_set_ground_accel(v) gGlobalSyncTable.Convar_Accelerate = v end
local function sv_set_speed(v) gGlobalSyncTable.Convar_PlayerSpeed = v end
local function sv_set_friction(v) gGlobalSyncTable.Convar_PlayerFriction = v end
local function sv_set_jump_height(v) gGlobalSyncTable.Convar_PlayerJumpHeight = v end
local function sv_set_allow_groundpound(v) gGlobalSyncTable.Convar_PlayerAllow_GroundPound = v end
local function sv_set_allow_walljump(v) gGlobalSyncTable.Convar_PlayerAllow_WallJump = v end
local function sv_set_allow_interact(v) gGlobalSyncTable.Convar_PlayerAllow_Interact = v end
local function cl_set_allow_action(a,o)
DM_ACTIONS[tonumber(a)] = o
end
local function cl_set_action_crouchair(a,o)
DM_ACTIONS_CROUCHAIR[tonumber(a)] = o
end
local function cl_set_action_allowgrab(a,o)
DM_ACTIONS_ALLOWGRAB[tonumber(a)] = o
end
local function cl_set_action_uses_qphys(a,o)
DM_ACTION_QPHYS[tonumber(a)] = o
end
local function cl_set_action_forceangle(a,o)
DM_ACTION_FORCEANGLE[tonumber(a)] = o
end
local function cl_set_action_transfer_to_qphys(a,o)
DM_ACTION_TRANSFERS[tonumber(a)] = o
end
local function cl_set_action_prerun_func(a,o)
DM_ACTION_PREFUNCS[tonumber(a)] = o
end
local function cl_set_action_postrun_func(a,o)
DM_ACTION_FUNCTIONS[tonumber(a)] = o
end
local function cl_set_action_ignore_fp(a,o)
DM_ACTION_DONT_OVERRIDE_FP[tonumber(a)] = o
end
local function cl_set_interaction_func(a,o)
interactOverrides[tonumber(a)] = o
end
local function cl_set_throw_func(a,o)
throwOverrides[tonumber(a)]=o
end
local function cl_set_drop_func(a,o)
dropOverrides[tonumber(a)]=o
end
local api = {
version = 1,
hotfix = 0,
server = {
get = { -- Allows modders to get server convars
stickyslope = sv_get_stickyslope,
gravity = sv_get_gravity,
airaccelerate = sv_get_air_accel,
airclamp = sv_get_air_clamp,
accelerate = sv_get_ground_accel,
speed = sv_get_speed,
friction = sv_get_friction,
jumpheight = sv_get_jump_height,
groundpound = sv_get_allow_groundpound,
walljump = sv_get_allow_walljump,
interact = sv_get_allow_interact
},
set = { -- Allows modders to override server convars
stickyslope = sv_set_stickyslope,
gravity = sv_set_gravity,
airaccelerate = sv_set_air_accel,
airclamp = sv_set_air_clamp,
accelerate = sv_set_ground_accel,
speed = sv_set_speed,
friction = sv_set_friction,
jumpheight = sv_set_jump_height,
groundpound = sv_set_allow_groundpound,
walljump = sv_set_allow_walljump,
interact = sv_set_allow_interact
}
},
physics = { -- Allows modders to access mQuakes physics functions
update = local_update,
airaccelerate = SV_AirAccelerate,
accelerate = SV_Accelerate,
playermovement = SV_PlayerMovement,
watermovement = SV_WaterMovement,
gravity = SV_UserGravityEx,
friction = SV_UserFriction,
getplayerangles = GetAngleVectors,
handlefloors = SV_HandleSpecialFloors,
addrelativevelocity = SV_PlayerMovement_Relative,
storeplayerposvel = SV_PlayerMovement_Store,
velcollide = PHYS_CollideWithNormal
},
actions = { -- Allows modders to access mQuakes action override tables
set_allow_action = cl_set_allow_action,
set_action_crouchair = cl_set_action_crouchair,
set_action_allowgrab = cl_set_action_allowgrab,
set_action_uses_qphys = cl_set_action_uses_qphys,
set_action_forceangle = cl_set_action_forceangle,
set_action_transfer_to_qphys = cl_set_action_transfer_to_qphys,
set_action_prerun_func = cl_set_action_prerun_func,
set_action_postrun_func = cl_set_action_postrun_func,
set_action_ignore_fp = cl_set_action_ignore_fp,
get_allowed_action_list = function() return DM_ACTIONS end,
get_crouchair_action_list = function() return DM_ACTIONS_CROUCHAIR end,
get_allowgrab_action_list = function() return DM_ACTIONS_ALLOWGRAB end,
get_qphys_action_list = function() return DM_ACTION_QPHYS end,
get_nofp_action_list = function() return DM_ACTION_DONT_OVERRIDE_FP end,
get_forceangle_action_list = function() return DM_ACTION_FORCEANGLE end,
get_transfer_action_list = function() return DM_ACTION_TRANSFERS end,
get_prefunc_action_list = function() return DM_ACTION_PREFUNCS end,
get_postfunc_action_list = function() return DM_ACTION_FUNCTIONS end
},
interactions = { -- Allows modders to override interactions
set_interaction_override = cl_set_interaction_func,
set_throw_override = cl_set_throw_func,
set_drop_override = cl_set_drop_func
}
}
_G.mQuake_API = api

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,4 @@
-- name: mQuake
-- incompatible: moveset
-- description: Quake style physics.\nCreated by 0x2480 with help from Agent X\n\n[Beta 2 Early Release]
-- deluxe: true
-- mQuake uncompiled is no longer available publicly. If you wish to get the code, message me.
-- deluxe: true