Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Effect - Group - 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##Group##__VA_ARGS__
#define T_TYPE( A, ... ) A##GROUP##__VA_ARGS__
#define T_TEXT( ... ) __VA_ARGS__ TgT("Group")
#define T_EFFECT_GROUP 1
#define T_EFFECT_TIME 0
#define T_EFFECT_SCENE 0
#define T_EFFECT_RENDER 0

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

TgCOMPILER_ASSERT( TgARRAY_COUNT( ((P_STg2_FX__Group)0)->m_sExtend.m_atiChildren ) < 0xFF, 0 );


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

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Exported Functions                                                                                                                                                    */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

TgEXTN TgVOID                               tgFX__Client__Group_Add_Child( C_TgFX_DATA_INST_ID, C_TgUINT32, C_TgFX_CLIENT_INST_ID );
TgEXTN TgVOID                               tgFX__Client__Group_On_Kill( C_TgFX_CLIENT_INST_ID, C_TgFX_DATA_INST_ID, C_TgFX_DATA_INST_ID );




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

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




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

TgFORCEINLINE TgBOOL                        tgFX__Update__Group_Is_Valid_Child( TgFX_CLIENT_INST_ID );
static TgVOID                               tgFX__Update__Group__Child_Create( TgFX_DATA_INST_ID );




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

/* ---- tgFX__File__Group_Patch_File_Data ------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgVOID tgFX__File__Group_Patch_File_Data( P_STg2_FX_Group__File_Data UNUSED_PARAM psData )
{
}


/* ---- tgFX__Client__Group_Add_Child ----------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgVOID tgFX__Client__Group_Add_Child( C_TgFX_DATA_INST_ID tiParent_Data, C_TgUINT32 uiIndex, C_TgFX_CLIENT_INST_ID tiClient )
{
    P_STg2_FX__Group                    psParent;

    psParent = g_asFX__Group + tiParent_Data.m.iI;

    if (TgFALSE == tgEQ_FX_DATA_INST_ID( tiParent_Data, psParent->m_tiData ))
    {
        return;
    };

    if (TgTRUE == tgEQ_FX_CLIENT_INST_ID( KTgFX_CLIENT_INST_ID__GROUP_DELAYED_SPAWN, psParent->m_sExtend.m_atiChildren[uiIndex] ))
    {
        TgWARNING_MSGF( 0, TgT( "%-16.16s(%-32.32s): Attempt to spawn a child that already exists / existed.\n" ), TgT("Effect"),
                        TgT("tgFX__Client__Group_Add_Child") );
        return;
    };

    psParent->m_sExtend.m_atiChildren[uiIndex] = tiClient;
}


/* ---- tgFX__Client__Group_On_Kill ------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgVOID tgFX__Client__Group_On_Kill( C_TgFX_CLIENT_INST_ID tiClient, C_TgFX_DATA_INST_ID tiData, C_TgFX_DATA_INST_ID tiParent_Data )
{
    do /* Remove "this" from the parent child list */
    {
        P_STg2_FX__Group                    psParent;
        TgSINT32                            iChild_Index;

        if (TgTRUE != tgFX_DATA_INST_ID_Is_Valid( tiParent_Data ))
        {
            break;
        };

        TgPARAM_CHECK_INDEX( tiParent_Data.m.iI, g_asFX__Group );
        psParent = g_asFX__Group + tiParent_Data.m.iI;

        if (TgTRUE != tgEQ_FX_DATA_INST_ID( tiParent_Data, psParent->m_tiData ))
        {
            break;
        };

        for (iChild_Index = 0; iChild_Index < (TgSINT32)TgARRAY_COUNT( psParent->m_sExtend.m_atiChildren ); ++iChild_Index)
        {
            if (TgFALSE == tgEQ_FX_CLIENT_INST_ID( tiClient, psParent->m_sExtend.m_atiChildren[iChild_Index] ))
            {
                continue;
            };
            psParent->m_sExtend.m_atiChildren[iChild_Index] = KTgFX_CLIENT_INST_ID__INVALID;
            tgAM32_DEC( &psParent->m_sExtend.m_niChildren );
            break;
        };
    }
    while (0);

    do /* Kill all child effects */
    {
        P_STg2_FX__Group                    psGroup;
        TgSINT32                            iChild_Index;

        if (TgTRUE != tgFX_DATA_INST_ID_Is_Valid( tiData ))
        {
            break;
        };

        psGroup = g_asFX__Group + tiData.m.iI;

        if (TgFALSE == tgEQ_FX_DATA_INST_ID( tiData, psGroup->m_tiData ))
        {
            break;
        };

        for (iChild_Index = 0; iChild_Index < (TgSINT32)TgARRAY_COUNT( psGroup->m_sExtend.m_atiChildren ); ++iChild_Index)
        {
            if (TgTRUE != tgFX_CLIENT_INST_ID_Is_Valid( psGroup->m_sExtend.m_atiChildren[iChild_Index] ))
            {
                continue;
            };
            tgFX__Client__Kill( psGroup->m_sExtend.m_atiChildren[iChild_Index] );
        };

        /* Kill the system effect (Deferred from original message) */
        tgFX__Update__Group_Kill( tiData.m.iI );
    }
    while (0);
}




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

