Admer456 / halflife-vs2019-sohl12

Spirit of Half-Life 1.2 merged with Solokiller's updated HL SDK. Status: inactive
Other
6 stars 5 forks source link

Result of a comparison between this branch and halflife-updated #18

Open LogicAndTrick opened 3 years ago

LogicAndTrick commented 3 years ago

I compared your branch to my own version of SOHL 1.2 to see if either of us made any mistakes when doing the conversions - here are the results. I'm not sure if all of these are bugs, so please take a look at each one to see what you think. There are a LOT, so I'll split them into multiple comments and check them off (I added convenient checkboxes) when you're happy with them.

Client code

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/cl_dll/ammo.cpp#L537-L539 Should be:

    gHUD.m_iHideHUDDisplay = READ_BYTE();

    if (gEngfuncs.IsSpectateOnly())
        return 1;

    //LRCT - experiment to allow a custom crosshair.

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/cl_dll/ammo.cpp#L627

In halflife-updated this is check is not performed - it always sets the crosshair and doesn't look at m_iHideHUDDisplay. Not sure if this one is a bug in halflife-updated or not.


https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/cl_dll/geiger.cpp#L71-L78

The if (m_iGeigerRange > 800) condition does not exist in halflife-updated or SOHL. I don't think this code would ever run because of the if (m_iGeigerRange <= 800 && m_iGeigerRange > 0) condition, anyway.


https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/cl_dll/hud_spectator.cpp#L1560

Should be:

    UnpackRGB(ir,ig,ib, gHUD.m_iHUDColor);

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/cl_dll/hl/hl_weapons.cpp#L628-L635

This method doesn't exist in HL-U.

LogicAndTrick commented 3 years ago

Common

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/common/const.h#L610-L616

This is in SOHL as well - CONTENT_SOLID is declared twice for no reason.


https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/common/const.h#L720

More of a note - Steam added kRenderFxLightMultiplier which uses renderFx number 21 as well. I moved kRenderFxReflection to be number 22 instead in my own branch, but that this would break compatibility with any existing maps that use this renderFx - they would need to be updated and recompiled. I don't know how kRenderFxLightMultiplier works or if it would conflict with kRenderFxReflection or not.

LogicAndTrick commented 3 years ago

Server code 1

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/AI_BaseNPC_Schedule.cpp#L905

In SOHL 1.2 this also checks !m_pGoalEnt:

if ( !m_pGoalEnt || (m_pGoalEnt->pev->origin - pev->origin).Length() < 1 )

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/basemonster.h#L341-L344

There should only be one declaration of DropItem (the one with const char *pszItemName matches HL-U).


https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/cbase.cpp#L439

SOHL declares this function for WriteFields but doesn't implement it. It should be:

saveHelper.WriteFields( "SWF", pname, pBaseData, pFields, fieldCount );

Same here:

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/cbase.cpp#L808-L811

Should be:

if (pev->targetname)
    return save.WriteFields( STRING(pev->targetname), "BASE", this, m_SaveData, ARRAYSIZE(m_SaveData) );
else
    return save.WriteFields( STRING(pev->classname), "BASE", this, m_SaveData, ARRAYSIZE(m_SaveData) );

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/client.cpp#L55

Missing gmsgHUDColor

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/client.cpp#L513-L517

SOHL has commands for hud_color and VModEnable here.


https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/client.cpp#L1151

Should be:

