Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Effect - Emitter - Update.c
    »Author«    Andrew Aye (EMail: mailto:andrew.aye@gmail.com, Web: http://www.andrewaye.com)
    »Version«   4.51 / »GUID« A9981407-3EC9-42AF-8B6F-8BE6DD919615                                                                                                        */
/*   -------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
/*  Copyright: © 2002-2017, Andrew Aye.  All Rights Reserved.
    This software is free for non-commercial use.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
      following conditions are met:
        Redistribution of source code must retain this copyright notice, this list of conditions and the following disclaimers.
        Redistribution in binary form must reproduce this copyright notice, this list of conditions and the following disclaimers in the documentation and other materials
          provided with the distribution.
    The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
    The intellectual property rights of the algorithms used reside with Andrew Aye.
    You may not use this software, in whole or in part, in support of any commercial product without the express written consent of the author.
    There is no warranty or other guarantee of fitness of this software for any purpose. It is provided solely "as is".                                                   */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */

#define T_NAME( A, ... ) A##Emitter##__VA_ARGS__
#define T_TYPE( A, ... ) A##EMITTER##__VA_ARGS__
#define T_TEXT( ... ) __VA_ARGS__ TgT("Emitter")
#define T_EFFECT_TIME_DEFAULT 0
#define T_EFFECT_NOTIFY 1

#include "TgS Effect - Effect - Type.h_inc"
#include "TgS Effect - Internal.inl"


/* == Effect ============================================================================================================================================================ */

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Shared Implementation                                                                                                                                                 */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

#include "TgS Effect - Effect - Update.i_inc"
#include "TgS Effect - Effect - Update.c_inc"




/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  External Functions                                                                                                                                                    */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

TgEXTN TgVOID                               tgFX__Update__Emitter_Add_Particle( P_STg2_FX__Emitter, C_TgFLOAT32, TgSINT32 );
TgEXTN TgVOID                               tgFX__Update__Emitter_Update_Particle( P_STg2_FX__Emitter, C_TgFLOAT32, TgVEC_M_F32_04 );




/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  File Local Functions                                                                                                                                                  */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

static TgBOOL                               tgFX__Update__Emitter_Reserve_Particle_Buffer( P_STg2_FX__Emitter );
static TgVOID                               tgFX__Update__Emitter_Free_Particle_Buffer( P_STg2_FX__Emitter );




/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Private Functions                                                                                                                                                     */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

/* ---- tgFX__File__Emitter_Patch_File_Data ------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgVOID tgFX__File__Emitter_Patch_File_Data( P_STg2_FX_Emitter__File_Data psData )
{
    TgUINTPTR                           uiData_Top;

    uiData_Top = (TgUINTPTR)psData;

    psData->m_sAnim.m_sData_Offset.m_uiEmitter_LVel_M += uiData_Top;
    psData->m_sAnim.m_sData_Offset.m_uiEmitter_Rot_M += uiData_Top;
    psData->m_sAnim.m_sData_Offset.m_uiEmission_Shape += uiData_Top;
}




/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Parent File Local Functions                                                                                                                                           */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

/* ---- tgFX__Update__Emitter_Create_Command ---------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
static TgBOOL tgFX__Update__Emitter_Create_Command( CP_STg2_FX_Instance UNUSED_PARAM psInst, C_TgFX_DATA_INST_ID tiData, CP_TgVOID pData1 )
{
    CP_STg2_FX_Emitter__File_Data       psFile_Data;
    P_STg2_FX__Emitter                  psEmitter;

    psEmitter = g_asFX__Emitter + tiData.m.iI;
    psFile_Data = psEmitter->m_psFile_Data;

    if (nullptr == pData1)
    {
        return (TgFALSE);
    };

    tgFX__Update__Set_Render_Data_From_Material_Hash(
        0 != (psFile_Data->m_uiFlags & ETgFX_EMITTER_FLAGS__EMISSION__MESH_SET) ? &psEmitter->m_tiMesh_Set : nullptr,
        &psEmitter->m_tiMaterial, &psEmitter->m_enVertex, psFile_Data->m_uiHash_Material );

    if (TgTRUE != tgRN_MATERIAL_ID_Is_Valid( psEmitter->m_tiMaterial ))
    {
        return (TgFALSE);
    };

    psEmitter->m_sExtend.m_fEmission_Interval = tgFX_Quality_Setting_Lerp__Range_F32( psFile_Data->m_afEmission_Interval_MID, psFile_Data->m_afEmission_Interval_RNG );
    psEmitter->m_sExtend.m_fEmission_Quantity = tgFX_Quality_Setting_Lerp__Range_F32( psFile_Data->m_afEmission_Quantity_MID, psFile_Data->m_afEmission_Quantity_RNG );
    psEmitter->m_sExtend.m_niParticle_Max = tgFX_Quality_Setting_Lerp__Value_S32( psFile_Data->m_aniEmission_Max_Particle );

    if (TgFALSE == tgFX__Update__Emitter_Reserve_Particle_Buffer( psEmitter ))
    {
        return (TgFALSE);
    };

    psEmitter->m_sExtend.m_psFile_Data__Particle = pData1;
    psEmitter->m_sExtend.m_vLVel_M = tgFX_Evaluate_AnimData_F32_04( psFile_Data->m_sAnim.m_sParameter.m_psEmitter_LVel_M, MS_SET1_F32_04( 0.0F ) );
    psEmitter->m_sExtend.m_vEmission_Shape = tgFX_Evaluate_AnimData_F32_04( psFile_Data->m_sAnim.m_sParameter.m_psEmission_Shape, MS_SET1_F32_04( 0.0F ) );
    psEmitter->m_sExtend.m_niParticle = 0;
    psEmitter->m_sExtend.m_niParticle_Render = 0;

    if (psEmitter->m_fTime_End__Start < 0.0F)
        g_aenFX__Emitter__Shared__State[tiData.m.iI] = ETgFX_EFFECT_STATE__UPDATE__ACTIVE_INFINITE;
    else
        g_aenFX__Emitter__Shared__State[tiData.m.iI] = ETgFX_EFFECT_STATE__UPDATE__ACTIVE_FIRST;

    return (TgTRUE);
}


/* ---- tgFX__Update__Emitter_Update ------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
static TgVOID tgFX__Update__Emitter_Update( TgVEC_M_F32_04 vdT, C_TgFLOAT32 fDT, C_ETgFX_UPDATE enUpdate )
{
    TgFX_DATA_INST_ID                   tiActive;
    P_STg2_FX__Emitter                  psEmitter;
    CP_STg2_FX_Emitter__File_Data       psFile_Data;

    tiActive = T_NAME( s_atiFX__, __Update__Head )[enUpdate];

    while (TgFALSE != tgFX_DATA_INST_ID_Is_Valid( tiActive ))
    {
        TgVEC_M_F32_04                      vPos_Delta_M;

        tgFX__Update__Emitter_Diag_Check_Effect( tiActive );

        psEmitter = g_asFX__Emitter + tiActive.m.iI;
        psFile_Data = psEmitter->m_psFile_Data;

        /* Life Time Update */
        TgDIAG( ETgFX_EFFECT_STATE__UPDATE__ACTIVE_WAITING_TO_DIE >= g_aenFX__Emitter__Shared__State[tiActive.m.iI] );
        TgDIAG( ETgFX_EFFECT_STATE__UPDATE__ACTIVE <= g_aenFX__Emitter__Shared__State[tiActive.m.iI] );
        if (ETgFX_EFFECT_STATE__UPDATE__ACTIVE == g_aenFX__Emitter__Shared__State[tiActive.m.iI])
        {
            if (psEmitter->m_fLife_Time <= fDT)
            {
                psEmitter->m_fLife_Time = 0.0F;
                g_aenFX__Emitter__Shared__State[tiActive.m.iI] = ETgFX_EFFECT_STATE__UPDATE__ACTIVE_WAITING_TO_DIE;
            }
            else
            {
                psEmitter->m_fLife_Time -= fDT;
            };
        }
        else if (ETgFX_EFFECT_STATE__UPDATE__ACTIVE_INFINITE == g_aenFX__Emitter__Shared__State[tiActive.m.iI])
        {
            /* Intentionally left blank */
        }
        else if (ETgFX_EFFECT_STATE__UPDATE__ACTIVE_FIRST == g_aenFX__Emitter__Shared__State[tiActive.m.iI])
        {
            g_aenFX__Emitter__Shared__State[tiActive.m.iI] = ETgFX_EFFECT_STATE__UPDATE__ACTIVE;
        }
        else if (ETgFX_EFFECT_STATE__UPDATE__ACTIVE_WAITING_TO_DIE == g_aenFX__Emitter__Shared__State[tiActive.m.iI])
        {
            /* Intentionally left blank */
        }
        else
        {
            tgFX__Update__Command__Emitter_Kill_Self( psEmitter->m_tiData );
            tiActive = g_asFX__Emitter[tiActive.m.iI].m_tiNext[ETgFX_NEXT__UPDATE];
            TgERROR_MSGF( 0, TgT( "%-16.16s(%-32.32s): Invalid Effect State.\n" ), TgT("Effect"), TgT("tgFX__Emitter__Update__Update") );
            continue;
        };

        vPos_Delta_M = tgFX_Integrate_AnimData_F32_04( psFile_Data->m_sAnim.m_sParameter.m_psEmitter_LVel_M, vdT, psEmitter->m_vLive_Time );

        psEmitter->m_qRot_M = tgFX_Evaluate_AnimData_F32_04( psFile_Data->m_sAnim.m_sParameter.m_psEmitter_Rot_M, psEmitter->m_vLive_Time );
        psEmitter->m_vPos_M = M_ADD_F32_04( psEmitter->m_vPos_M, vPos_Delta_M );
        psEmitter->m_qRot_W = M_QT_MUL_F32_04( psEmitter->m_qRot_M, psEmitter->m_qRot_M2W );
        psEmitter->m_vPos_W = M_ADD_F32_04( psEmitter->m_vPos_M2W, M_QT_TX_F32_04( psEmitter->m_vPos_M, psEmitter->m_qRot_M2W ) );
        psEmitter->m_vPos_W = M_MAD_F32_04( MS_SET1_F32_04( 0.5F*fDT*fDT ), psFile_Data->m_vL_Vel_Acceleration_W, psEmitter->m_vPos_W );
        psEmitter->m_vLive_Time = M_ADD_F32_04( psEmitter->m_vLive_Time, vdT );
        psEmitter->m_fLive_Time += fDT;
        psEmitter->m_sExtend.m_vEmission_Shape = tgFX_Evaluate_AnimData_F32_04( psFile_Data->m_sAnim.m_sParameter.m_psEmission_Shape, psEmitter->m_vLive_Time );


        /* Particle Update */
        if (ETgFX_EFFECT_STATE__UPDATE__ACTIVE_WAITING_TO_DIE == g_aenFX__Emitter__Shared__State[tiActive.m.iI])
        {
            tgFX__Update__Emitter_Update_Particle( psEmitter, fDT, vdT );

            if (0 >= psEmitter->m_sExtend.m_niParticle)
            {
                tgFX__Update__Command__Emitter_Kill_Self( psEmitter->m_tiData );
            };
        }
        else
        {
            if (psEmitter->m_sExtend.m_fEmission_Interval <= fDT)
            {
                TgFLOAT32                           fEmission_Quantity;

                fEmission_Quantity = tgPM_FLOOR_F32( psEmitter->m_sExtend.m_fEmission_Quantity );

                psEmitter->m_sExtend.m_fEmission_Interval = tgFX_Quality_Setting_Lerp__Range_F32(
                    psFile_Data->m_afEmission_Interval_MID, psFile_Data->m_afEmission_Interval_RNG );
                psEmitter->m_sExtend.m_fEmission_Quantity -= fEmission_Quantity;
                psEmitter->m_sExtend.m_fEmission_Quantity += tgFX_Quality_Setting_Lerp__Range_F32(
                    psFile_Data->m_afEmission_Quantity_MID, psFile_Data->m_afEmission_Quantity_RNG );

                if (0.0f < fEmission_Quantity)
                {
                    tgFX__Update__Emitter_Add_Particle( psEmitter, fDT, (TgSINT32)fEmission_Quantity );
                };
            }
            else
            {
                psEmitter->m_sExtend.m_fEmission_Interval -= fDT;
            };

            tgFX__Update__Emitter_Update_Particle( psEmitter, fDT, vdT );
        };

        tiActive = psEmitter->m_tiNext[ETgFX_NEXT__UPDATE];
    };
}