/* ---- tgFX__Update__Group_Create_Command ------------------------------------------------------------------------------------------------------------------------------ */
/* Executed on Client Thread                                                                                                                                              */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
static TgBOOL tgFX__Update__Group_Create_Command( CP_STg2_FX_Instance UNUSED_PARAM psInst, C_TgFX_DATA_INST_ID tiData, CP_TgVOID UNUSED_PARAM pData1 )
{
    CP_STg2_FX_Group__File_Data         psFile_Data;
    P_STg2_FX__Group                    psGroup;
    TgSINT32                            iIndex;

    psGroup = g_asFX__Group + tiData.m.iI;
    psFile_Data = psGroup->m_psFile_Data;

    psGroup->m_sExtend.m_niChildren = 0;
    psGroup->m_sExtend.m_fLive_Time = 0.0F;

    for (iIndex = 0; iIndex < (TgSINT32)TgARRAY_COUNT( psGroup->m_sExtend.m_atiChildren ); ++iIndex)
    {
        if ((iIndex >= psFile_Data->m_niEffect) || (KTgEMPTY_HASH == psFile_Data->m_asEffect[iIndex].m_uiHash_Effect))
        {
            psGroup->m_sExtend.m_atiChildren[iIndex] = KTgFX_CLIENT_INST_ID__INVALID;
        }
        else
        {
            psGroup->m_sExtend.m_atiChildren[iIndex] = KTgFX_CLIENT_INST_ID__GROUP_DELAYED_SPAWN;
            ++psGroup->m_sExtend.m_niChildren;
        }
    }

    /* Group state is completely dependent on the children */
    g_aenFX__Group__Shared__State[tiData.m.iI] = ETgFX_EFFECT_STATE__UPDATE__ACTIVE_INFINITE;

    return (TgTRUE);
}