if ( ( ent->v.effects & EF_NODRAW ) &&

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/defaultai.cpp#L1104-L1106

Should be:

case 0: 
    return slWaitScript;
case 4: case 6:
    return slTeleportToScript;
LogicAndTrick commented 3 years ago

Server code 2

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/doors.cpp#L750-L751

Should be:

if ( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
{
    if ( m_toggle_state != TS_GOING_UP && m_toggle_state != TS_GOING_DOWN )
        EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM);
}

Same in DoorGoDown:

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/doors.cpp#L859-L860

if ( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
{
    if ( m_toggle_state != TS_GOING_UP && m_toggle_state != TS_GOING_DOWN )
        EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM);
}

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/doors.cpp#L1151

MomentaryMoveDone was renamed to DoorMoveDone.


https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/doors.cpp#L1296-L1297

An extra check was added:

    if ( value > 1.0 )
        value = 1.0;
    if ( value < 0.0 )
        value = 0.0;

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/doors.cpp#L1337-L1341

Was updated to:

//
// The door has reached needed position.
//
void CMomentaryDoor::DoorMoveDone( void )
{
    m_iState = STATE_OFF;
    STOP_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving) );
    EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseArrived), 1, ATTN_NORM);
}
LogicAndTrick commented 3 years ago

Server code 3

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/gauss.cpp#L150

And

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/gauss.cpp#L188

Should be using GetNextAttackDelay.


https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/genericmonster.cpp#L127-L130

Should return bits_SOUND_NONE (though both these constants resolve to 0)

Also in: https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/gman.cpp#L113


https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/monsters.cpp#L118-L123

Is:

int CBaseMonster::Save( CSave &save )
{
    if ( !CBaseToggle::Save(save) )
        return 0;
    if ( pev->targetname )
        return save.WriteFields( STRING(pev->targetname), "CBaseMonster", this, m_SaveData, ARRAYSIZE(m_SaveData) );
    else
        return save.WriteFields( STRING(pev->classname), "CBaseMonster", this, m_SaveData, ARRAYSIZE(m_SaveData) );
}

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/mpstubb.cpp#L59

And

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/mpstubb.cpp#L83

Should be using SetNextThink.


https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/plats.cpp#L469

Should be:

if (!pOther->IsAlive()||!m_pPlatform||!m_pPlatform->pev)

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/player.cpp#L1545-L1556

StartObserver is not called in HL-U, this is what I went with for these lines:

    CopyToBodyQue( pev );

    UTIL_SetOrigin( this, pSpot->pev->origin );
    pev->angles = pev->v_angle = pSpot->pev->v_angle;
}
else
{
    // no intermission spot. Push them up in the air, looking down at their corpse
    TraceResult tr;
    CopyToBodyQue( pev );
    UTIL_TraceLine( pev->origin, pev->origin + Vector( 0, 0, 128 ), ignore_monsters, edict(), &tr );

    UTIL_SetOrigin( this, tr.vecEndPos );
    pev->angles = pev->v_angle = UTIL_VecToAngles( tr.vecEndPos - pev->origin  );
}

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/player.cpp#L2835-L2836

These two lines were removed (as they are repeated later in the method).


https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/player.cpp#L3173

Should be:

return save.WriteFields( "cPLAYER", "PLAYER", this, m_playerSaveData, ARRAYSIZE(m_playerSaveData) );

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/player.cpp#L3566-L3568

SOHL adds an extra check:

void CBasePlayer :: FlashlightTurnOff( void )
{
    if (FlashlightIsOn())
        EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, SOUND_FLASHLIGHT_OFF, 1.0, ATTN_NORM, 0, PITCH_NORM );

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/player.cpp#L4432-L4439

Should be:

void CBasePlayer :: EnableControl(BOOL fControl)
{
    if (!fControl)
    {
        pev->flags |= FL_FROZEN;
        pev->velocity = g_vecZero; //LRC - stop view bobbing
    }
    else
        pev->flags &= ~FL_FROZEN;
}
LogicAndTrick commented 3 years ago

Server code 4

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/python.cpp#L236-L239

HL-U doesn't have the m_flSoundDelay = 1.5; part of this. Is it a problem with HL-U?

Also, it doesn't have this code either:

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/python.cpp#L249-L254


https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/saverestore.h#L63-L65

Both these WriteFunctions should have void **value instead of const int *value.


https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/saverestore.h#L124