/* ---- tgFX__Update__Emitter_Process_Update_Command -------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID tgFX__Update__Emitter_Process_Update_Command( C_ETgFX_COMMAND enCommand, CP_TgVOID pData, C_TgFX_DATA_INST_ID tiData )
{
    tgFX__Update__Emitter_Process_Update_Command_Default( enCommand, pData, tiData );

    if (ETgFX_COMMAND__CLIENT_TO_UPDATE__KILL == enCommand)
    {
        tgFX__Update__Emitter_Free_Particle_Buffer( g_asFX__Emitter + tiData.m.iI );
    };
}




/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  File Local Functions                                                                                                                                                  */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

/* ---- tgFX__Update__Emitter_Reserve_Particle_Buffer ------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
static TgBOOL tgFX__Update__Emitter_Reserve_Particle_Buffer( P_STg2_FX__Emitter psEmitter )
{
    TgSINT32                            iPage_Size;
    TgSINT32                            iMemory_Current;
    TgSINT32                            iMemory_New;
    TgSINT32                            niMin_Particle;
    TgSINT32                            iMax_Commit;
    TgSINT32                            iMin_Commit;
    TgSINT32                            iIndex;

    psEmitter->m_sExtend.m_niParticle_Commit = 0;
    psEmitter->m_sExtend.m_psParticle_Active = nullptr;
    psEmitter->m_sExtend.m_psParticle_Free = nullptr;
    psEmitter->m_sExtend.m_psParticle_Memory = nullptr;

    iPage_Size = (TgSINT32)tgMM_Page_Size();

    /* Determine if the emitter max allocation fits into max memory limit for the module / system */
    niMin_Particle = tgCM_MAX_S32( 1, tgCM_MIN_S32( (TgSINT32)psEmitter->m_sExtend.m_fEmission_Quantity, psEmitter->m_sExtend.m_niParticle_Max ) );
    iMax_Commit = 1 + (psEmitter->m_sExtend.m_niParticle_Max * (TgSINT32)sizeof( STg2_FX__Emitter__Particle ) / iPage_Size);
    iMin_Commit = 1 + (niMin_Particle * (TgSINT32)sizeof( STg2_FX__Emitter__Particle ) / iPage_Size);
    TgERROR( iMin_Commit <= iMax_Commit );
    do
    {
        iMemory_Current = tgAM32_READ( &g_xiFX__Emitter__Memory_Current );
        iMemory_New = iMemory_Current + iMax_Commit * iPage_Size;
        if (iMemory_New > g_iFX_Emitter_Memory_Max)
        {
            return (TgFALSE);
        };
    }
    while (iMemory_Current != tgAM32_XCMP( &g_xiFX__Emitter__Memory_Current, iMemory_New, iMemory_Current ));

    /* Reserve enough memory for max number of particles */
    psEmitter->m_sExtend.m_psParticle_Memory = TgRESERVE_VIRTUAL( (TgSIZE)(iMax_Commit * iPage_Size) );
    if (nullptr == psEmitter->m_sExtend.m_psParticle_Memory)
    {
        do
        {
            iMemory_Current = tgAM32_READ( &g_xiFX__Emitter__Memory_Current );
            iMemory_New = iMemory_Current - iMax_Commit * iPage_Size;
        }
        while (iMemory_Current != tgAM32_XCMP( &g_xiFX__Emitter__Memory_Current, iMemory_New, iMemory_Current ));
        return (TgFALSE);
    };

    /* Commit enough memory for one memory page, or one particle */
    if (nullptr == TgCOMMIT_VIRTUAL( psEmitter->m_sExtend.m_psParticle_Memory, (TgSIZE)iMin_Commit ))
    {
        do
        {
            iMemory_Current = tgAM32_READ( &g_xiFX__Emitter__Memory_Current );
            iMemory_New = iMemory_Current - iMax_Commit * iPage_Size;
        }
        while (iMemory_Current != tgAM32_XCMP( &g_xiFX__Emitter__Memory_Current, iMemory_New, iMemory_Current ));
        return (TgFALSE);
    };

    /* Initialize the linked list of free particles and record the number of particles on committed memory pages */
    psEmitter->m_sExtend.m_niParticle_Commit = iMin_Commit;
    for (iIndex = 0; iIndex + 1 < psEmitter->m_sExtend.m_niParticle_Commit; ++iIndex)
    {
        psEmitter->m_sExtend.m_psParticle_Memory[iIndex].m_psNext = psEmitter->m_sExtend.m_psParticle_Memory + iIndex + 1;
    };
    psEmitter->m_sExtend.m_psParticle_Memory[iIndex].m_psNext = nullptr;
    psEmitter->m_sExtend.m_psParticle_Free = psEmitter->m_sExtend.m_psParticle_Memory;
    psEmitter->m_sExtend.m_psParticle_Active = nullptr;

    return (TgTRUE);
}


