View Single Post
gubka
Veteran Member
Join Date: Jan 2012
Location: Russia
Old 06-25-2018 , 07:33   Re: [CS:GO] Release: Zombie Plague 7.8fix2
Reply With Quote #408

Quote:
Originally Posted by xkonsole View Post
root@zplague:/zombieplague/csgo/sound# mv sound.cache sound.cache.bkp
then changed level on server and it mysteriously works now. Thanks for a quick reply tho!
you should have sounds in the folder of 'sounds' in cs:go, another problems which i am fixed yeaterday that f you have empty block in the sounds.ini, you can have problems which generation custom sound path, but it already fixed, so update is nearly finished, i just need to finish zombies grenades effects and 4 zombie class,and i still wait fixed models pack, so hope on the weekend i will be ready to release the beta update, because it will unstable, because mod will work with offsets/virtual functions from the config and people will need to know how update them, because valve can change offsets every update.
One example of new view model module
PHP Code:
/**
 * Variables to store SDK calls handlers.
 **/
Handle hSDKCallEntityUpdateTransmitState// UpdateTransmitState will stop the view model from transmitting if EF_NODRAW flag is present
Handle hSDKCallAnimatingGetSequenceActivity;

/**
 * Variables to store virtual SDK adresses.
 **/
int Animating_StudioHdr;
int StudioHdrStruct_SequenceCount;
int VirtualModelStruct_SequenceVector_Size;
 
/**
 * StudioHdr structure.
 * https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/public/studio.h#L2371
 **/ 
enum StudioHdrClass
{
    
StudioHdrClass_StudioHdrStruct 0,
    
StudioHdrClass_VirualModelStruct 4
}

/**
 * StudioHdr structure.
 * https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/public/studio.h#L690
 **/ 
enum StudioAnimDesc
{
    
StudioAnimDesc_Fps 8,
    
StudioAnimDesc_NumFrames 16,
    
StudioAnimDesc_NumMovements 20,
}
 
/**
 * Initialize the main virtual offsets for the weapon HDR system.
 **/
void WeaponHDRInit(/*void*/)
{
    
// Loads a game config file
    
Handle hConfig LoadGameConfigFile(PLUGIN_CONFIG);

    
// Validate it
    
if(hConfig != INVALID_HANDLE)
    {
        
// Starts the preparation of an SDK call
        
StartPrepSDKCall(SDKCall_Entity);
        
PrepSDKCall_SetFromConf(hConfigSDKConf_Virtual"Entity_UpdateTransmitState");

        
//  Validate call
        
if(!(hSDKCallEntityUpdateTransmitState EndPrepSDKCall()))
        {
            
// Log failure
            
LogEvent(falseLogType_FatalLOG_CORE_EVENTSLogModule_Weapons"Config Validation""Failed to load SDK call \"UpdateTransmitState\". Update offsets in \"%s\""PLUGIN_CONFIG);
        }

        
// Starts the preparation of an SDK call
        
StartPrepSDKCall(SDKCall_Entity);
        
PrepSDKCall_SetFromConf(hConfigSDKConf_Signature"Animating_GetSequenceActivity");

        
// Adds a parameter to the calling convention. This should be called in normal ascending order
        
PrepSDKCall_AddParameter(SDKType_PlainOldDataSDKPass_Plain);
        
PrepSDKCall_SetReturnInfo(SDKType_PlainOldDataSDKPass_Plain);

        
//  Validate call
        
if(!(hSDKCallAnimatingGetSequenceActivity EndPrepSDKCall()))
        {
            
// Log failure
            
LogEvent(falseLogType_FatalLOG_CORE_EVENTSLogModule_Weapons"Config Validation""Failed to load SDK call \"Animating_GetSequenceActivity\". Update offsets in \"%s\""PLUGIN_CONFIG);
        }

        
// Load other offsets
        
fnInitGameConfOffset(hConfigAnimating_StudioHdr"Animating_StudioHdr");
        
fnInitGameConfOffset(hConfigStudioHdrStruct_SequenceCount"StudioHdrStruct_SequenceCount");
        
fnInitGameConfOffset(hConfigVirtualModelStruct_SequenceVector_Size"VirtualModelStruct_SequenceVector_Size");

        
// Close it
        
delete hConfig;
    }
    else
    {
        
// Log failure
        
LogEvent(falseLogType_FatalLOG_CORE_EVENTSLogModule_Weapons"Config Validation""Missing weapons config file: \"plugin.zombieplague\"");
    }

    
int lightingOriginOffset;
    
fnInitSendPropOffset(lightingOriginOffset"CBaseAnimating""m_hLightingOrigin");
    
    
// StudioHdr offset in gameconf is only relative to the offset of m_hLightingOrigin, in order to make the offset more resilient to game updates
    
Animating_StudioHdr += lightingOriginOffset;
}