/* ---- tgFX__Update__Group_Update -------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
static TgVOID tgFX__Update__Group_Update( TgVEC_M_F32_04 UNUSED_PARAM vdT, C_TgFLOAT32 fDT, C_ETgFX_UPDATE enUpdate )
{
    TgFX_DATA_INST_ID                   tiActive;
    P_STg2_FX__Group                    psGroup;
    CP_STg2_FX_Group__File_Data         psFile_Data;

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

    while (TgFALSE != tgFX_DATA_INST_ID_Is_Valid( tiActive ))
    {
        tgFX__Update__Group_Diag_Check_Effect( tiActive );

        psGroup = g_asFX__Group + tiActive.m.iI;
        psFile_Data = psGroup->m_psFile_Data;

        psGroup->m_sExtend.m_fLive_Time += fDT;

        tgFX__Update__Group__Child_Create( tiActive );

        if (0 >= psGroup->m_sExtend.m_niChildren)
        {
            tgFX__Update__Command__Group_Kill_Self( psGroup->m_tiData );
        };

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


/* ---- tgFX__Update__Group_Process_Update_Command ---------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgVOID tgFX__Update__Group_Process_Update_Command( C_ETgFX_COMMAND enCommand, CP_TgVOID pData, C_TgFX_DATA_INST_ID tiData )
{
    P_STg2_FX__Group                    psGroup;
    TgUINT32                            iChild;

    psGroup = g_asFX__Group + tiData.m.iI;
    switch (enCommand)
    {
        case ETgFX_COMMAND__CLIENT_TO_UPDATE__NOTIFY: /*« Fall Through - Invalid */
        case ETgFX_COMMAND__CLIENT_TO_UPDATE__SPIN: /*« Fall Through - Invalid */
        case ETgFX_COMMAND__SCENE_TO_RENDER__BEGIN: /*« Fall Through - Invalid */
        case ETgFX_COMMAND__UPDATE_TO_CLIENT__BEGIN: /*« Fall Through - Invalid */
        case ETgFX_COMMAND__UPDATE_TO_CLIENT__NOTIFY: /*« Fall Through - Invalid */
        case ETgFX_COMMAND__UPDATE_TO_CLIENT__FREE: /*« Fall Through - Invalid */
        case ETgFX_COMMAND__MAX: /*« Fall Through - Invalid */
        default: TgS_NO_DEFAULT( break );

            /* Executed on Client Thread */
        case ETgFX_COMMAND__CLIENT_TO_UPDATE__CREATE:
            TgS_NO_DEFAULT( break );

        case ETgFX_COMMAND__CLIENT_TO_UPDATE__KILL:
            break;

            /* Executed on Client Thread */
        case ETgFX_COMMAND__CLIENT_TO_UPDATE__STOP:
            for (iChild = 0; iChild < TgARRAY_COUNT( psGroup->m_sExtend.m_atiChildren ); ++iChild)
            {
                if (TgFALSE == tgFX__Update__Group_Is_Valid_Child( psGroup->m_sExtend.m_atiChildren[iChild] ))
                {
                    continue;
                };
                tgFX__Client__Stop( psGroup->m_sExtend.m_atiChildren[iChild] );
            };
            break;

            /* Executed on Client Thread */
        case ETgFX_COMMAND__CLIENT_TO_UPDATE__POSITION_SET:
        {
            TgVEC_M_F32_04                      vPos_W;
            TgVEC_M_F32_04                      vDelta;

            vPos_W = MS_SETU_F32_04( (CP_TgFLOAT32)pData );
            vDelta = M_SUB_F32_04( vPos_W, psGroup->m_vPos_W );
            psGroup->m_vPos_W = vPos_W;

            for (iChild = 0; iChild < TgARRAY_COUNT( psGroup->m_sExtend.m_atiChildren ); ++iChild)
            {
                if (TgFALSE == tgFX__Update__Group_Is_Valid_Child( psGroup->m_sExtend.m_atiChildren[iChild] ))
                {
                    continue;
                };
                tgFX__Client__Update_Position_From_Parent( psGroup->m_sExtend.m_atiChildren[iChild], vDelta );
            };
            break;
        };

        /* Executed on Client Thread */
        case ETgFX_COMMAND__CLIENT_TO_UPDATE__POSITION_UPDATE_FROM_PARENT:
        {
            TgVEC_M_F32_04                      vDelta;

            vDelta = MS_SETU_F32_04( (CP_TgFLOAT32)pData );
            psGroup->m_vPos_W = M_ADD_F32_04( vDelta, psGroup->m_vPos_W );

            for (iChild = 0; iChild < TgARRAY_COUNT( psGroup->m_sExtend.m_atiChildren ); ++iChild)
            {
                if (TgFALSE == tgFX__Update__Group_Is_Valid_Child( psGroup->m_sExtend.m_atiChildren[iChild] ))
                {
                    continue;
                };
                tgFX__Client__Update_Position_From_Parent( psGroup->m_sExtend.m_atiChildren[iChild], vDelta );
            };
            break;
        };

        /* Executed on Client Thread */
        case ETgFX_COMMAND__CLIENT_TO_UPDATE__ROTATION_SET:
        {
            TgVEC_M_F32_04                      qRot_W;
            TgVEC_M_F32_04                      qRot_Inv_W;
            TgVEC_M_F32_04                      qRot;

            qRot_W = MS_SETU_F32_04( (CP_TgFLOAT32)pData );
            qRot_Inv_W = M_QT_INV_F32_04( psGroup->m_qRot_W );
            psGroup->m_qRot_W = qRot_W;
            qRot = M_QT_MUL_F32_04( psGroup->m_qRot_W, qRot_Inv_W );

            for (iChild = 0; iChild < TgARRAY_COUNT( psGroup->m_sExtend.m_atiChildren ); ++iChild)
            {
                if (TgFALSE == tgFX__Update__Group_Is_Valid_Child( psGroup->m_sExtend.m_atiChildren[iChild] ))
                {
                    continue;
                };
                tgFX__Client__Update_Rotation_From_Parent( psGroup->m_sExtend.m_atiChildren[iChild], qRot );
            };
            break;
        };

        /* Executed on Client Thread */
        case ETgFX_COMMAND__CLIENT_TO_UPDATE__ROTATION_UPDATE_FROM_PARENT:
        {
            TgVEC_M_F32_04                      vPos_W;
            TgVEC_M_F32_04                      qRot;
            TgVEC_M_F32_04                      qRot_Inv_W;
            TgVEC_M_F32_04                      vDelta;

            qRot = MS_SETU_F32_04( (CP_TgFLOAT32)pData );
            qRot_Inv_W = M_QT_INV_F32_04( psGroup->m_qRot_W );
            vPos_W = psGroup->m_vPos_W;
            psGroup->m_vPos_W = M_QT_TX_F32_04( psGroup->m_vPos_W, qRot_Inv_W );
            psGroup->m_qRot_W = M_QT_MUL_F32_04( qRot, psGroup->m_qRot_W );
            psGroup->m_vPos_W = M_QT_TX_F32_04( psGroup->m_vPos_W, psGroup->m_qRot_W );
            qRot = M_QT_MUL_F32_04( psGroup->m_qRot_W, qRot_Inv_W );
            vDelta = M_SUB_F32_04( psGroup->m_vPos_W, vPos_W );

            for (iChild = 0; iChild < TgARRAY_COUNT( psGroup->m_sExtend.m_atiChildren ); ++iChild)
            {
                if (TgFALSE == tgFX__Update__Group_Is_Valid_Child( psGroup->m_sExtend.m_atiChildren[iChild] ))
                {
                    continue;
                };
                tgFX__Client__Update_Position_From_Parent( psGroup->m_sExtend.m_atiChildren[iChild], vDelta );
                tgFX__Client__Update_Rotation_From_Parent( psGroup->m_sExtend.m_atiChildren[iChild], qRot );
            };
            break;
        };

        /* Executed on Client Thread */
        case ETgFX_COMMAND__CLIENT_TO_UPDATE__VISIBLE:
            for (iChild = 0; iChild < TgARRAY_COUNT( psGroup->m_sExtend.m_atiChildren ); ++iChild)
            {
                if (TgFALSE == tgFX__Update__Group_Is_Valid_Child( psGroup->m_sExtend.m_atiChildren[iChild] ))
                {
                    continue;
                };
                tgFX__Client__Set_Visible( psGroup->m_sExtend.m_atiChildren[iChild], *(CP_TgBOOL)pData );
            };
            break;
    };
}




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