/* ---- tgFX__Update__Emitter_Free_Particle_Buffer ---------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
static TgVOID tgFX__Update__Emitter_Free_Particle_Buffer( P_STg2_FX__Emitter psEmitter )
{
    TgSINT32                            iMemory_Current;
    TgSINT32                            iMemory_New;
    TgSINT32                            iMax_Commit;

    iMax_Commit = (TgSINT32)(1 + ((TgSIZE)psEmitter->m_sExtend.m_niParticle_Max * sizeof( STg2_FX__Emitter__Particle ) / tgMM_Page_Size()));

    if (nullptr != psEmitter->m_sExtend.m_psParticle_Memory)
    {
        do
        {
            iMemory_Current = tgAM32_READ( &g_xiFX__Emitter__Memory_Current );
            iMemory_New = iMemory_Current - iMax_Commit * (TgSINT32)tgMM_Page_Size();
        }
        while (iMemory_Current != tgAM32_XCMP( &g_xiFX__Emitter__Memory_Current, iMemory_New, iMemory_Current ));
    };

    TgFREE_VIRTUAL( psEmitter->m_sExtend.m_psParticle_Memory );

    psEmitter->m_sExtend.m_niParticle_Commit = 0;
    psEmitter->m_sExtend.m_psParticle_Active = nullptr;
    psEmitter->m_sExtend.m_psParticle_Free = nullptr;
    psEmitter->m_sExtend.m_psParticle_Memory = nullptr;
}