SOHL updates this to:

if (pev->targetname)\
    return save.WriteFields( STRING(pev->targetname), #derivedClass, this, m_SaveData, ARRAYSIZE(m_SaveData) );\
else\
    return save.WriteFields( STRING(pev->classname), #derivedClass, this, m_SaveData, ARRAYSIZE(m_SaveData) );\

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/scientist.cpp#L431

Should be:

    PlaySentence( m_szGrp[TLK_DECLINE], 2, VOL_NORM, ATTN_NORM ); //LRC

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/triggers.cpp#L2708

Should be:

    CLIENT_COMMAND ( pClient, "cd stop\n");

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/util.cpp#L1333-L1336

SOHL changed this to:

// LRC- correct for deltas > 360
while ( delta < -180 )
    delta += 360;
while ( delta > 180 )
    delta -= 360;

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/util.cpp#L2387-L2396

Here's why all those other save functions didn't break. I think it's option if you want to change this or not, I don't know if the extra debugging output is too useful in SOHL.

void CSave :: WriteFunction(const char* cname, const char* pname, void** data, int count)
{
    const char *functionName;

    functionName = NAME_FOR_FUNCTION( (uint32)*data );
    if ( functionName )
        BufferField( pname, strlen(functionName) + 1, functionName );
    else
        ALERT( at_error, "Member \"%s\" of \"%s\" contains an invalid function pointer %p!", pname, cname, *data );
}

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/util.cpp#L2449-L2452

int CSave :: WriteEntVars( const char *pname, entvars_t *pev )
{
    if (pev->targetname)
        return WriteFields( STRING(pev->targetname), pname, pev, gEntvarsDescription, ENTVARS_COUNT );
    else
        return WriteFields( STRING(pev->classname), pname, pev, gEntvarsDescription, ENTVARS_COUNT );
}

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/util.cpp#L2456

int CSave :: WriteFields( const char *cname, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount )

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/util.cpp#L2555

    WriteFunction( cname, pTest->fieldName, (void **)pOutputData, pTest->fieldSize );
LogicAndTrick commented 3 years ago

Server code 5

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/weapons.cpp#L337

SOHL also precaches the ammo_9mmbox:

    UTIL_PrecacheOther( "ammo_9mmclip" );
    UTIL_PrecacheOther( "ammo_9mmbox" ); //LRC

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/weapons.h#L615

Related to the other python.cpp stuff - this field is removed in HL-U. Not sure why?


https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/dlls/world.cpp#L373

2 calls to WriteFields in this method to be changed if you plan on adding the cname parameter to it.


https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/game_shared/voice_gamemgr.cpp#L243-L244

HL-U changes this to:

if(pEnt && (bAllTalk || m_pHelper->CanPlayerHearPlayer(pPlayer, (CBasePlayer*)pEnt)) )

https://github.com/Admer456/halflife-vs2019-sohl12/blob/b1d31df42eee84d68f612e7e7d5a0f898cde56b1/pm_shared/pm_shared.cpp#L156

SOHL has some extra constants here:

#define CONTENTS_TRANSLUCENT    -15
//LRC
#define CONTENTS_FLYFIELD       -17
#define CONTENTS_FLYFIELD_GRAVITY   -18
#define CONTENTS_FOG            -19

Those constants are used in a number of places in pm_shared and are missing.

Alo missing from pm_shared is:

LogicAndTrick commented 3 years ago

That's it - all the other differences I could find were minor and not important (e.g. at_console vs. at_debug). Sorry for the spam!

hammermaps commented 3 years ago

That's great of you, I find it very exciting to see what other changes have been made.

I think they are very useful, some of these changes I noticed and should be included in the source code.

Admer456 commented 3 years ago

This is not 'spam' - this is 'not enough'. :D

I'll take a look at each of these sometime in January, as I am in a bit of a clutch right now, juggling between high school and a game project.