alliedmodders / hl2sdk

Half-Life 2 SDK Mirrors
https://github.com/valvesoftware
342 stars 165 forks source link

fix movetype #243

Closed 1mpulse closed 4 months ago

GAMMACASE commented 4 months ago

Is that a recent change, or what are you basing this of off? From the sdk schema dump from one month ago the enum is correct.

zer0k-z commented 4 months ago

This doesn't look right, the LadderMove reversed pseudocode looks like this:

  if ( sub_80CF20(*(a1 + 48)) == 7 || sub_80CF20(*(a1 + 48)) == 8 ) // player->GetMoveType() == MOVETYPE_NOCLIP || player->GetMoveType() == MOVETYPE_OBSERVER
    return;
  if ( sub_80CF20(*(a1 + 48)) == 9 )
  {
    // wishdir = -player->m_vecLadderNormal.Get();
    *&v15 = 0x80000000LL;
    v31 = *(a1 + 560);
    v32 = -*(a1 + 552);
    v120 = -*(a1 + 556);
    v119 = v32;
    v121 = -v31;
  }

In gamemovement.cpp in the sdk:

    if ( player->GetMoveType() == MOVETYPE_NOCLIP )
        return false;

    if ( !GameHasLadders() )
        return false;

    // If I'm already moving on a ladder, use the previous ladder direction
    if ( player->GetMoveType() == MOVETYPE_LADDER )
    {
        wishdir = -player->m_vecLadderNormal.Get();
    }
1mpulse commented 4 months ago

movetype_ladder should be 9, but it is 10. I agree, what I suggested is hasty and wrong, the offset is much earlier, but it is there.

1mpulse commented 4 months ago

enum class MoveType_t : uint8_t
{
    MOVETYPE_NONE = 0x0,
    MOVETYPE_OBSOLETE = 0x1,
    MOVETYPE_WALK = 0x2,
    MOVETYPE_FLY = 0x3,
    MOVETYPE_FLYGRAVITY = 0x4,
    MOVETYPE_VPHYSICS = 0x5,
    MOVETYPE_PUSH = 0x6,
    MOVETYPE_NOCLIP = 0x7,
    MOVETYPE_OBSERVER = 0x8,
    MOVETYPE_LADDER = 0x9,
    MOVETYPE_CUSTOM = 0xa,
    MOVETYPE_LAST = 0xb,
    MOVETYPE_INVALID = 0xb,
    MOVETYPE_MAX_BITS = 0x5,
};
GAMMACASE commented 4 months ago

MOVETYPE_STEP is what needs to be removed then.

1mpulse commented 4 months ago

now that it looks right.

GAMMACASE commented 4 months ago

Thanks!

GAMMACASE commented 4 months ago

Just a heads up, apparently this change was already been done at https://github.com/alliedmodders/hl2sdk/commit/60fb2b6d763fb4233a2ab3dbd4f155346edb3326, and you are using very old version of a hl2sdk, so please update it before pr'ing to not bring any confusion later on.