local function minecart2DFix(mo)
    if not twodlevel then return end
    if not (mo and mo.valid) then return end
    if not (mo.subsector and mo.subsector.sector) then return end
    
    if mo.angle_lasttic != nil and mo.speed_lasttic != nil
    and mo.angle != mo.angle_lasttic then
        mo.momx = FixedMul(mo.speed_lasttic, cos(mo.angle))
        mo.momy = FixedMul(mo.speed_lasttic, sin(mo.angle))
    end
    
    mo.angle_lasttic = mo.angle
    mo.speed_lasttic = FixedHypot(mo.momx, mo.momy)
end

addHook("MobjThinker", minecart2DFix, MT_MINECART)