Adding Animated Emblems

10/01/2025 11:15 chihab007#1
✨ Adding Animated Emblems ✨

Hello everyone 👋,
In this guide, we’ll add support for animated emblems instead of static ones inside the character window.
The idea is to extend the source code with logic to control emblem frames and update them over time.
📌 Step 1: Edit SUICharacterWnd.h

At the bottom of the class definition, add the following private members:

PHP Code:
private:
bool m_bEmblemIsAnimated// Is the emblem animated or static
int m_nCurrentEmblemFrame// Current frame index
bool m_bIsEmblemAnimating// Animation state (on/off)
DWORD m_dwLastEmblemUpdate// Last frame update timestamp
static const int EMBLEM_ANIMATION_INTERVAL 100// Animation speed 
[HR]

📌 Step 2: Edit SUICharacterWnd.cpp

✅ Inside Process
Locate:
PHP Code:
void SUICharacterWnd::Process(DWORD dwTime
Then add:
PHP Code:
if (m_bIsEmblemAnimating)
{
UpdateEmblemAnimation();
//UpdateNameColor();

✅ Update createEmblemIcon

Replace the function with this improved version:
PHP Code:
void SUICharacterWnd::createEmblemIcon(int objType)
{
    if (
TS_ENTER::GAME_PLAYER != objType)
        return;

    
// If emblem control already exists, just update position
    
if (m_pEmblemControl)
    {
        
KRect rect _GetNameBackRect();
        
rect.top  -= EMBLEM_OFFSET_Y;
        
rect.left -= EMBLEM_OFFSET_X;
        
m_pEmblemControl->SetRect(rect);
        
m_pEmblemControl->SetShow(true);
        return;
    }

    
// Create emblem control
    
KUIWND_CREATE_ARG arg;
    
arg.lpszSprName   m_sSprName.c_str();
    
arg.lpszAniName   "";
    
arg.lpszClassName "iconstatic";
    
arg.lpszID        "_emblem_icon";
    
arg.pParent       this;
    
arg.dwFlag        KFLAG_GET_PASS_MESSAGE KFLAG_NO_GET_FOCUS;

    
KRect rect _GetNameBackRect();
    
rect.top  -= EMBLEM_OFFSET_Y;
    
rect.left -= EMBLEM_OFFSET_X;
    
arg.rcRect rect;

    
// Create control immediately
    
m_pEmblemControl dynamicCast<KUIControlIconStatic*>(m_pManager->CreateControl(arg));

    if (
m_pEmblemControl)
    {
        
m_pEmblemControl->SetShow(true);
        
SetChildAsTop("_character_name");
        
SetChildAsTop("_pk_icon");

        
// Assign emblem sprite if available
        
if (m_nBackBoard 0)
        {
            
char emblemName[50];
            
sprintf(emblemName"static_emblem_%02d"m_nBackBoard);
            
m_pEmblemControl->SetIcon("05_ui.spr"emblemName);
        }

        
UpdateEmblemAnimation(); // start animation right away
    
}

✅ Update SetEmblem
PHP Code:
void SUICharacterWnd::SetEmblem(int nID)
{
    
m_nBackBoard nID ItemBase::CODE_BASE_BACKBOARD;

    if (
m_nBackBoard 0)
    {
        if (
m_pEmblemControl)
        {
            
char emblemName[50];
            
sprintf(emblemName"static_emblem_%02d"m_nBackBoard);
            
m_pEmblemControl->SetIcon("05_ui.spr"emblemName);
            
m_pEmblemControl->SetShow(true);

            
// Start animation
            
m_nCurrentEmblemFrame 1;
            
m_bIsEmblemAnimating  true;
            
m_dwLastEmblemUpdate  GetTickCount();
            
UpdateEmblemAnimation();
        }
    }
    else
    {
        if (
m_pEmblemControl)
            
m_pEmblemControl->SetShow(false);

        
m_bIsEmblemAnimating false;
    }

✅ Add UpdateEmblemAnimation
PHP Code:
void SUICharacterWnd::UpdateEmblemAnimation()
{
    
// If static emblem, skip
    
if (!m_bIsEmblemAnimating || !m_pEmblemControl || m_nBackBoard <= || !m_bEmblemIsAnimated)
        return;

    
DWORD currentTime GetTickCount();

    if (
currentTime m_dwLastEmblemUpdate >= EMBLEM_ANIMATION_INTERVAL)
    {
        
// Advance frame
        
m_nCurrentEmblemFrame++;
        if (
m_nCurrentEmblemFrame 30)
        {
            
m_nCurrentEmblemFrame 1;
            
m_dwLastEmblemUpdate  currentTime EMBLEM_ANIMATION_INTERVAL;
        }
        else
        {
            
m_dwLastEmblemUpdate currentTime;
        }

        
// Update sprite frame
        
char emblemName[50];
        
sprintf(emblemName"static_emblem_%02d_%02d"m_nBackBoardm_nCurrentEmblemFrame);
        
m_pEmblemControl->SetIcon("05_ui.spr"emblemName);
        
m_pEmblemControl->SetShow(true);
    }

📌 Step 3: Update 05_ui.spr

Finally, edit your 05_ui.spr and add the animated frames for each emblem.
Frames must follow this naming pattern:

Code:
static_emblem_##_##
Where:

First ## = emblem ID

Second ## = frame number (01 → 30)

Example:
Code:
static_emblem_01_01
1
static_emblem_01_01.png
0,0
0

static_emblem_01_02
1
static_emblem_01_02.png
0,0
0

static_emblem_01_03
1
static_emblem_01_03.png
0,0
0

...
static_emblem_01_30


[CENTER]🎉 Done! Now your emblems can be fully animated inside SUICharacterWnd!
show case
🎉
10/01/2025 11:57 atherounge3#2
Good job, but the ones who wanted them already did them. And the ones who are incapable of doing anything, would not even figure out how to do it even with this guide