........................................

/**
 * This function simulates the equivalent function in the SDK.
 *
 * The game has two methods for getting the sequence count:
 * 
 * 1. Local sequence count if the model has sequences built in the model itself.
 * 2. Virtual model sequence count if the model inherits the sequences from a different model, also known as an include model.
 *
 * @param iAnimating                .
 * @return 
 **/
stock int Animating_GetSequenceCount(int iAnimating)
{
    
// Load some bytes from a memory address
    
Address studioHdrClass view_as<Address>(GetEntData(iAnimatingAnimating_StudioHdr));
    
    
// Validate adress
    
if(studioHdrClass == Address_Null)
    {
        return -
1;
    }
    
    
// Load some bytes from a memory address
    
Address studioHdrStruct view_as<Address>(LoadFromAddress(studioHdrClass view_as<Address>(StudioHdrClass_StudioHdrStruct), NumberType_Int32));
    
    
// Validate adress
    
if(studioHdrStruct != Address_Null)
    {
        
int localSequenceCount LoadFromAddress(studioHdrStruct view_as<Address>(StudioHdrStruct_SequenceCount), NumberType_Int32);
        
        if(
localSequenceCount != 0)
        {
            return 
localSequenceCount;
        }
    }
    
    
// Load some bytes from a memory address
    
Address virtualModelStruct view_as<Address>(LoadFromAddress(studioHdrClass view_as<Address>(StudioHdrClass_VirualModelStruct), NumberType_Int32));
    
    
// Validate adress
    
if(virtualModelStruct != Address_Null)
    {
        return 
LoadFromAddress(virtualModelStruct view_as<Address>(VirtualModelStruct_SequenceVector_Size), NumberType_Int32);
    }
    
    
// Return on unsuccess 
    
return -1;
}

/**
 * Calls an SDK sequence activity function with the given parameters.
 *
 * If the call type is Entity or Player, the index MUST ALWAYS be the FIRST parameter passed. 
 * If the call type is GameRules, then nothing special needs to be passed. 
 * If the return value is a Vector or QAngles, the SECOND parameter must be a Float[3]. 
 * If the return value is a string, the THIRD parameter must be a String buffer, and the FOURTH parameter must be the maximum length. 
 * All parameters must be passed after the above is followed. Failure to follow these rules will result in crashes or wildly unexpected behavior!
 *
 * If the return value is a float or integer, the return value will be this value. 
 * If the return value is a CBaseEntity, CBasePlayer, or edict, the return value will always be the entity index, or -1 for NULL..
 *
 * This function is far to advanced to be cloned.
 *
 * @param iAnimating            The animation index.
 * @param nSequence             The sequence index.
 * @return                      The activity index.
 **/