/* ---- tgFX__Update__Group_Is_Valid_Child ------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgFORCEINLINE TgBOOL tgFX__Update__Group_Is_Valid_Child( TgFX_CLIENT_INST_ID tiClient )
{
    if (TgTRUE == tgEQ_FX_CLIENT_INST_ID( KTgFX_CLIENT_INST_ID__GROUP_DELAYED_SPAWN, tiClient ))
        return (TgFALSE);
    if (TgTRUE != tgFX_CLIENT_INST_ID_Is_Valid( tiClient ))
        return (TgFALSE);
    return (TgTRUE);
}


/* ---- tgFX__Update__Group__Child_Create ------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
static TgVOID tgFX__Update__Group__Child_Create( TgFX_DATA_INST_ID tiData )
{
    P_STg2_FX__Group                    psGroup;
    STg2_FX_Instance                    sInstance;
    TgUINT32                            uiIndex;

    tgFX__Update__Group_Diag_Check_Effect( tiData );
    psGroup = g_asFX__Group + tiData.m.iI;

    memset( &sInstance, 0, sizeof( sInstance ) );

    sInstance.m_vScale.m_mData = psGroup->m_vScale;
    sInstance.m_tiParent = psGroup->m_tiClient;
    sInstance.m_tiTarget = KTgRN_TARGET_ID__INVALID;

    for (uiIndex = 0; uiIndex < TgARRAY_COUNT( psGroup->m_sExtend.m_atiChildren ); ++uiIndex)
    {
        CP_STg2_FX_Group_Effect__File_Data  psEffect_Data;

        if (!tgEQ_FX_CLIENT_INST_ID( KTgFX_CLIENT_INST_ID__GROUP_DELAYED_SPAWN, psGroup->m_sExtend.m_atiChildren[uiIndex] ))
        {
            continue;
        };

        psEffect_Data = psGroup->m_psFile_Data->m_asEffect + uiIndex;
        if (psEffect_Data->m_fStart > psGroup->m_sExtend.m_fLive_Time)
        {
            continue;
        };

        sInstance.m_vPos_W.m_mData = M_ADD_F32_04( M_QT_TX_F32_04( psEffect_Data->m_vPosition, psGroup->m_qRot_W ), psGroup->m_vPos_W );
        sInstance.m_qRot_W.m_mData = M_QT_MUL_F32_04( psEffect_Data->m_vRotation, psGroup->m_qRot_W );
        sInstance.m_uiInternal = (ETgFX_UPDATE__EXTERNAL << 8) | (uiIndex & 0xFF);

        tgFX__Update__Command__Group_Create( psEffect_Data->m_uiHash_Effect, &sInstance );
    };
}