stock int Animating_GetSequenceActivity(int iAnimatingint nSequence)
{
    return 
SDKCall(hSDKCallAnimatingGetSequenceActivityiAnimatingnSequence);

That is new precache function, which should remove lags on custom models
PHP Code:
/**
 * Precache file and add it to the download table.
 *
 * @param sPath             The path to file.
 * @return                  True or false.
 **/
stock bool fnMultiFilePrecache(const char[] sPath)
{
    
// Finds the first occurrence of a character in a string
    
int iDelimiter FindCharInString(sPath'@'true); //! Fix for particles
    
    // If file doesn't exist, then log, and stop
    
if(!FileExists(sPath) && iDelimiter == -1
    {
        
LogEvent(falseLogType_ErrorLOG_CORE_EVENTSLogModule_Engine"Config Validation""Missing file: %s"sPath);
        return 
false;
    }
    
    
// Finds the first occurrence of a character in a string
    
int iFormat FindCharInString(sPath'.'true);
    
    
// If model's path is don't have format, then log, and stop
    
if(iFormat == -1)
    {
        
LogEvent(falseLogType_ErrorLOG_CORE_EVENTSLogModule_Engine"Config Validation""Missing file format: %s"sPath);
        return 
false;
    }
    
    
// Add to precache if path contains '.mdl'
    
if(!strcmp(sPath[iFormat], ".mdl"false))
    {
        
// If model doesn't precache yet, then continue
        
if(!IsModelPrecached(sPath))
        {
            
// Add file to download table
            
AddFileToDownloadsTable(sPath);
            
            
// Precache file
            
PrecacheModel(sPathtrue);
        }
    }
    
// Add to precache if path contains '.mp3' or '.wav'
    
else if(!strcmp(sPath[iFormat], ".mp3"false) || !strcmp(sPath[iFormat], ".wav"false))
    {
        
// Copy one string onto another
        
static char sSound[PLATFORM_MAX_PATH];
        
strcopy(sSoundsizeof(sSound), sPath);

        
/// Look here: https://wiki.alliedmods.net/Csgo_quirks#Fake_precaching_and_EmitSound
        
if(ReplaceStringEx(sSoundsizeof(sSound), "sound""*"51true) != -1)
        {
            
// If sound doesn't precache yet, then continue
            
if(fnGetTableItemIndex("soundprecache"sSound) == INVALID_STRING_INDEX)
            {
                
// Add file to download table
                
AddFileToDownloadsTable(sPath);

                
// Precache sound
                ///bool bSave = LockStringTables(false);
                
AddToStringTable(fnGetTableIndex("soundprecache"), sSound);
                
///LockStringTables(bSave);
            
}
        }
        else
        {
            
LogEvent(falseLogType_ErrorLOG_CORE_EVENTSLogModule_Engine"Config Validation""Wrong sound path: %s"sPath);
            return 
false;
        }
    }
    
// Add to precache if path contains '.pcf'
    
else if(!strncmp(sPath[iFormat], ".pcf"4false))
    {
        
// Cut out name at the end of a line
        
static char sParticle[NORMAL_LINE_LENGTH];
        if(
SplitString(sPath"@"sParticlesizeof(sParticle)) != -1)
        {
            
// Add file to download table
            
AddFileToDownloadsTable(sParticle);
            
            
// Precache generic
            
PrecacheGeneric(sParticletrue); //! Precache only here

            // If particle doesn't precache yet, then continue
            ///if(fnGetTableItemIndex("ParticleEffectNames", sPath[iDelimiter+1]) == INVALID_STRING_INDEX) => NOT WORK!!! WTF???

            // Precache particle
            
bool bSave LockStringTables(false);
            
AddToStringTable(fnGetTableIndex("ParticleEffectNames"), sPath[iDelimiter+1]);
            
LockStringTables(bSave);
        }
        else
        {
            
LogEvent(falseLogType_ErrorLOG_CORE_EVENTSLogModule_Engine"Config Validation""Wrong particle path: %s"sPath);
            return 
false;
        }
    }
    
// Add to precache if path contains '.vtf'
    
else if(!strcmp(sPath[iFormat], ".vtf"false))
    {
        
// If decal doesn't precache yet, then continue
        
if(!IsDecalPrecached(sPath))
        {
            
// Add file to download table
            
AddFileToDownloadsTable(sPath);
            
            
// Precache file
            
PrecacheDecal(sPathtrue);
        }
    }
    else
    {
        
// Add file to download table
        
AddFileToDownloadsTable(sPath);
    }
    
    
// Return on success
    
return true;

__________________

Last edited by gubka; 06-25-2018 at 07:39.
gubka is offline
Send a message via ICQ to gubka