TUServerMU

MuOnline => Files MU => Sources Generales => Tema comenzado por: Pyke on June 08, 2025, 12:52:33 PM

Titulo: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: Pyke on June 08, 2025, 12:52:33 PM
Hi guys, like in subject, its update of 60 fps from Sven Project OpenMU, on main 5.2 source of RoxGaming,

MuServer, Client, Source Download: (http://i.imgur.com/Z9MYwwl.png)


Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: erickmalfoy on June 08, 2025, 01:38:03 PM
Hooo buen aporte pyke siempre liberando lo mejor
Los otros src del 1.04e muemu se ven muy buenos tbm XD esto ayuda a la comunidad suerte  shocked2
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: exterminio on June 08, 2025, 02:52:57 PM
se puede adaptar a main 1.04e?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: erickmalfoy on June 08, 2025, 05:12:57 PM
se puede adaptar a main 1.04e?
Si se puede pero para que usar 1.04e si el 5.2 esta libre todo el código donde solo puede codear defrente sin usar offset XD
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: Evangelio on June 08, 2025, 05:51:21 PM
los codigos del 1.4e son compatibles con esta version??
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: Viper on June 08, 2025, 07:38:14 PM
los codigos del 1.4e son compatibles con esta version??

No para copiar y pegar claramente, uno usa offsets.
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: laulinh2 on June 09, 2025, 01:20:01 AM
(https://i.ibb.co/5yw8Rg7/Capture.jpg)Don't Login, how to fix?

Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: nujd00 on June 09, 2025, 04:41:39 AM
how to change interface season 6?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: Pyke on June 09, 2025, 06:07:55 AM
(https://i.ibb.co/5yw8Rg7/Capture.jpg)Don't Login, how to fix?

Check maybe DB, ODBC connection, DataServer, Joinserver ;>
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: caminhada on June 09, 2025, 10:22:42 AM
O chat não está funcionando. Já alterei o NewUIChatLogWindow alguem sabe o pq ?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: nhantac on June 09, 2025, 11:22:47 AM
khóa FPS ở 60 như thế nào nhỉ mn. cám ơn Pyke.
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: dakosmu on June 09, 2025, 11:59:13 AM
(https://i.ibb.co/1f9WKMQM/hola-2.jpg) (https://ibb.co/XZzRpDLD)
(https://i.ibb.co/rNG9Jt3/hola.jpg) (https://ibb.co/LHzKfPr)
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: oxey.mu on June 09, 2025, 12:43:06 PM
No tiene para agregar plugin no?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: caminhada on June 09, 2025, 05:21:12 PM
Alguém possui ele com os itens hopemu?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: Shellshock on June 09, 2025, 09:48:08 PM
how to fix , monster and character death animation sir?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: bin9xhn2 on June 09, 2025, 10:48:20 PM
O chat não está funcionando. Já alterei o NewUIChatLogWindow alguem sabe o pq ?
Only chat for the first time and from the second time onwards, there is no response. Have you fixed it yet ?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: samsunggon on June 09, 2025, 10:58:58 PM
BUG:
chat not working
and
custom jewels need to switch character to apply
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: caminhada on June 10, 2025, 01:04:09 AM
BUG:
chat not working
and
custom jewels need to switch character to apply


use em ZzzScene.cpp

if(ChatTime > 0) ChatTime--;
      if(MacroTime > 0) MacroTime--;
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: nduchoang97 on June 10, 2025, 04:22:45 AM
how to fix , monster and character death animation sir?

Does anyone know how to fix it?

Monsters remain active when killed and fade out, with no death animation
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: tienduy1992 on June 10, 2025, 05:51:12 AM
(https://i.ibb.co/1f9WKMQM/hola-2.jpg) (https://ibb.co/XZzRpDLD)
(https://i.ibb.co/rNG9Jt3/hola.jpg) (https://ibb.co/LHzKfPr)
Find GameServer.Lua in GameServer File and change your database info
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: Pyke on June 10, 2025, 10:43:00 AM
how to fix , monster and character death animation sir?

Does anyone know how to fix it?

Monsters remain active when killed and fade out, with no death animation

w_CharacterInfo.h
find
BYTE        Dead;
change BYTE to float
float        Dead;


Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: dakosmu on June 10, 2025, 11:54:18 AM
BUG:
chat not working
and
custom jewels need to switch character to apply


use em ZzzScene.cpp

if(ChatTime > 0) ChatTime--;
      if(MacroTime > 0) MacroTime--;


 aplausos aplausos aplausos
(https://i.ibb.co/HTGwVySz/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.jpg) (https://ibb.co/PG1XNyLh)
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: nhantac on June 10, 2025, 01:33:13 PM
BUG:
chat not working
and
custom jewels need to switch character to apply


use em ZzzScene.cpp

if(ChatTime > 0) ChatTime--;
      if(MacroTime > 0) MacroTime--;


 aplausos aplausos aplausos
(https://i.ibb.co/HTGwVySz/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.jpg) (https://ibb.co/PG1XNyLh)

làm sao để lên nhiều FPS thế bro
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: HayllanderBR on June 10, 2025, 02:50:04 PM
Alguém fixo a movimentação das montarias ?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: tienduy1992 on June 10, 2025, 06:52:43 PM
Anyone fig: Using multi skill as evil spirit but can not get damage
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: KhongGianOL on June 12, 2025, 05:04:34 AM
Error Lua...How to fix ?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: samsunggon on June 12, 2025, 06:59:05 AM
all dupe method post in this forum
is working.

how to prevent using 5.2 main ?
sample
chaos machine+xshop dupe
duel+party dupe
trade dupe
store dupe
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: Pyke on June 12, 2025, 07:15:56 AM
Anyone fig: Using multi skill as evil spirit but can not get damage

Find this in ZzzEffect.cpp

Code: [Select]
bool AttackCharacterRange(int Index, vec3_t Position, float Range, BYTE Serial, short PKKey, WORD SkillSerialNum)
{
    return false; // we don't send this packet anymore
}

replace

Code: [Select]
bool AttackCharacterRange(int Index, vec3_t Position, float Range, BYTE Serial, short PKKey, WORD SkillSerialNum)
{
    int Skill = CharacterAttribute->Skill[Index];

    int     Count = 0;
    int     DamageKey[5];
    bool    DamageChr = false;

    if (gMapManager.InBattleCastle() && battleCastle::IsBattleCastleStart())
    {
        DWORD att = TERRAIN_ATTRIBUTE(Position[0], Position[1]);
        if ((att & TW_NOATTACKZONE) == TW_NOATTACKZONE)
        {
            return false;
        }
        DamageChr = true;
    }

    for (int i = 0; i < MAX_CHARACTERS_CLIENT; i++)
    {
        CHARACTER* c = &CharactersClient[i];
        OBJECT* o = &c->Object;

        if (o->Live == false
            || o->Visible == false
            || c == Hero
            || (bool)c->Dead == true)
        {
            continue;
        }

        float dx = Position[0] - o->Position[0];
        float dy = Position[1] - o->Position[1];
        float Distance = sqrtf(dx * dx + dy * dy);

        if (Distance <= Range
            && (o->Kind == KIND_MONSTER || (o->Kind == KIND_PLAYER && (c->Key == PKKey || DamageChr))))
        {
            if (Skill == AT_SKILL_STORM || Skill == AT_SKILL_EVIL || (AT_SKILL_EVIL_SPIRIT_UP <= Skill && AT_SKILL_EVIL_SPIRIT_UP + 4 >= Skill) || (AT_SKILL_EVIL_SPIRIT_UP_M <= Skill && AT_SKILL_EVIL_SPIRIT_UP_M + 4 >= Skill)
                )
            {
                if (c->m_bFixForm == false)
                {
                    c->StormTime = 10;
                }

                if (c->MonsterIndex >= 459 && c->MonsterIndex <= 462)
                {
                    c->StormTime = 0;
                }
                else if (524 <= c->MonsterIndex && c->MonsterIndex <= 528)
                {
                    c->StormTime = 0;
                }
            }

            DamageKey[Count++] = c->Key;
            if (Count >= 5)
            {
                break;
            }
        }
    }

    if (Count > 0)
    {
        if (Skill == AT_SKILL_DARK_SCREAM || (AT_SKILL_FIRE_SCREAM_UP <= Skill && AT_SKILL_FIRE_SCREAM_UP + 4 >= Skill))
        {
            BYTE _SerialTemp = (BYTE)SkillSerialNum;
            SendRequestMagicAttack(Skill, (int)(Position[0] / TERRAIN_SCALE), (int)(Position[1] / TERRAIN_SCALE), _SerialTemp, Count, DamageKey, SkillSerialNum);
        }
        else
        {
            if (Skill != AT_SKILL_MULTI_SHOT)
            {
                SendRequestMagicAttack(Skill, (int)(Position[0] / TERRAIN_SCALE), (int)(Position[1] / TERRAIN_SCALE), Serial, Count, DamageKey, SkillSerialNum);
            }
        }
        return true;
    }
    return false;
}
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: T-LEGENDARY on June 12, 2025, 11:11:17 AM
@Pyke How add "M" Command move manager , help :)
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: Odisk on June 12, 2025, 11:43:41 AM
@Pyke How add "M" Command move manager , help :)

find
hotkey.cpp
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: Odisk on June 12, 2025, 11:45:27 AM
dark horse animation bug
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: sayfmaster on June 12, 2025, 12:11:03 PM
just run the animation at the end of each CASE in the
Goboid.cpp file

if (b) b->PlayAnimation(&o->AnimationFrame, &o->PriorAnimationFrame, &o->PriorAction, o->Velocity, o->Position, o->Angle);

before the break;

CASE MODEL_DARK_HORSE:
CASE MODEL_FENRIR_GOLD:
CASE MODEL_UNICON:

Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: sayfmaster on June 12, 2025, 12:15:47 PM
just run the animation at the end of each CASE in the
Goboid.cpp file

if (b) b->PlayAnimation(&o->AnimationFrame, &o->PriorAnimationFrame, &o->PriorAction, o->Velocity, o->Position, o->Angle);

before the break;

CASE MODEL_DARK_HORSE:
CASE MODEL_FENRIR_GOLD:
CASE MODEL_UNICON:


dark horse animation bug
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: anonymousgh on June 12, 2025, 01:11:34 PM
Fix FENRIR_WALK/ FENRIR_RUN:

Em GOBoid.cpp, procure por:

bool MoveBug ( OBJECT* o, bool bForceRender )

Antes de:
      switch (o->Type)
      {
      case MODEL_FENRIR_BLACK:
      case MODEL_FENRIR_BLUE:
      case MODEL_FENRIR_RED:
      case MODEL_FENRIR_GOLD:

Colocar:
      b->PlayAnimation(&o->AnimationFrame, &o->PriorAnimationFrame, &o->PriorAction, o->Velocity, o->Position, o->Angle);
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: dakosmu on June 12, 2025, 03:07:06 PM
Al Parecer todo el source trae los sistemas. falta activarlos


(https://i.ibb.co/NgCb3Kjz/b3d4987b-b3ac-46da-9b36-c27d896f6fdf.jpg) (https://ibb.co/HL432qzQ)
(https://i.ibb.co/gZXngCWk/859d955a-f66f-4c30-92ac-c464f73ad2e7.jpg) (https://ibb.co/GQ1hPjMz)
(https://i.ibb.co/zWDP8ggv/48e14e59-3ad7-46a2-9bcd-901b7b7fe76a.jpg) (https://ibb.co/Ps01TyyH)
(https://i.ibb.co/JLspVgW/25854c32-52b3-448e-a871-bcf8a90d17c2.jpg) (https://ibb.co/Y9Ldmw4)
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: lukaz2z on June 12, 2025, 09:03:11 PM
Al Parecer todo el source trae los sistemas. falta activarlos


(https://i.ibb.co/NgCb3Kjz/b3d4987b-b3ac-46da-9b36-c27d896f6fdf.jpg) (https://ibb.co/HL432qzQ)
(https://i.ibb.co/gZXngCWk/859d955a-f66f-4c30-92ac-c464f73ad2e7.jpg) (https://ibb.co/GQ1hPjMz)
(https://i.ibb.co/zWDP8ggv/48e14e59-3ad7-46a2-9bcd-901b7b7fe76a.jpg) (https://ibb.co/Ps01TyyH)
(https://i.ibb.co/JLspVgW/25854c32-52b3-448e-a871-bcf8a90d17c2.jpg) (https://ibb.co/Y9Ldmw4)

disculpa tendrias para compartir los archivos necesarios para activarlo ? a mi me falta "#include "CGFxMacroMain.h"
#include "CGFxMacroSubMain.h"
#include "CGFxMacroGaugeBar.h""

y tambien #include "CAIController.h"
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: phuongcuongmsqm on June 13, 2025, 05:24:12 AM
Al Parecer todo el source trae los sistemas. falta activarlos


(https://i.ibb.co/NgCb3Kjz/b3d4987b-b3ac-46da-9b36-c27d896f6fdf.jpg) (https://ibb.co/HL432qzQ)
(https://i.ibb.co/gZXngCWk/859d955a-f66f-4c30-92ac-c464f73ad2e7.jpg) (https://ibb.co/GQ1hPjMz)
(https://i.ibb.co/zWDP8ggv/48e14e59-3ad7-46a2-9bcd-901b7b7fe76a.jpg) (https://ibb.co/Ps01TyyH)
(https://i.ibb.co/JLspVgW/25854c32-52b3-448e-a871-bcf8a90d17c2.jpg) (https://ibb.co/Y9Ldmw4)
YOU CAN SHARE IT
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: T-LEGENDARY on June 13, 2025, 07:32:06 AM
Al Parecer todo el source trae los sistemas. falta activarlos


(https://i.ibb.co/NgCb3Kjz/b3d4987b-b3ac-46da-9b36-c27d896f6fdf.jpg) (https://ibb.co/HL432qzQ)
(https://i.ibb.co/gZXngCWk/859d955a-f66f-4c30-92ac-c464f73ad2e7.jpg) (https://ibb.co/GQ1hPjMz)
(https://i.ibb.co/zWDP8ggv/48e14e59-3ad7-46a2-9bcd-901b7b7fe76a.jpg) (https://ibb.co/Ps01TyyH)
(https://i.ibb.co/JLspVgW/25854c32-52b3-448e-a871-bcf8a90d17c2.jpg) (https://ibb.co/Y9Ldmw4)

Share for us pack complet with source code
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: KhongGianOL on June 13, 2025, 10:21:07 AM
Does everyone get the Lua Error when opening Main.exe?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: T-LEGENDARY on June 13, 2025, 10:28:25 AM
@Pyke How add "M" Command move manager , help :)

find
hotkey.cpp

thx bro  heart
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: T-LEGENDARY on June 13, 2025, 10:47:46 AM
@Odisk , how i desactive rotation character in selec character? help
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: T-LEGENDARY on June 13, 2025, 11:51:29 AM
(https://i.imgur.com/yB5EnCd.png)

help , how to fix GameServerCS?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: Nakamura on June 13, 2025, 01:05:01 PM
(https://i.imgur.com/yB5EnCd.png)

help , how to fix GameServerCS?

If you don't know how to resolve this error, you could kill yourself...

It's a problem with the configuration of MapServerInfo.dat and the ServerCode of your GameServer.
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: T-LEGENDARY on June 13, 2025, 01:11:43 PM
(https://i.imgur.com/yB5EnCd.png)

help , how to fix GameServerCS?

If you don't know how to resolve this error, you could kill yourself...

It's a problem with the configuration of MapServerInfo.dat and the ServerCode of your GameServer.

Eu nem verifiquei isso , tinha me esquecido kk vlw
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: dakosmu on June 13, 2025, 05:26:23 PM
(https://i.postimg.cc/vHBtfwVG/gamssssseserver.jpg)


(http://i.imgur.com/Z9MYwwl.png)
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: Dexign on June 14, 2025, 02:02:50 AM
@Odisk , how i desactive rotation character in selec character? help

Eso se quita en el lua no se que archivo exacto, pero es en la carpeta clienta/data/config/lua
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: T-LEGENDARY on June 14, 2025, 06:26:39 AM
@Odisk , how i desactive rotation character in selec character? help

Eso se quita en el lua no se que archivo exacto, pero es en la carpeta clienta/data/config/lua


When you find the exact location, let me know. I looked and couldn't find where to disable it.  aplausos
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: T-LEGENDARY on June 14, 2025, 06:41:57 AM
(https://i.postimg.cc/vHBtfwVG/gamssssseserver.jpg)

 


porque esta falando " Request data again " sabe arrumar ?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: roshux on June 14, 2025, 06:55:21 AM
(https://i.postimg.cc/vHBtfwVG/gamssssseserver.jpg)

Config CastleSiege in Database

 


porque esta falando " Request data again " sabe arrumar ?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: KhongGianOL on June 14, 2025, 11:05:28 AM
@T-LEGENDARY , @dakosmu: Help please fix error luacall_Generic_Call error running function '%s': '%s'"
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: Dizzy on June 14, 2025, 11:12:47 AM
Al Parecer todo el source trae los sistemas. falta activarlos


(https://i.ibb.co/NgCb3Kjz/b3d4987b-b3ac-46da-9b36-c27d896f6fdf.jpg) (https://ibb.co/HL432qzQ)
(https://i.ibb.co/gZXngCWk/859d955a-f66f-4c30-92ac-c464f73ad2e7.jpg) (https://ibb.co/GQ1hPjMz)
(https://i.ibb.co/zWDP8ggv/48e14e59-3ad7-46a2-9bcd-901b7b7fe76a.jpg) (https://ibb.co/Ps01TyyH)
(https://i.ibb.co/JLspVgW/25854c32-52b3-448e-a871-bcf8a90d17c2.jpg) (https://ibb.co/Y9Ldmw4)


share your files my friend  magia2
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: KhongGianOL on June 14, 2025, 11:48:55 AM
(https://i.ibb.co/gLngmm1Z/error.png) (https://ibb.co/gLngmm1Z)

 please please please please please please please
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: T-LEGENDARY on June 14, 2025, 01:09:33 PM
@T-LEGENDARY , @dakosmu: Help please fix error luacall_Generic_Call error running function '%s': '%s'"

Later I share my fillets, I even put the /zen, but I need to know where it deactivates the character from rotation in select character

Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: TryMenow on June 14, 2025, 01:32:25 PM
anyone can share  60 FPS  System Here
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: Odisk on June 14, 2025, 02:09:37 PM
the animations of the monsters are the same as all of them when they die and etc.
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: Odisk on June 14, 2025, 02:17:32 PM
anyone can share  60 FPS  System Here

no es un modulo de copiar y pegar. son muchas cosas que se tienen que cambiar dentro de casi todo los cpp para que funcionen
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: dakosmu on June 14, 2025, 02:35:21 PM
(https://i.ibb.co/YFm7zJR8/Source-Mu-Helper-Rox-Gaming-Main-5-2.jpg) (https://ibb.co/RkfpxtvP)

(http://i.imgur.com/Z9MYwwl.png)

(http://i.imgur.com/Z9MYwwl.png)
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: dakosmu on June 14, 2025, 03:42:32 PM
(https://i.ibb.co/HDVtzSSc/cash-shop.jpg) (https://ibb.co/sv2KwffT)


(http://i.imgur.com/Z9MYwwl.png)

Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: dakosmu on June 14, 2025, 03:53:24 PM

(https://i.ibb.co/KjvWZs1y/letra-M.jpg) (https://ibb.co/C5GQd9r0)


(http://i.imgur.com/Z9MYwwl.png)
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: dakosmu on June 14, 2025, 04:08:32 PM

(https://i.ibb.co/fYfqgFcZ/jewel.jpg) (https://ibb.co/tMgQGKdn)


(http://i.imgur.com/Z9MYwwl.png)
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: spartacus on June 14, 2025, 04:24:39 PM
Is lua working on these posted files?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: dakosmu on June 14, 2025, 05:12:26 PM


(https://i.ibb.co/MxvScRgp/sd.jpg) (https://ibb.co/hJ69BKgH)

Pueden completar la barra amarilla en el codigo




(http://i.imgur.com/Z9MYwwl.png)
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: Kolontay on June 15, 2025, 04:51:30 AM
@dakosmu wonderful work, pleaseee share your source code.
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: nujd00 on June 15, 2025, 07:37:37 AM
how to change interface season 6?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: dakosmu on June 15, 2025, 11:58:52 AM
how to change interface season 6?

Intentando cambiar a Interfase Season 2 10% terminado ajajaajaj

Intentare Season 6


(https://i.ibb.co/spzMm6yN/Screen-06-15-11-54-0003.jpg) (https://ibb.co/LDH2kJnc)
(https://i.ibb.co/CK8BLKv4/Screen-06-15-11-54-0002.jpg) (https://ibb.co/8gsMkg2G)





Season 2 - 76% Lo dejare hasta alli

Empiezo por season 6 aver como me va


(https://i.ibb.co/tPsmB7dW/Screen-06-15-11-55-0006.jpg) (https://ibb.co/x8jChp4R)
(https://i.ibb.co/8LxjKTdF/Screen-06-15-11-55-0005.jpg) (https://ibb.co/nN1DgZnh)


Comenzando season 6 5%

(https://i.ibb.co/BVZvWW78/season.jpg) (https://ibb.co/HDzRwwMm)

Comenzando season 6 - - -24%

(https://i.ibb.co/yLLMjDT/Screen-06-15-13-27-0001.jpg) (https://ibb.co/666pC2h)
(https://i.ibb.co/hFmhdYxd/Screen-06-15-13-27-0000.jpg) (https://ibb.co/v4jgdXCd)



Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: Malkom99 on June 16, 2025, 03:17:48 PM
(https://i.ibb.co/YFm7zJR8/Source-Mu-Helper-Rox-Gaming-Main-5-2.jpg) (https://ibb.co/RkfpxtvP)
 

CAIController???
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: horizonking on June 17, 2025, 04:15:00 AM
how to change interface season 6?

Intentando cambiar a Interfase Season 2 10% terminado ajajaajaj

Intentare Season 6




(https://i.ibb.co/spzMm6yN/Screen-06-15-11-54-0003.jpg) (https://ibb.co/LDH2kJnc)
(https://i.ibb.co/CK8BLKv4/Screen-06-15-11-54-0002.jpg) (https://ibb.co/8gsMkg2G)





Season 2 - 76% Lo dejare hasta alli

Empiezo por season 6 aver como me va


(https://i.ibb.co/tPsmB7dW/Screen-06-15-11-55-0006.jpg) (https://ibb.co/x8jChp4R)
(https://i.ibb.co/8LxjKTdF/Screen-06-15-11-55-0005.jpg) (https://ibb.co/nN1DgZnh)


Comenzando season 6 5%

(https://i.ibb.co/BVZvWW78/season.jpg) (https://ibb.co/HDzRwwMm)

Comenzando season 6 - - -24%

(https://i.ibb.co/yLLMjDT/Screen-06-15-13-27-0001.jpg) (https://ibb.co/666pC2h)
(https://i.ibb.co/hFmhdYxd/Screen-06-15-13-27-0000.jpg) (https://ibb.co/v4jgdXCd)

hi bro can u share updated source ? please fix all dupes <3 your work
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: samsunggon on June 17, 2025, 05:54:30 AM
@Odisk , how i desactive rotation character in selec character? help

Eso se quita en el lua no se que archivo exacto, pero es en la carpeta clienta/data/config/lua


When you find the exact location, let me know. I looked and couldn't find where to disable it.  aplausos

remove rotation in character

(http://i.imgur.com/Z9MYwwl.png)
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: bin9xhn2 on June 17, 2025, 10:35:32 PM
@Odisk , how i desactive rotation character in selec character? help

Eso se quita en el lua no se que archivo exacto, pero es en la carpeta clienta/data/config/lua


When you find the exact location, let me know. I looked and couldn't find where to disable it.  aplausos

remove rotation in character
 
Can you guide me to bring select chart to basic S2?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: chipcoidj on June 17, 2025, 11:46:14 PM
@Odisk , how i desactive rotation character in selec character? help

Eso se quita en el lua no se que archivo exacto, pero es en la carpeta clienta/data/config/lua
nhặt bên hugo về


When you find the exact location, let me know. I looked and couldn't find where to disable it.  aplausos

remove rotation in character
 
Can you guide me to bring select chart to basic S2?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: KhongGianOL on June 18, 2025, 12:19:15 AM
Có VN nào bị lỗi build ra mà chạy file Main.exe báo lỗi Lua_Generic_call erro........ không >?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: nhantac on June 18, 2025, 01:01:41 AM
Có VN nào bị lỗi build ra mà chạy file Main.exe báo lỗi Lua_Generic_call erro........ không >?
không, tôi chạy bình thường
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: KhongGianOL on June 18, 2025, 02:47:25 AM
Có VN nào bị lỗi build ra mà chạy file Main.exe báo lỗi Lua_Generic_call erro........ không >?
không, tôi chạy bình thường

Sao tui build = vs2022 ra bị lỗi ta
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: erickmalfoy on June 18, 2025, 03:22:18 AM
how to change interface season 6?

Intentando cambiar a Interfase Season 2 10% terminado ajajaajaj

Intentare Season 6


(https://i.ibb.co/spzMm6yN/Screen-06-15-11-54-0003.jpg) (https://ibb.co/LDH2kJnc)
(https://i.ibb.co/CK8BLKv4/Screen-06-15-11-54-0002.jpg) (https://ibb.co/8gsMkg2G)





Season 2 - 76% Lo dejare hasta alli

Empiezo por season 6 aver como me va


(https://i.ibb.co/tPsmB7dW/Screen-06-15-11-55-0006.jpg) (https://ibb.co/x8jChp4R)
(https://i.ibb.co/8LxjKTdF/Screen-06-15-11-55-0005.jpg) (https://ibb.co/nN1DgZnh)


Comenzando season 6 5%

(https://i.ibb.co/BVZvWW78/season.jpg) (https://ibb.co/HDzRwwMm)

Comenzando season 6 - - -24%

(https://i.ibb.co/yLLMjDT/Screen-06-15-13-27-0001.jpg) (https://ibb.co/666pC2h)
(https://i.ibb.co/hFmhdYxd/Screen-06-15-13-27-0000.jpg) (https://ibb.co/v4jgdXCd)
Para que no te choque las interfaces debes borrar los botones render la interface qué dejo rox le puso botones render a los objetos.h de 5 2 elimina todos los números y se podrá poner interfaces custon de manera más fácil suerte
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: laulinh2 on June 18, 2025, 03:41:13 AM
Có VN nào bị lỗi build ra mà chạy file Main.exe báo lỗi Lua_Generic_call erro........ không >?
không, tôi chạy bình thường

Sao tui build = vs2022 ra bị lỗi ta
Tôi build bằng 2022 nhưng không lỗi
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: 2448778229 on June 18, 2025, 04:02:25 AM
how to change interface season 6?

Intentando cambiar a Interfase Season 2 10% terminado ajajaajaj

Intentare Season 6

       Friend, can you share your source?

(https://i.ibb.co/spzMm6yN/Screen-06-15-11-54-0003.jpg) (https://ibb.co/LDH2kJnc)
(https://i.ibb.co/CK8BLKv4/Screen-06-15-11-54-0002.jpg) (https://ibb.co/8gsMkg2G)





Season 2 - 76% Lo dejare hasta alli

Empiezo por season 6 aver como me va


(https://i.ibb.co/tPsmB7dW/Screen-06-15-11-55-0006.jpg) (https://ibb.co/x8jChp4R)
(https://i.ibb.co/8LxjKTdF/Screen-06-15-11-55-0005.jpg) (https://ibb.co/nN1DgZnh)


Comenzando season 6 5%

(https://i.ibb.co/BVZvWW78/season.jpg) (https://ibb.co/HDzRwwMm)

Comenzando season 6 - - -24%

(https://i.ibb.co/yLLMjDT/Screen-06-15-13-27-0001.jpg) (https://ibb.co/666pC2h)
(https://i.ibb.co/hFmhdYxd/Screen-06-15-13-27-0000.jpg) (https://ibb.co/v4jgdXCd)
Para que no te choque las interfaces debes borrar los botones render la interface qué dejo rox le puso botones render a los objetos.h de 5 2 elimina todos los números y se podrá poner interfaces custon de manera más fácil suerte
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: Malkom99 on June 18, 2025, 10:12:20 PM
any can share CAIController for mu helper plis
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: nhantac on June 22, 2025, 07:05:37 AM
@dakosmu How to unlock damage cap over 65k. tks bro
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: diolytion on June 25, 2025, 06:10:12 AM
hi, do you know how to animate the HP/MP interface?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: nhantac on June 25, 2025, 09:01:18 AM
hi, do you know how to animate the HP/MP interface?

Như thế này à
https://ibb.co/4nQkZPDf
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: KhongGianOL on June 25, 2025, 10:09:42 AM
hi, do you know how to animate the HP/MP interface?

Như thế này à
https://ibb.co/4nQkZPDf

sao tui làm đủ mọi cách mà chạy Main.exe vẫn xuất hiện hộp thoại Lua_Gerneric_Call error....ta
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: samsunggon on June 26, 2025, 02:40:40 AM
hi, do you know how to animate the HP/MP interface?

Như thế này à
https://ibb.co/4nQkZPDf

sao tui làm đủ mọi cách mà chạy Main.exe vẫn xuất hiện hộp thoại Lua_Gerneric_Call error....ta

main info

OnlyCryptedLua         = 0
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: KhongGianOL on June 27, 2025, 03:06:17 AM
Help, please add MuHelper ongame....
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: KhongGianOL on June 27, 2025, 10:41:19 AM
(https://i.ibb.co/YFm7zJR8/Source-Mu-Helper-Rox-Gaming-Main-5-2.jpg) (https://ibb.co/RkfpxtvP)
 

Please share it ? CNewUICheckBox

CNewUICheckBox* cbox = new CNewUICheckBox;
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: dakosmu on June 27, 2025, 03:47:18 PM
(https://i.ibb.co/YFm7zJR8/Source-Mu-Helper-Rox-Gaming-Main-5-2.jpg) (https://ibb.co/RkfpxtvP)
 

Please share it ? CNewUICheckBox

CNewUICheckBox* cbox = new CNewUICheckBox;

Revisar este hilo

https://tuservermu.com.ve/index.php?topic=55380.0
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: KhongGianOL on June 28, 2025, 11:26:03 AM
         IMAGE_MACROUI_HELPER_RAGEMINUS = BITMAP_INTERFACE_MACROUI_BEGIN,      // newui_position02.tga         (70, 25)   
         IMAGE_MACROUI_HELPER_OPTIONBUTTON = BITMAP_INTERFACE_MACROUI_BEGIN + 1,      // newui_position02.tga         (70, 25)   
         IMAGE_MACROUI_HELPER_INPUTNUMBER = BITMAP_INTERFACE_MACROUI_BEGIN + 2,
         IMAGE_MACROUI_HELPER_INPUTSTRING = BITMAP_INTERFACE_MACROUI_BEGIN + 3,


Help, Error search how this @dakosmu
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: ledemkhoc on June 28, 2025, 12:36:54 PM
thêm xong có sài được đâu bác
(https://i.ibb.co/23Zyhw29/Screen-06-28-23-35-0000.jpg) (https://ibb.co/d4mrMS9T)
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: KhongGianOL on June 28, 2025, 01:39:07 PM
thêm xong có sài được đâu bác
(https://i.ibb.co/23Zyhw29/Screen-06-28-23-35-0000.jpg) (https://ibb.co/d4mrMS9T)

         IMAGE_MACROUI_HELPER_RAGEMINUS = BITMAP_INTERFACE_MACROUI_BEGIN,      // newui_position02.tga         (70, 25)   
         IMAGE_MACROUI_HELPER_OPTIONBUTTON = BITMAP_INTERFACE_MACROUI_BEGIN + 1,      // newui_position02.tga         (70, 25)   
         IMAGE_MACROUI_HELPER_INPUTNUMBER = BITMAP_INTERFACE_MACROUI_BEGIN + 2,
         IMAGE_MACROUI_HELPER_INPUTSTRING = BITMAP_INTERFACE_MACROUI_BEGIN + 3,

Lỗi ở đây, cậu fix ntn mà hiện đc thế ?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: Malkom99 on June 29, 2025, 12:06:59 AM
fix bug custom raven to reload character dont attack any more, need reload gameserver.. any solution for this bug?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: ledemkhoc on June 29, 2025, 12:50:04 AM
bác tìm _TextureIndex.h thêm cái
BITMAP_INTERFACE_MACROUI_BEGIN,
BITMAP_INTERFACE_MACROUI_END = BITMAP_INTERFACE_MACROUI_BEGIN + 4,

muhelp này phải thêm helpdate mới sài dc mà rối não quá
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: KhongGianOL on June 29, 2025, 11:36:37 AM
bác tìm _TextureIndex.h thêm cái
BITMAP_INTERFACE_MACROUI_BEGIN,
BITMAP_INTERFACE_MACROUI_END = BITMAP_INTERFACE_MACROUI_BEGIN + 4,

muhelp này phải thêm helpdate mới sài dc mà rối não quá
Cho xin cái source main của cậu đc ko ? tui thêm vào r, nhấn phím Z cái nó hiện cái bảng kỳ cục lắm...k phải bản MuHelper
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: phuongcuongmsqm on June 30, 2025, 04:37:11 AM
bác tìm _TextureIndex.h thêm cái
BITMAP_INTERFACE_MACROUI_BEGIN,
BITMAP_INTERFACE_MACROUI_END = BITMAP_INTERFACE_MACROUI_BEGIN + 4,

muhelp này phải thêm helpdate mới sài dc mà rối não quá
Cho xin cái source main của cậu đc ko ? tui thêm vào r, nhấn phím Z cái nó hiện cái bảng kỳ cục lắm...k phải bản MuHelper
BÁC ADD ĐƯỢC HELPER CHƯA ?CHO E XIN MẤY FILE THIẾU VỚI Ạ
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: tiagozika on July 02, 2025, 09:41:22 AM
alguem consegiu usar olua do cliente e muserver aqui esta dando erro de call sempre se alguem poder ajudar me chama no whatsapp 48992218971
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: SPK on July 02, 2025, 10:40:28 AM
thêm xong có sài được đâu bác
(https://i.ibb.co/23Zyhw29/Screen-06-28-23-35-0000.jpg) (https://ibb.co/d4mrMS9T)
Xài được cái đầu cc =)) chúng nó share cái Form thôi. còn Code Controller nó đéo có Share... Mai t rảnh ta tách ra tao share luôn =))
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: phuongcuongmsqm on July 02, 2025, 08:38:55 PM
thêm xong có sài được đâu bác
(https://i.ibb.co/23Zyhw29/Screen-06-28-23-35-0000.jpg) (https://ibb.co/d4mrMS9T)
Xài được cái đầu cc =)) chúng nó share cái Form thôi. còn Code Controller nó đéo có Share... Mai t rảnh ta tách ra tao share luôn =))
THANK BÁC NHIỀU
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: spartacus on July 05, 2025, 08:50:00 PM
BUG:
chat not working
and
custom jewels need to switch character to apply


use em ZzzScene.cpp

if(ChatTime > 0) ChatTime--;
      if(MacroTime > 0) MacroTime--;

where exactly do i add this in the cpp?
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: caminhada on July 05, 2025, 09:19:45 PM
//FIX CHAT TO FOR ZzzScene.cpp

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "UIManager.h"
#include "GuildCache.h"
#include "ZzzOpenglUtil.h"
#include "ZzzBMD.h"
#include "ZzzInfomation.h"
#include "ZzzObject.h"
#include "ZzzCharacter.h"
#include "ZzzLodTerrain.h"
#include "ZzzInterface.h"
#include "ZzzInventory.h"
#include "ZzzTexture.h"
#include "ZzzOpenData.h"
#include "ZzzScene.h"
#include "ZzzEffect.h"
#include "ZzzAI.h"
#include "DSPlaySound.h"
#include "wsclientinline.h"
#include "SMD.h"
#include "Local.h"
#include "MatchEvent.h"
#include "PhysicsManager.h"
#include "./Utilities/Log/ErrorReport.h"
#include "CSQuest.h"
#include "PersonalShopTitleImp.h"
#include "uicontrols.h"
#include "GOBoid.h"
#include "GMHellas.h"
#include "CSItemOption.h"
#include "GMBattleCastle.h"
#include "GMHuntingGround.h"
#include "GMAida.h"
#include "GMCrywolf1st.h"
#include "npcBreeder.h"
#include "CSPetSystem.h"
#include "GIPetManager.h"
#include "CComGem.h"
#include "UIMapName.h"   // rozy
#include "./Time/Timer.h"
#include "Input.h"
#include "UIMng.h"
#include "LoadingScene.h"
#include "CDirection.h"
#include "GM_Kanturu_3rd.h"
#ifdef MOVIE_DIRECTSHOW
   #include <dshow.h>
   #include "MovieScene.h"
#endif // MOVIE_DIRECTSHOW
#include "Event.h"
#include "./Utilities/Log/muConsoleDebug.h"
#include "MixMgr.h"
#include "GameCensorship.h"
#include "GM3rdChangeUp.h"
#include "NewUISystem.h"
#include "NewUICommonMessageBox.h"
#include "PartyManager.h"
#include "w_CursedTemple.h"
#include "CameraMove.h"
#include "w_MapHeaders.h"
#include "w_PetProcess.h"
#include "PortalMgr.h"
#include "ServerListManager.h"
#include "ProtocolSend.h"
#include "MapManager.h"
#include <thread>
#include <chrono>
#include "Interfaces.h"
#include "Camera3D.h"
#include "CharacterList.h"
#ifdef NEW_MUHELPER_ON
#include "CAIController.h"
#endif
#include "WindowTray.h"

extern CUITextInputBox * g_pSingleTextInputBox;
extern CUITextInputBox * g_pSinglePasswdInputBox;
extern int g_iChatInputType;
extern BOOL g_bUseChatListBox;
extern DWORD g_dwMouseUseUIID;
extern DWORD g_dwActiveUIID;
extern DWORD g_dwKeyFocusUIID;   
extern CUIMapName* g_pUIMapName;
extern bool HighLight;
extern CTimer*   g_pTimer;

#ifdef MOVIE_DIRECTSHOW
   extern CMovieScene* g_pMovieScene;
#endif // MOVIE_DIRECTSHOW
   

bool   g_bTimeCheck = false;
int    g_iBackupTime = 0;

float   g_fMULogoAlpha = 0;

   // extern CGuildCache g_GuildCache;

extern float g_fSpecialHeight;

short   g_shCameraLevel = 0;


/*#ifdef _DEBUG
bool EnableEdit    = true;
#else
bool EnableEdit    = false;
#endif*/

int g_iLengthAuthorityCode = 20;

char *szServerIpAddress;
//char *szServerIpAddress = "210.181.89.215";
WORD g_ServerPort = 44405;

#ifdef MOVIE_DIRECTSHOW
int  SceneFlag = MOVIE_SCENE;
#else // MOVIE_DIRECTSHOW
int  SceneFlag = WEBZEN_SCENE;
#endif // MOVIE_DIRECTSHOW

int  MoveSceneFrame = 0;

extern int g_iKeyPadEnable;


CPhysicsManager g_PhysicsManager;


char *g_lpszMp3[NUM_MUSIC] =
{
   "data\\music\\Pub.mp3",
   "data\\music\\Mutheme.mp3",
   "data\\music\\Church.mp3",
   "data\\music\\Devias.mp3",
   "data\\music\\Noria.mp3",
   "data\\music\\Dungeon.mp3",
   "data\\music\\atlans.mp3",
   "data\\music\\icarus.mp3",
   "data\\music\\tarkan.mp3",
   "data\\music\\lost_tower_a.mp3",
   "data\\music\\lost_tower_b.mp3",
   "data\\music\\kalima.mp3",
    "data\\music\\castle.mp3",
    "data\\music\\charge.mp3",
    "data\\music\\lastend.mp3",
   "data\\music\\huntingground.mp3",
   "data\\music\\Aida.mp3",
   "data\\music\\crywolf1st.mp3",
   "data\\music\\crywolf_ready-02.ogg",
   "data\\music\\crywolf_before-01.ogg",
   "data\\music\\crywolf_back-03.ogg",
   "data\\music\\main_theme.mp3",
   "data\\music\\kanturu_1st.mp3",
   "data\\music\\kanturu_2nd.mp3",
   "data\\music\\KanturuMayaBattle.mp3",
   "data\\music\\KanturuNightmareBattle.mp3",
   "data\\music\\KanturuTower.mp3",
   "data\\music\\BalgasBarrack.mp3",
   "data\\music\\BalgasRefuge.mp3",
   "data\\music\\cursedtemplewait.mp3",
   "data\\music\\cursedtempleplay.mp3",
   "data\\music\\elbeland.mp3",
   "data\\music\\login_theme.mp3",
   "data\\music\\SwampOfCalmness.mp3",
   "data\\music\\Raklion.mp3",
   "data\\music\\Raklion_Hatchery.mp3",
   "data\\music\\Santa_Village.mp3",
   "data\\music\\DuelArena.mp3",
   "data\\music\\PK_Field.mp3",
   "data\\music\\ImperialGuardianFort.mp3",
   "data\\music\\ImperialGuardianFort.mp3",
   "data\\music\\ImperialGuardianFort.mp3",
   "data\\music\\ImperialGuardianFort.mp3",
   "data\\music\\iDoppelganger.mp3",
   "data\\music\\iDoppelganger.mp3",
#ifdef ASG_ADD_MAP_KARUTAN
   "data\\music\\Karutan_A.mp3",
   "data\\music\\Karutan_B.mp3",
#endif   // ASG_ADD_MAP_KARUTAN
};

extern char Mp3FileName[256];

#define MAX_LENGTH_CMB   ( 38)

DWORD   g_dwWaitingStartTick;
int     g_iRequestCount;

int     g_iMessageTextStart     = 0;
char    g_cMessageTextCurrNum   = 0;
char    g_cMessageTextNum       = 0;
int     g_iNumLineMessageBoxCustom;
char    g_lpszMessageBoxCustom[NUM_LINE_CMB][MAX_LENGTH_CMB];
int     g_iCustomMessageBoxButton[NUM_BUTTON_CMB][NUM_PAR_BUTTON_CMB];

int     g_iCustomMessageBoxButton_Cancel[NUM_PAR_BUTTON_CMB];

int      g_iCancelSkillTarget   = 0;

#define NUM_LINE_DA      ( 1)
int g_iCurrentDialogScript = -1;
int g_iNumAnswer = 0;
char g_lpszDialogAnswer[MAX_ANSWER_FOR_DIALOG][NUM_LINE_DA][MAX_LENGTH_CMB];

DWORD GenerateCheckSum2( BYTE *pbyBuffer, DWORD dwSize, WORD wKey);

void StopMusic()
{
   for ( int i = 0; i < NUM_MUSIC; ++i)
   {
      StopMp3( g_lpszMp3);
   }
}

bool CheckAbuseFilter(char *Text, bool bCheckSlash)
{
   if (bCheckSlash == true)
   {
      if ( Text[0] == '/')
      {
         return false;
      }
   }

   int icntText = 0;
   char TmpText[2048];
   for( int i=0; i<(int)strlen(Text); ++i )
   {
      if ( Text!=32 )
      {
         TmpText[icntText] = Text;
         icntText++;
      }
   }
   TmpText[icntText] = 0;

   for(int i=0;i<AbuseFilterNumber;i++)
   {
        if(FindText(TmpText,AbuseFilter))
      {
         return true;
      }
   }
   return false;
}

bool CheckAbuseNameFilter(char *Text)
{
   int icntText = 0;
   char TmpText[256];
   for( int i=0; i<(int)strlen(Text); ++i )
   {
      if ( Text!=32 )
      {
         TmpText[icntText] = Text;
         icntText++;
      }
   }
   TmpText[icntText] = 0;

   for(int i=0;i<AbuseNameFilterNumber;i++)
   {
      if(FindText(TmpText,AbuseNameFilter))
      {
         return true;
      }
   }
   return false;
}

bool CheckName()
{
    if( CheckAbuseNameFilter(InputText[0]) || CheckAbuseFilter(InputText[0]) ||
      FindText(InputText[0]," ") || FindText(InputText[0],"¡¡") ||
      FindText(InputText[0],".") || FindText(InputText[0],"¡¤") || FindText(InputText[0],"¡­") ||
      FindText(InputText[0],"Webzen") || FindText(InputText[0],"WebZen") || FindText(InputText[0],"webzen") ||  FindText(InputText[0],"WEBZEN") ||
      FindText(InputText[0],GlobalText[457]) || FindText(InputText[0],GlobalText[458]))
      return true;
   return false;
}

#ifdef MOVIE_DIRECTSHOW
void MovieScene(HDC hDC)
{
   if(g_pMovieScene->GetPlayNum() == 0)
   {
      g_pMovieScene->InitOpenGLClear(hDC);
      
      g_pMovieScene->Initialize_DirectShow(g_hWnd, MOVIE_FILE_WMV);
      
      if(g_pMovieScene->IsFile() == FALSE || g_pMovieScene->IsFailDirectShow() == TRUE)
      {
         g_pMovieScene->Destroy();
         SAFE_DELETE(g_pMovieScene);
         SceneFlag = WEBZEN_SCENE;
         return;   
      }

      g_pMovieScene->PlayMovie();

      if(g_pMovieScene->IsEndMovie())
      {
         g_pMovieScene->Destroy();
         SAFE_DELETE(g_pMovieScene);
         SceneFlag = WEBZEN_SCENE;
         return;
      }
      else
      {
         if(HIBYTE(GetAsyncKeyState(VK_ESCAPE))==128 || HIBYTE(GetAsyncKeyState(VK_RETURN))==128)
         {
            g_pMovieScene->Destroy();
            SAFE_DELETE(g_pMovieScene);
            SceneFlag = WEBZEN_SCENE;
            return;
         }
      }
   }
   else
   {
      g_pMovieScene->Destroy();
      SAFE_DELETE(g_pMovieScene);
      SceneFlag = WEBZEN_SCENE;
      return;
   }
}
#endif // MOVIE_DIRECTSHOW

bool EnableMainRender = false;
extern int HeroKey;

void WebzenScene(HDC hDC)
{
   CUIMng& rUIMng = CUIMng::Instance();

   OpenFont();
   ClearInput();

   LoadBitmap("Interface\\New_lo_back_01.jpg", BITMAP_TITLE, GL_LINEAR);
   LoadBitmap("Interface\\New_lo_back_02.jpg", BITMAP_TITLE+1, GL_LINEAR);
   LoadBitmap("Interface\\MU_TITLE.tga", BITMAP_TITLE+2, GL_LINEAR);
   LoadBitmap("Interface\\lo_121518.tga", BITMAP_TITLE+3, GL_LINEAR);
   LoadBitmap("Interface\\New_lo_webzen_logo.tga", BITMAP_TITLE+4, GL_LINEAR);
   LoadBitmap("Interface\\lo_lo.jpg", BITMAP_TITLE+5, GL_LINEAR, GL_REPEAT);
   LoadBitmap("Interface\\lo_back_s5_03.jpg", BITMAP_TITLE+6, GL_LINEAR);
   LoadBitmap("Interface\\lo_back_s5_04.jpg", BITMAP_TITLE+7, GL_LINEAR);
   if(rand()%100 <= 70)
   {
      LoadBitmap("Interface\\lo_back_im01.jpg", BITMAP_TITLE+8, GL_LINEAR);
      LoadBitmap("Interface\\lo_back_im02.jpg", BITMAP_TITLE+9, GL_LINEAR);   
      LoadBitmap("Interface\\lo_back_im03.jpg", BITMAP_TITLE+10, GL_LINEAR);
      LoadBitmap("Interface\\lo_back_im04.jpg", BITMAP_TITLE+11, GL_LINEAR);
      LoadBitmap("Interface\\lo_back_im05.jpg", BITMAP_TITLE+12, GL_LINEAR);
      LoadBitmap("Interface\\lo_back_im06.jpg", BITMAP_TITLE+13, GL_LINEAR);
   }
   else
   {
      LoadBitmap("Interface\\lo_back_s5_im01.jpg", BITMAP_TITLE+8, GL_LINEAR);
      LoadBitmap("Interface\\lo_back_s5_im02.jpg", BITMAP_TITLE+9, GL_LINEAR);   
      LoadBitmap("Interface\\lo_back_s5_im03.jpg", BITMAP_TITLE+10, GL_LINEAR);
      LoadBitmap("Interface\\lo_back_s5_im04.jpg", BITMAP_TITLE+11, GL_LINEAR);
      LoadBitmap("Interface\\lo_back_s5_im05.jpg", BITMAP_TITLE+12, GL_LINEAR);
      LoadBitmap("Interface\\lo_back_s5_im06.jpg", BITMAP_TITLE+13, GL_LINEAR);
   }

   rUIMng.CreateTitleSceneUI();
   
   FogEnable = false;
   
   ::EnableAlphaTest();
   OpenBasicData(hDC);

   g_pNewUISystem->LoadMainSceneInterface();

   CUIMng::Instance().RenderTitleSceneUI(hDC, 11, 11);

   rUIMng.ReleaseTitleSceneUI();
      DeleteBitmap(BITMAP_TITLE);
      DeleteBitmap(BITMAP_TITLE+1);
   DeleteBitmap(BITMAP_TITLE+2);
      DeleteBitmap(BITMAP_TITLE+3);
   DeleteBitmap(BITMAP_TITLE+4);
      DeleteBitmap(BITMAP_TITLE+5);

   for(int i=6; i<14; ++i)
      DeleteBitmap(BITMAP_TITLE+i);

   g_ErrorReport.Write( "> Loading ok.\r\n");

   SceneFlag = LOG_IN_SCENE;   //

   gInterface.hdc = hDC;

   gInterface.m_Lua.Generic_Call("FinalBoot", ">");
}

int MenuStateCurrent = MENU_SERVER_LIST;
int MenuStateNext    = MENU_SERVER_LIST;
int DeleteGuildIndex = -1;

void DeleteCharacter()
{
   SelectedHero = -1;
   if (g_iChatInputType == 1)
   {
      g_pSinglePasswdInputBox->GetText(InputText[0]);
      g_pSinglePasswdInputBox->SetText(NULL);
      g_pSinglePasswdInputBox->SetState(UISTATE_HIDE);
   }
   SendRequestDeleteCharacter(CharactersClient[SelectedHero].ID,InputText[0]);

   MenuStateCurrent = MENU_DELETE_LEFT;
   MenuStateNext    = MENU_NEW_DOWN;
   PlayBuffer(SOUND_MENU01);
   
   ClearInput();
   InputEnable = false;
}
int  ErrorMessage = NULL;
int    ErrorMessageNext = NULL;
extern bool g_bEnterPressed;

bool IsEnterPressed() {
   return g_bEnterPressed;
}

void SetEnterPressed( bool enterpressed ) {
   g_bEnterPressed = enterpressed;
}

BOOL CheckOptionMouseClick(int iOptionPos_y, BOOL bPlayClickSound = TRUE)
{
   if (CheckMouseIn((640-120)/2, 30+iOptionPos_y, 120, 22) && MouseLButtonPush)
   {
      MouseLButtonPush = false;
      MouseUpdateTime = 0;
      MouseUpdateTimeMax = 6;
      if (bPlayClickSound == TRUE) PlayBuffer(SOUND_CLICK01);
      return TRUE;
   }
   return FALSE;
}

int SeparateTextIntoLines( const char *lpszText, char *lpszSeparated, int iMaxLine, int iLineSize)
{
   int iLine = 0;
   const char *lpLineStart = lpszText;
   char *lpDst = lpszSeparated;
   const char *lpSpace = NULL;
   int iMbclen = 0;
   for ( const char* lpSeek = lpszText; *lpSeek; lpSeek += iMbclen, lpDst += iMbclen)
   {
      iMbclen = _mbclen( ( unsigned char*)lpSeek);
      if ( iMbclen + ( int)( lpSeek - lpLineStart) >= iLineSize)
      {
         if ( lpSpace && ( int)( lpSeek - lpSpace) < min( 10, iLineSize / 2))
         {
            lpDst -= ( lpSeek - lpSpace - 1);
            lpSeek = lpSpace + 1;
         }

         lpLineStart = lpSeek;
         *lpDst = '\0';
         if ( iLine >= iMaxLine - 1)
         {
            break;
         }
         ++iLine;
         lpDst = lpszSeparated + iLine * iLineSize;
         lpSpace = NULL;
      }

      memcpy( lpDst, lpSeek, iMbclen);
      if ( *lpSeek == ' ')
      {
         lpSpace = lpSeek;
      }
   }
   *lpDst = '\0';

   return ( iLine + 1);
}

void SetEffectVolumeLevel ( int level )
{
   if(level > 9)
      level = 9;
   if(level < 0)
      level = 0;

   if(level == 0)
   {
      SetMasterVolume(-10000);
   }
   else
   {
      long vol = -2000*log10(10.f/float(level));
      SetMasterVolume(vol);
   }
}

void SetViewPortLevel ( int Wheel )
{
    if ( (HIBYTE( GetAsyncKeyState(VK_CONTROL))==128) )
    {
        if ( Wheel>0 )
            g_shCameraLevel--;
        else if ( Wheel<0 )
            g_shCameraLevel++;

        MouseWheel = 0;

       if ( g_shCameraLevel>4 )
          g_shCameraLevel = 4;
       if ( g_shCameraLevel<0 )
          g_shCameraLevel = 0;
    }
}

void RenderInfomation3D()
{
   bool Success = false;

   if ( ( ( ErrorMessage==MESSAGE_TRADE_CHECK || ErrorMessage==MESSAGE_CHECK ) && AskYesOrNo==1 )
      || ErrorMessage==MESSAGE_USE_STATE
      || ErrorMessage==MESSAGE_USE_STATE2)
   {
      Success = true;
   }

    if ( ErrorMessage==MESSAGE_TRADE_CHECK && AskYesOrNo==5 )
   {
      Success = true;
   }
   if ( ErrorMessage==MESSAGE_PERSONALSHOP_WARNING )
   {
      Success = true;
   }

   if ( Success )
    {
        glMatrixMode(GL_PROJECTION);
        glPushMatrix();
        glLoadIdentity();
        glViewport2(0,0,WindowWidth,WindowHeight);
        gluPerspective2(1.f,(float)(WindowWidth)/(float)(WindowHeight),CameraViewNear,CameraViewFar);
        glMatrixMode(GL_MODELVIEW);
        glPushMatrix();
        glLoadIdentity();
        GetOpenGLMatrix(CameraMatrix);
        EnableDepthTest();
        EnableDepthMask();

        float Width, Height;
        float x = (640-150)/2;
        float y;
        if ( ErrorMessage==MESSAGE_TRADE_CHECK )
        {
            y = 60+55;
        }
        else
        {
            y = 60+55;
        }

       Width=40.f;Height=60.f;
      int iRenderType = ErrorMessage;
      if(AskYesOrNo == 5)
         iRenderType = MESSAGE_USE_STATE;
      switch( iRenderType )
      {
      case MESSAGE_USE_STATE :
      case MESSAGE_USE_STATE2 :
        case MESSAGE_PERSONALSHOP_WARNING :
            RenderItem3D(x,y,Width,Height,TargetItem.Type,TargetItem.Level,TargetItem.Option1,TargetItem.ExtOption,true);
         break;

      default :
            RenderItem3D(x,y,Width,Height,PickItem.Type,PickItem.Level,PickItem.Option1,PickItem.ExtOption,true);
         break;
      }

      glMatrixMode(GL_MODELVIEW);
      glPopMatrix();
      glMatrixMode(GL_PROJECTION);
      glPopMatrix();
      UpdateMousePositionn();
    }
}

void RenderInfomation()
{
   if (SceneFlag == MAIN_SCENE)
   {
      gInterface.m_Lua.Generic_Call("MainProc", ">");
   }

   gCharacterList.RenderCharacterList();

   RenderNotices();
   
   CUIMng::Instance().Render();

   if(SceneFlag == LOG_IN_SCENE || SceneFlag == CHARACTER_SCENE)
   {
      RenderCursor();
   }
   
    RenderInfomation3D();
}

BOOL ShowCheckBox( int num, int index, int message )
{
   if ( message==MESSAGE_USE_STATE || message==MESSAGE_USE_STATE2)
    {
        char Name[50] = { 0, };
        if ( TargetItem.Type==ITEM_HELPER+15 )
        {
            switch ( (TargetItem.Level>>3)&15 )
            {
            case 0:sprintf(Name,"%s", GlobalText[168] );break;
            case 1:sprintf(Name,"%s", GlobalText[169] );break;
            case 2:sprintf(Name,"%s", GlobalText[167] );break;
            case 3:sprintf(Name,"%s", GlobalText[166] );break;
         case 4:sprintf(Name,"%s", GlobalText[1900] );break;
            }
        }

      if (message==MESSAGE_USE_STATE2)
         sprintf ( g_lpszMessageBoxCustom[0], "( %s%s )", Name, GlobalText[1901] );
      else
         sprintf ( g_lpszMessageBoxCustom[0], "( %s )", Name );
      
        num++;
        for ( int i=1; i<num; ++i )
        {
           sprintf ( g_lpszMessageBoxCustom, GlobalText[index] );
        }
        g_iNumLineMessageBoxCustom = num;
    }
   else if ( message==MESSAGE_PERSONALSHOP_WARNING )
   {
      char szGold[256];
      ConvertGold(InputGold,szGold);
       sprintf ( g_lpszMessageBoxCustom[0], GlobalText[index], szGold );

        for ( int i=1; i<num; ++i )
        {
           sprintf ( g_lpszMessageBoxCustom, GlobalText[index+i] );
        }
        g_iNumLineMessageBoxCustom = num;
   }
    else if ( message==MESSAGE_CHAOS_CASTLE_CHECK )
    {
       g_iNumLineMessageBoxCustom = 0;
        for ( int i=0; i<num; ++i )
        {
           g_iNumLineMessageBoxCustom += SeparateTextIntoLines( GlobalText[index+i], g_lpszMessageBoxCustom[g_iNumLineMessageBoxCustom], NUM_LINE_CMB, MAX_LENGTH_CMB);
        }
    }
   else if ( message==MESSAGE_GEM_INTEGRATION3)
   {
      char tBuf[MAX_GLOBAL_TEXT_STRING];
      char tLines[2][30];
      for(int t = 0; t < 2; ++t) memset(tLines[t], 0, 20);
      g_iNumLineMessageBoxCustom = 0;
      if(COMGEM::isComMode())
      {
         if(COMGEM::m_cGemType == 0) sprintf(tBuf, GlobalText[1809], GlobalText[1806], COMGEM::m_cCount);
         else sprintf(tBuf, GlobalText[1809], GlobalText[1807], COMGEM::m_cCount);

         g_iNumLineMessageBoxCustom += SeparateTextIntoLines( tBuf,
            tLines[g_iNumLineMessageBoxCustom], 2, 30);

         for(int t = 0; t < 2; ++t) strcpy(g_lpszMessageBoxCustom[t], tLines[t]);

         sprintf(g_lpszMessageBoxCustom[g_iNumLineMessageBoxCustom], GlobalText[1810], COMGEM::m_iValue);
         ++g_iNumLineMessageBoxCustom;

      }
      else
      {
         int t_GemLevel = COMGEM::GetUnMixGemLevel()+1;
         if(COMGEM::m_cGemType == 0) sprintf(tBuf, GlobalText[1813], GlobalText[1806], t_GemLevel);
         else sprintf(tBuf, GlobalText[1813], GlobalText[1807], t_GemLevel);

         g_iNumLineMessageBoxCustom += SeparateTextIntoLines( tBuf,
            tLines[g_iNumLineMessageBoxCustom], 2, 30);

         for(int t = 0; t < 2; ++t) strcpy(g_lpszMessageBoxCustom[t], tLines[t]);

         sprintf(g_lpszMessageBoxCustom[g_iNumLineMessageBoxCustom], GlobalText[1814], COMGEM::m_iValue);
         ++g_iNumLineMessageBoxCustom;
      }
   }
   else if(message == MESSAGE_CANCEL_SKILL)
   {
      char tBuf[MAX_GLOBAL_TEXT_STRING];   
      sprintf(tBuf, "%s%s", SkillAttribute[index].Name, GlobalText[2046]);
      g_iNumLineMessageBoxCustom = SeparateTextIntoLines(tBuf, g_lpszMessageBoxCustom[0], 2, MAX_LENGTH_CMB);
      g_iCancelSkillTarget = index;
   }
    else
    {
        for ( int i=0; i<num; ++i )
        {
           strcpy ( g_lpszMessageBoxCustom, GlobalText[index+i]);
        }
        g_iNumLineMessageBoxCustom = num;
    }

   ZeroMemory( g_iCustomMessageBoxButton, NUM_BUTTON_CMB * NUM_PAR_BUTTON_CMB * sizeof ( int) );

    int iOkButton[5]     = { 1,  21, 90, 70, 21};
    int iCancelButton[5] = { 3, 120, 90, 70, 21};

   if(message == MESSAGE_USE_STATE2)
   {
      iOkButton[1]    = 22;   
      iOkButton[2]    = 92;   // y
      iOkButton[3]     = 49;
      iOkButton[4]     = 16;

      iCancelButton[1] = 82;
      iCancelButton[2] = 92;   // y
      iCancelButton[3] = 49;
      iCancelButton[4] = 16;

      g_iCustomMessageBoxButton_Cancel[0] = 5;
      g_iCustomMessageBoxButton_Cancel[1] = 142;   // x
      g_iCustomMessageBoxButton_Cancel[2] = 92;   // y
      g_iCustomMessageBoxButton_Cancel[3] = 49;   // width
      g_iCustomMessageBoxButton_Cancel[4] = 16;   // height
   }

    if ( message==MESSAGE_CHAOS_CASTLE_CHECK )
    {
        iOkButton[2]     = 120;
        iCancelButton[2] = 120;
    }
   
    memcpy( g_iCustomMessageBoxButton[0], iOkButton, 5 * sizeof ( int));
    memcpy( g_iCustomMessageBoxButton[1], iCancelButton, 5 * sizeof ( int));

   return true;
}

int    CameraWalkCut;
int    CurrentCameraCount    = -1;
int    CurrentCameraWalkType = 0;
int    CurrentCameraNumber   = 0;
vec3_t CurrentCameraPosition;
vec3_t CurrentCameraAngle;
float  CurrentCameraWalkDelta[6];
float  CameraWalk[] =
{
    0.f,-1000.f,500.f,-80.f,0.f, 0.f,
    0.f,-1100.f,500.f,-80.f,0.f, 0.f,
    0.f,-1100.f,500.f,-80.f,0.f, 0.f,
     0.f,-1100.f,500.f,-80.f,0.f, 0.f,
    0.f,-1100.f,500.f,-80.f,0.f, 0.f,
   200.f,-800.f,250.f,-87.f,0.f, -10.f,
};

void MoveCharacterCamera(vec3_t Origin,vec3_t Position,vec3_t Angle)
{
   vec3_t TransformPosition;
   CameraAngle[0] = 0.f;
   CameraAngle[1] = 0.f;
   CameraAngle[2] = Angle[2];
   float Matrix[3][4];
   AngleMatrix(CameraAngle,Matrix);
   VectorIRotate(Position,Matrix,TransformPosition);
   VectorAdd(Origin,TransformPosition,CameraPosition);
   CameraAngle[0] = Angle[0];
}

void MoveCamera()
{
   if (CCameraMove::GetInstancePtr()->IsTourMode())
   {
      return;
   }

    if(CurrentCameraCount == -1)
   {
      for(int i=0;i<3;i++)
      {
         CurrentCameraPosition = CameraWalk[i  ];
         CurrentCameraAngle    = CameraWalk[i+3];
      }
      CurrentCameraNumber = 1;
      CurrentCameraWalkType = 1;

      for(int i=0;i<3;i++)
      {
         CurrentCameraWalkDelta[i  ] = (CameraWalk[CurrentCameraNumber*6+i  ]-CurrentCameraPosition)/128;
         CurrentCameraWalkDelta[i+3] = (CameraWalk[CurrentCameraNumber*6+i+3]-CurrentCameraAngle   )/128;
      }
   }
   CurrentCameraCount++;
    if((CameraWalkCut==0 && CurrentCameraCount>=40) || (CameraWalkCut>0 && CurrentCameraCount>=128))
   {
        CurrentCameraCount = 0;
      if(CameraWalkCut==0)
      {
         CameraWalkCut = 1;
      }
      else
      {
            if(SceneFlag == LOG_IN_SCENE)
         {
            CurrentCameraNumber = rand()%4+1;
            CurrentCameraWalkType = rand()%2;
         }
         else
         {
               CurrentCameraNumber = 5;
            CurrentCameraWalkType = 0;
         }
      }
      for(int i=0;i<3;i++)
      {
         CurrentCameraWalkDelta[i  ] = (CameraWalk[CurrentCameraNumber*6+i  ]-CurrentCameraPosition)/128;
         CurrentCameraWalkDelta[i+3] = (CameraWalk[CurrentCameraNumber*6+i+3]-CurrentCameraAngle   )/128;
      }
   }
   if(CurrentCameraWalkType==0)
   {
       for(int i=0;i<3;i++)
      {
         CurrentCameraPosition += (CameraWalk[CurrentCameraNumber*6+i  ]-CurrentCameraPosition)/6;
         CurrentCameraAngle    += (CameraWalk[CurrentCameraNumber*6+i+3]-CurrentCameraAngle   )/6;
      }
   }
   else
   {
       for(int i=0;i<2;i++)
      {
         CurrentCameraPosition += CurrentCameraWalkDelta[i  ];
      }
   }
    CameraFOV = 45.f;
   vec3_t Position;
   Vector(0.f,0.f,0.f,Position);
    MoveCharacterCamera(Position,CurrentCameraPosition,CurrentCameraAngle);
}

bool MenuCancel         = true;
bool EnableSocket       = false;
bool InitLogIn          = false;
bool InitLoading        = false;
bool InitCharacterScene = false;
bool InitMainScene      = false;
int  MenuY = 480;
int  MenuX = -200;
extern char LogInID[MAX_ID_SIZE+1];
extern char m_ExeVersion[11];

BOOL Util_CheckOption( char *lpszCommandLine, unsigned char cOption, char *lpszString);

extern DWORD g_dwBKConv;
extern DWORD g_dwBKSent;
extern BOOL g_bIMEBlock;

int SelectedHero = -1;
bool MoveMainCamera();

void StartGame()
{
   {
      if (CTLCODE_01BLOCKCHAR & CharactersClient[SelectedHero].CtlCode)
         CUIMng::Instance().PopUpMsgWin(MESSAGE_BLOCKED_CHARACTER);
      else
      {
         CharacterAttribute->Level = CharactersClient[SelectedHero].Level;
         CharacterAttribute->Class = CharactersClient[SelectedHero].Class;
         CharacterAttribute->Skin  = CharactersClient[SelectedHero].Skin;
         ::strcpy(CharacterAttribute->Name, CharactersClient[SelectedHero].ID);

         ::ReleaseCharacterSceneData();
         InitLoading = false;
         SceneFlag = LOADING_SCENE;
      }
   }
}

void CreateCharacterScene()
{
   g_pNewUIMng->ResetActiveUIObj();

   EnableMainRender = true;
   MouseOnWindow = false;
   ErrorMessage = NULL;

#ifdef PJH_NEW_SERVER_SELECT_MAP
   gMapManager.WorldActive = WD_74NEW_CHARACTER_SCENE;
#else //PJH_NEW_SERVER_SELECT_MAP
   gMapManager.WorldActive = WD_78NEW_CHARACTER_SCENE;
#endif //PJH_NEW_SERVER_SELECT_MAP

   gMapManager.LoadWorld(gMapManager.WorldActive);
    OpenCharacterSceneData();

    CreateCharacterPointer(&CharacterView,MODEL_FACE+1,0,0);
   CharacterView.Class = 1;
   CharacterView.Object.Kind = 0;
   
   SelectedHero = -1;
   CUIMng::Instance().CreateCharacterScene();

    ClearInventory();
    CharacterAttribute->SkillNumber = 0;

   for(int i=0;i<MAX_MAGIC;i++)
      CharacterAttribute->Skill = 0;

   for(int i=EQUIPMENT_WEAPON_RIGHT;i<EQUIPMENT_HELPER;i++)
      CharacterMachine->Equipment.Level = 0;

   g_pNewUISystem->HideAll();

   g_iKeyPadEnable = 0;
   GuildInputEnable = false;
   TabInputEnable   = false;
   GoldInputEnable  = false;
   InputEnable      = true;
    ClearInput();
   InputIndex = 0;
    InputTextWidth = 90;
    InputNumber = 1;

   for(int i=0;i<MAX_WHISPER;i++)
   {
      g_pChatListBox->AddText("", "", SEASON3B::TYPE_WHISPER_MESSAGE);
   }

   HIMC hIMC = ImmGetContext(g_hWnd);
    DWORD Conversion, Sentence;

   Conversion = IME_CMODE_NATIVE;
   Sentence = IME_SMODE_NONE;

   g_bIMEBlock = FALSE;
   RestoreIMEStatus();
   ImmSetConversionStatus(hIMC, Conversion, Sentence);
   ImmGetConversionStatus(hIMC, &g_dwBKConv, &g_dwBKSent);
   SaveIMEStatus();
   ImmReleaseContext(g_hWnd, hIMC);
   g_bIMEBlock = TRUE;

    g_ErrorReport.Write( "> Character scene init success.\r\n");
}

void NewMoveCharacterScene()
{
   if (CurrentProtocolState < RECEIVE_CHARACTERS_LIST)
   {
      return;
   }


   if (!InitCharacterScene)
   {
      InitCharacterScene = true;
      CreateCharacterScene();
   }

   gCharacterList.MoveCharacterList();

    InitTerrainLight();
    MoveObjects();
   MoveBugs();
    MoveCharactersClient();
    MoveCharacterClient(&CharacterView);

   MoveEffects();
    MoveJoints();
    MoveParticles();
   MoveBoids();

   ThePetProcess().UpdatePets();

    MoveCamera();

#if defined _DEBUG || defined FOR_WORK
   char lpszTemp[256];
   if (::Util_CheckOption(::GetCommandLine(), 'c', lpszTemp))
   {
      SelectedHero = ::atoi(lpszTemp);
      ::StartGame();
   }
#endif

   CInput& rInput = CInput::Instance();
   CUIMng& rUIMng = CUIMng::Instance();

   if (rInput.IsKeyDown(VK_RETURN))
   {
      if (!(rUIMng.m_MsgWin.IsShow() || rUIMng.m_CharMakeWin.IsShow()
         || rUIMng.m_SysMenuWin.IsShow() || rUIMng.m_OptionWin.IsShow())
         && SelectedHero > -1 && SelectedHero < gCharacterList.MaxCharacters)
      {
         ::PlayBuffer(SOUND_CLICK01);

         if(SelectedCharacter >= 0)
            SelectedHero = SelectedCharacter;

         ::StartGame();
      }
   }
   else if (rInput.IsKeyDown(VK_ESCAPE))
   {
      if (!(rUIMng.m_MsgWin.IsShow() || rUIMng.m_CharMakeWin.IsShow()
         || rUIMng.m_SysMenuWin.IsShow() || rUIMng.m_OptionWin.IsShow()
         )
         && rUIMng.IsSysMenuWinShow() )
      {
         ::PlayBuffer(SOUND_CLICK01);
         rUIMng.ShowWin(&rUIMng.m_SysMenuWin);
      }
   }

   if (rUIMng.IsCursorOnUI())
   {
      return;
   }

   if (rInput.IsLBtnDbl() && rUIMng.m_CharSelMainWin.IsShow())
   {
      if (SelectedCharacter < 0 || SelectedCharacter >(gCharacterList.MaxCharacters - 1))
      {
         return;
      }

      SelectedHero = SelectedCharacter;
      ::StartGame();
   }
   else if(rInput.IsLBtnDn())
   {
      if (SelectedCharacter < 0 || SelectedCharacter >(gCharacterList.MaxCharacters - 1))
         SelectedHero = -1;
      else
         SelectedHero = SelectedCharacter;
      rUIMng.m_CharSelMainWin.UpdateDisplay();
   }

   g_ConsoleDebug->UpdateMainScene();
}

bool NewRenderCharacterScene(HDC hDC)
{
   if(!InitCharacterScene)
   {
      return false;
   }
   if(CurrentProtocolState < RECEIVE_CHARACTERS_LIST)
   {
      return false;
   }

    FogEnable = false;
   vec3_t pos;
   Vector(9758.0f, 18913.0f, 675.0f, pos);

    GWidescreen.SceneLogin();

   int Width,Height;

   glColor3f(1.f,1.f,1.f);
#ifndef PJH_NEW_SERVER_SELECT_MAP
   BeginBitmap();
      Width = 320;
      Height = 320;
      RenderBitmap(BITMAP_LOG_IN+9,  (float)0,(float)25,(float)Width,(float)Height,0.f,0.f);
      RenderBitmap(BITMAP_LOG_IN+10,(float)320,(float)25,(float)Width,(float)Height,0.f,0.f);
   EndBitmap();
#endif //PJH_NEW_SERVER_SELECT_MAP
   Height = 480;
   Width = FrameBeginOpengl();
   
   glClearColor(0.f,0.f,0.f,1.f);
   BeginOpengl(0, 25, GetWindowsX, GetWindowsY - 50);
   
   CreateFrustrum((float)Width/(float)640, pos);

   OBJECT *o = &CharactersClient[SelectedHero].Object;

   CreateScreenVector(MouseX,MouseY,MouseTarget);
   for (int i = 0; i < gCharacterList.MaxCharacters; i++)
   {
      CharactersClient.Object.Position[2] = 163.0f;
      Vector ( 0.0f, 0.0f, 0.0f, CharactersClient.Object.Light );
   }

   if(SelectedHero!=-1 && o->Live)
   {
      EnableAlphaBlend();
      vec3_t Light;
      Vector ( 1.0f, 1.0f, 1.0f, Light );
      Vector ( 1.0f, 1.0f, 1.0f, o->Light );
      AddTerrainLight(o->Position[0],o->Position[1],Light,1,PrimaryTerrainLight);
      DisableAlphaBlend();
   }

   CHARACTER* pCha = NULL;
   OBJECT* pObj = NULL;

   for (int i = 0; i < gCharacterList.MaxCharacters; ++i)
   {
      pCha = &CharactersClient;
      pObj = &pCha->Object;
      if (pCha->Helper.Type == MODEL_HELPER + 3 || gHelperSystem.CheckHelperType(pCha->Helper.Type, 4) == 1)
      {
#ifdef PJH_NEW_SERVER_SELECT_MAP
         pObj->Position[2] = 194.5f;
#else //PJH_NEW_SERVER_SELECT_MAP
         pObj->Position[2] = 55.0f;
#endif //PJH_NEW_SERVER_SELECT_MAP
      }
      else
      {
#ifdef PJH_NEW_SERVER_SELECT_MAP
         pObj->Position[2] = 169.5f;
#else //PJH_NEW_SERVER_SELECT_MAP
         pObj->Position[2] = 30.0f;
#endif //PJH_NEW_SERVER_SELECT_MAP
      }
   }

   RenderTerrain(false);
   RenderObjects();
   RenderCharactersClient();

   if(!CUIMng::Instance().IsCursorOnUI())
      SelectObjects();

   RenderBugs();
   RenderBlurs();
   RenderJoints();
   RenderEffects();
   ThePetProcess().RenderPets();
   RenderBoids();
   RenderObjects_AfterCharacter();
   CheckSprites();

   if(SelectedHero!=-1 && o->Live)
   {
      vec3_t vLight;
      
      Vector ( 1.0f, 1.0f, 1.f, vLight );
      float fLumi = sinf ( WorldTime*0.0015f )*0.3f+0.5f;
      Vector ( fLumi*vLight[0], fLumi*vLight[1], fLumi*vLight[2], vLight );

      float Rotation = (int)WorldTime%3600/(float)10.f;
      Vector ( 0.15f, 0.15f, 0.15f, o->Light );
      
      EnableAlphaBlend();
      Rotation = (int)WorldTime % 3600;
      RenderCircle(BITMAP_MAGIC + 2, o->Position, 50.0, 70.0, 200.0, Rotation, 0.0, 0.0);
      RenderCircle(BITMAP_MAGIC + 2, o->Position, 50.0, 70.0, 200.0, Rotation, 0.0, 0.0);
      
      g_csMapServer.SetHeroID ( (char *)CharactersClient[SelectedHero].ID );
   }

   BeginSprite();
   RenderSprites();
   RenderParticles();
   RenderPoints();
   EndSprite();
   BeginBitmap();
   RenderInfomation();

   if ((GetTickCount() - gTrayMode.LastPress) > 200) {
      if (GetKeyState(VK_F12) & 0x8000) {
         gTrayMode.SwitchState();
         gTrayMode.LastPress = GetTickCount();
      }
   }

#ifdef ENABLE_EDIT
   RenderDebugWindow();
#endif //ENABLE_EDIT

   EndBitmap();

   EndOpengl();

   return true;
}

void CreateLogInScene()
{
   EnableMainRender = true;
#ifdef PJH_NEW_SERVER_SELECT_MAP
   gMapManager.WorldActive = 94;
#else
   World = WD_77NEW_LOGIN_SCENE;
#endif //PJH_NEW_SERVER_SELECT_MAP
   gMapManager.LoadWorld(gMapManager.WorldActive);

   OpenLogoSceneData();

   CUIMng::Instance().CreateLoginScene();

   CurrentProtocolState = REQUEST_JOIN_SERVER;
    CreateSocket(szServerIpAddress,g_ServerPort);
    EnableSocket = true;

   GuildInputEnable = false;
   TabInputEnable   = false;
   GoldInputEnable  = false;
   InputEnable      = true;
   ClearInput();

   if (g_iChatInputType == 0)
   {
      strcpy(InputText[0],m_ID);
      InputLength[0] = strlen(InputText[0]);
      InputTextMax[0] = MAX_ID_SIZE;
      if(InputLength[0] == 0)   InputIndex = 0;
      else InputIndex = 1;
   }
   InputNumber = 2;
    InputTextHide[1] = 1;

   CCameraMove::GetInstancePtr()->PlayCameraWalk(Hero->Object.Position, 1000);
#ifdef PJH_NEW_SERVER_SELECT_MAP
   CCameraMove::GetInstancePtr()->SetTourMode(TRUE, FALSE, 1);
#else //PJH_NEW_SERVER_SELECT_MAP
   CCameraMove::GetInstancePtr()->SetTourMode(TRUE, TRUE);
#endif //PJH_NEW_SERVER_SELECT_MAP
   
   GWidescreen.SceneLogin();

   g_fMULogoAlpha = 0;
   
   ::PlayMp3(g_lpszMp3[MUSIC_LOGIN_THEME]);

   g_ErrorReport.Write( "> Login Scene init success.\r\n");
}

void NewMoveLogInScene()
{
   if(!InitLogIn)
   {
      InitLogIn = true;
      CreateLogInScene();
   }

#ifdef MOVIE_DIRECTSHOW
   if(CUIMng::Instance().IsMoving() == true)
   {
      return;
   }
#endif // MOVIE_DIRECTSHOW
   if (!CUIMng::Instance().m_CreditWin.IsShow())
   {
      InitTerrainLight();
      MoveObjects();
      MoveBugs();
      MoveLeaves();
      MoveCharactersClient();
      MoveEffects();
      MoveJoints();
      MoveParticles();
      MoveBoids();
      ThePetProcess().UpdatePets();
      MoveCamera();
   }

   if (CInput::Instance().IsKeyDown(VK_ESCAPE))
   {
      CUIMng& rUIMng = CUIMng::Instance();
      if (!(rUIMng.m_MsgWin.IsShow() || rUIMng.m_LoginWin.IsShow()
         || rUIMng.m_SysMenuWin.IsShow() || rUIMng.m_OptionWin.IsShow()
         || rUIMng.m_CreditWin.IsShow()
         )
         && rUIMng.m_LoginMainWin.IsShow() && rUIMng.m_ServerSelWin.IsShow()
         && rUIMng.IsSysMenuWinShow())
      {
         ::PlayBuffer(SOUND_CLICK01);
         rUIMng.ShowWin(&rUIMng.m_SysMenuWin);
      }
   }
   if (RECEIVE_LOG_IN_SUCCESS == CurrentProtocolState)
   {
      g_ErrorReport.Write( "> Request Character list\r\n");

      CCameraMove::GetInstancePtr()->SetTourMode(FALSE);

      SceneFlag = CHARACTER_SCENE;

      #ifdef NEW_PROTOCOL_SYSTEM
         gProtocolSend.SendRequestCharactersListNew();
      #else
         SendRequestCharactersList(g_pMultiLanguage->GetLanguage());
      #endif

        ReleaseLogoSceneData();

      ClearCharacters();
   }

   g_ConsoleDebug->UpdateMainScene();
}

bool NewRenderLogInScene(HDC hDC)
{
   if(!InitLogIn) return false;


   Console.Write(1, "CurrentProtocolState: %d / %d", CurrentProtocolState, InitLogIn);

   FogEnable = false;
//    extern GLfloat FogColor[4];
//    FogColor[0] = 178.f/256.f; FogColor[1] = 178.f/256.f; FogColor[2] = 178.f/256.f; FogColor[3] = 0.f;
//    glFogf(GL_FOG_START, 3700.0f);
//    glFogf(GL_FOG_END, 4000.0f);

#ifdef MOVIE_DIRECTSHOW
   if(CUIMng::Instance().IsMoving() == true)
   {
      g_pMovieScene->PlayMovie();

      if(g_pMovieScene->IsEndMovie())
      {
         g_pMovieScene->Destroy();
         SAFE_DELETE(g_pMovieScene);
         CUIMng::Instance().SetMoving(false);
         ::PlayMp3(g_lpszMp3[MUSIC_MAIN_THEME]);
      }
      else
      {
         if(HIBYTE(GetAsyncKeyState(VK_ESCAPE))==128 || HIBYTE(GetAsyncKeyState(VK_RETURN))==128)
         {
            g_pMovieScene->Destroy();
            SAFE_DELETE(g_pMovieScene);
            CUIMng::Instance().SetMoving(false);
            ::PlayMp3(g_lpszMp3[MUSIC_MAIN_THEME]);
         }
      }
      return true;
   }
#endif // MOVIE_DIRECTSHOW

   vec3_t pos;
   if(CCameraMove::GetInstancePtr()->IsCameraMove())
   {
      VectorCopy(CameraPosition, pos);
   }

   GWidescreen.SceneLogin();

   int Width,Height;

   glColor3f(1.f,1.f,1.f);
#ifndef PJH_NEW_SERVER_SELECT_MAP
   BeginBitmap();
   Width = 320;
   Height = 320;
   RenderBitmap(BITMAP_LOG_IN+9,  (float)0,(float)25,(float)Width,(float)Height,0.f,0.f);
   RenderBitmap(BITMAP_LOG_IN+10,(float)320,(float)25,(float)Width,(float)Height,0.f,0.f);
   EndBitmap();
#endif //PJH_NEW_SERVER_SELECT_MAP

   Height = 480;
    Width = FrameBeginOpengl();
   glClearColor(0.f,0.f,0.f,1.f);

   BeginOpengl(0, 0, GetWindowsX, GetWindowsY);
   CreateFrustrum((float)Width/(float)640, pos);

   if (!CUIMng::Instance().m_CreditWin.IsShow())
   {
      CameraViewFar = 330.f * CCameraMove::GetInstancePtr()->GetCurrentCameraDistanceLevel();
#ifndef PJH_NEW_SERVER_SELECT_MAP
      BeginOpengl();
#endif //PJH_NEW_SERVER_SELECT_MAP
      RenderTerrain(false);
      CameraViewFar = 7000.f;
      RenderCharactersClient();
      RenderBugs();
      RenderObjects();
      RenderJoints();
      RenderEffects();
      CheckSprites();
      RenderLeaves();
      RenderBoids();
      RenderObjects_AfterCharacter();
      ThePetProcess().RenderPets();
   }

   BeginSprite();
   RenderSprites();
   RenderParticles();
   EndSprite();
   BeginBitmap();

   if (CCameraMove::GetInstancePtr()->IsTourMode())
   {
#ifndef PJH_NEW_SERVER_SELECT_MAP
      // È­¸é È帮±â
      EnableAlphaBlend4();
      glColor4f(0.7f,0.7f,0.7f,1.0f);
      float fScale = (sinf(WorldTime*0.0005f) + 1.f) * 0.00011f;
      //RenderBitmap(BITMAP_CHROME+3, 0.0f,0.0f, 640.0f,480.0f, 800.f,600.f, (800.f)/1024.f,(600.f)/1024.f);
      RenderBitmap(BITMAP_CHROME+3, 0.0f,0.0f, 640.0f,480.0f, 800.f*fScale,600.f*fScale, (800.f)/1024.f-800.f*fScale*2,(600.f)/1024.f-600.f*fScale*2);
      float fAngle = WorldTime * 0.00018f;
      float fLumi = 1.0f - (sinf(WorldTime*0.0015f) + 1.f) * 0.25f;
      glColor4f(fLumi*0.3f,fLumi*0.3f,fLumi*0.7f,fLumi);
      fScale = (sinf(WorldTime*0.0015f) + 1.f) * 0.00021f;
      RenderBitmapLocalRotate(BITMAP_CHROME+4,320.0f,240.0f, 1150.0f, 1150.0f, fAngle, fScale*512.f,fScale*512.f, (512.f)/512.f-fScale*2*512.f,(512.f)/512.f-fScale*2*512.f);

      // À§¾Æ·¡ ÀÚ¸£±â
      EnableAlphaTest();
      glColor4f(0.0f,0.0f,0.0f,1.0f);
      RenderColor(0, 0, 640, 25);
      RenderColor(0, 480-25, 640, 25);

      // È­¸éÄ¥
      glColor4f(0.0f,0.0f,0.0f,0.2f);
      RenderColor(0, 25, 640, 430);
#endif //PJH_NEW_SERVER_SELECT_MAP
      // ¹Â·Î°í
      g_fMULogoAlpha += 0.02f;
      if (g_fMULogoAlpha > 10.0f) g_fMULogoAlpha = 10.0f;
      
      EnableAlphaBlend();
      glColor4f(g_fMULogoAlpha-0.3f,g_fMULogoAlpha-0.3f,g_fMULogoAlpha-0.3f,g_fMULogoAlpha-0.3f);
#ifdef PBG_ADD_MUBLUE_LOGO
      BITMAP_t *pImage =NULL;
      pImage = &Bitmaps[BITMAP_LOG_IN+17];
      RenderBitmap(BITMAP_LOG_IN+17, 320.0f-432*0.4f*0.5f,25.0f, 432*0.4f,384*0.4f,0,0,(432-0.5f)/pImage->Width,(384-0.5f)/pImage->Height);
#else //PBG_ADD_MUBLUE_LOGO
      RenderBitmap(BITMAP_LOG_IN+17, setPosMidRight(320.0f-128.0f*0.8f),25.0f, 256.0f*0.8f,128.0f*0.8f);
#endif //PBG_ADD_MUBLUE_LOGO
      EnableAlphaTest();
      glColor4f(g_fMULogoAlpha,g_fMULogoAlpha,g_fMULogoAlpha,g_fMULogoAlpha);
#ifdef PBG_ADD_MUBLUE_LOGO
      pImage = &Bitmaps[BITMAP_LOG_IN+16];
      RenderBitmap(BITMAP_LOG_IN+16, 320.0f-432*0.4f*0.5f,25.0f, 432*0.4f,384*0.4f,0,0,432/pImage->Width,384/pImage->Height);
#else //PBG_ADD_MUBLUE_LOGO
      RenderBitmap(BITMAP_LOG_IN+16, setPosMidRight(320.0f-128.0f*0.8f),25.0f, 256.0f*0.8f,128.0f*0.8f);
#endif //PBG_ADD_MUBLUE_LOGO
   }

   SIZE Size;
   char Text[100];

   int Y = 0;
   
   //   - Caixa de criação de conta (dev)

   g_pRenderText->SetFont(g_hFont);

   InputTextWidth = 256;
   glColor3f(0.8f,0.7f,0.6f);
   g_pRenderText->SetTextColor(255, 255, 255, 255);
   g_pRenderText->SetBgColor(0, 0, 0, 128);
   
   if (m_Resolution > 1)
   {
      sprintf(Text, "%s%s", GlobalText[454], GlobalText[455]);
   }
   else
   {
      sprintf(Text, "%s", GlobalText[454]);
   }
   g_pMultiLanguage->_GetTextExtentPoint32(g_pRenderText->GetFontDC(), Text, lstrlen(Text), &Size);
   g_pRenderText->RenderText(setPosMidRight(335) - Size.cx * 640 / WindowWidth, GetWindowsY - Size.cy * 640 / WindowWidth - 1, Text);

   if (m_Resolution < 2)
   {
      strcpy(Text, GlobalText[455]);

      g_pMultiLanguage->_GetTextExtentPoint32(g_pRenderText->GetFontDC(), Text, lstrlen(Text), &Size);
      g_pRenderText->RenderText(setPosMidRight(335), GetWindowsY - Size.cy * 640 / WindowWidth - 1, Text);
   }

   sprintf(Text,GlobalText[456],m_ExeVersion);
   
   g_pMultiLanguage->_GetTextExtentPoint32(g_pRenderText->GetFontDC(), Text, lstrlen(Text), &Size);
   g_pRenderText->RenderText(0, GetWindowsY - Size.cy * 640 / WindowWidth - 1, Text);

    RenderInfomation();
   
#ifdef ENABLE_EDIT
   RenderDebugWindow();
#endif //ENABLE_EDIT

   EndBitmap();

   EndOpengl();

   return true;
}

void RenderInterfaceEdge()
{
   int Width,Height;
   int WindowX,WindowY;
      EnableAlphaTest();
   glColor3f(1.f,1.f,1.f);
   //interface edge
   Width = 192;Height = 37;WindowX = 448;WindowY = 0;
   RenderBitmap(BITMAP_LOG_IN,(float)WindowX,(float)WindowY,(float)Width,(float)Height,0.f,0.f,Width/256.f,Height/64.f);
   Width = 192;Height = 37;WindowX = 0;WindowY = 0;
   RenderBitmap(BITMAP_LOG_IN,(float)WindowX,(float)WindowY,(float)Width,(float)Height,Width/256.f,0.f,-Width/256.f,Height/64.f);
   Width = 106;Height = 256;WindowX = 534;WindowY = 3;
   RenderBitmap(BITMAP_LOG_IN+1,(float)WindowX,(float)WindowY,(float)Width,(float)Height,0.f,0.f,Width/128.f,Height/256.f);
   Width = 106;Height = 256;WindowX = 0;WindowY = 3;
   RenderBitmap(BITMAP_LOG_IN+1,(float)WindowX,(float)WindowY,(float)Width,(float)Height,Width/128.f,0.f,-Width/128.f,Height/256.f);
   Width = 106;Height = 222;WindowX = 534;WindowY = 259;
   RenderBitmap(BITMAP_LOG_IN+2,(float)WindowX,(float)WindowY,(float)Width,(float)Height,0.f,0.f,Width/128.f,Height/256.f);
   Width = 106;Height = 222;WindowX = 0;WindowY = 259;
   RenderBitmap(BITMAP_LOG_IN+2,(float)WindowX,(float)WindowY,(float)Width,(float)Height,Width/128.f,0.f,-Width/128.f,Height/256.f);
   Width = 256;Height = 70;WindowX = 192;WindowY = 0;
   RenderBitmap(BITMAP_LOG_IN+3,(float)WindowX,(float)WindowY,(float)Width,(float)Height,0.f,0.f,Width/256.f,Height/128.f);
}

void LoadingScene(HDC hDC)
{
   g_ConsoleDebug->Write(MCD_NORMAL, "LoadingScene_Start");

   CUIMng& rUIMng = CUIMng::Instance();
   if (!InitLoading)
   {
      LoadingWorld = 9999999;

      InitLoading = true;
      
      LoadBitmap("Interface\\LSBg01.JPG", BITMAP_TITLE, GL_LINEAR);
      LoadBitmap("Interface\\LSBg02.JPG", BITMAP_TITLE+1, GL_LINEAR);
      LoadBitmap("Interface\\LSBg03.JPG", BITMAP_TITLE+2, GL_LINEAR);
      LoadBitmap("Interface\\LSBg04.JPG", BITMAP_TITLE+3, GL_LINEAR);

      ::StopMp3(g_lpszMp3[MUSIC_LOGIN_THEME]);

      rUIMng.m_pLoadingScene = new CLoadingScene;
      rUIMng.m_pLoadingScene->Create();
   }

    FogEnable = false;
   ::BeginOpengl();
   ::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
   ::BeginBitmap();

   rUIMng.m_pLoadingScene->Render();

   ::EndBitmap();
   ::EndOpengl();
   ::glFlush();
   ::SwapBuffers(hDC);

   SAFE_DELETE(rUIMng.m_pLoadingScene);

   SceneFlag = MAIN_SCENE;
   for (int i = 0; i < 4; ++i)
      ::DeleteBitmap(BITMAP_TITLE+i);

   ::ClearInput();

   g_ConsoleDebug->Write(MCD_NORMAL, "LoadingScene_End");
}

float CameraDistanceTarget = 1000.f;
float CameraDistance = CameraDistanceTarget;

bool MoveMainCamera()
{
    bool bLockCamera = false;

   if (
#ifdef PJH_NEW_SERVER_SELECT_MAP
      gMapManager.WorldActive == 94
#else
      gMapManager.WorldActive == WD_77NEW_LOGIN_SCENE
#endif //PJH_NEW_SERVER_SELECT_MAP
      && CCameraMove::GetInstancePtr()->IsTourMode())
   {
#ifdef PJH_NEW_SERVER_SELECT_MAP
      CameraFOV = 65.0f;
#else //PJH_NEW_SERVER_SELECT_MAP
      CameraFOV = 61.0f;
#endif //PJH_NEW_SERVER_SELECT_MAP
   }
   else
   {
      if (gMapManager.WorldActive == WD_74NEW_CHARACTER_SCENE || gMapManager.WorldActive == WD_73NEW_LOGIN_SCENE) // Fix for opening scene and character selection
      {
         CameraZoom = 0;
         AngleY3D = 0;
      }
      CameraFOV = 37.f + CameraZoom; //3D CAMERA

      if (!g_pUIManager->IsInputEnable())
      {
         gCamera.Update();
      }
   }

#ifdef ENABLE_EDIT2
   {
      bool EditMove = false;
      if( !g_pUIManager->IsInputEnable() )
      {
         if(HIBYTE(GetAsyncKeyState(VK_INSERT))==128)
            CameraAngle[2] += 15;
         if(HIBYTE(GetAsyncKeyState(VK_DELETE))==128)
            CameraAngle[2] -= 15;

         vec3_t p1,p2;
         Vector(0.f,0.f,0.f,p1);
         FLOAT Velocity = sqrtf(TERRAIN_SCALE*TERRAIN_SCALE)*1.25f;

         if(HIBYTE(GetAsyncKeyState(VK_LEFT ))==128)// || (MouseX<=0 && MouseY>=100))
         {
            Vector(-Velocity, -Velocity, 0.f, p1);
            EditMove = true;
         }
         if(HIBYTE(GetAsyncKeyState(VK_RIGHT))==128)// || (MouseX>=639 && MouseY>=100))
         {
            Vector(Velocity, Velocity, 0.f, p1);
            EditMove = true;
         }
         if(HIBYTE(GetAsyncKeyState(VK_UP   ))==128)// || (MouseY<=0 && MouseX>=100 && MouseX<540))
         {
            Vector(-Velocity, Velocity, 0.f, p1);
            EditMove = true;
         }
         if(HIBYTE(GetAsyncKeyState(VK_DOWN ))==128)// || (MouseY>=479))
         {
            Vector(Velocity, -Velocity, 0.f, p1);
            EditMove = true;
         }

         glPushMatrix();
         glLoadIdentity();
         glRotatef(-CameraAngle[2],0.f,0.f,1.f);
         float Matrix[3][4];
         GetOpenGLMatrix(Matrix);
         glPopMatrix();
         VectorRotate(p1,Matrix,p2);
         VectorAdd(Hero->Object.Position, p2, Hero->Object.Position);
      }

        if ( gMapManager.InChaosCastle()==false || !Hero->Object.m_bActionStart   )
        {
         if(gMapManager.WorldActive == WD_39KANTURU_3RD && Hero->Object.m_bActionStart)
         {}
         else
            if ( gMapManager.WorldActive==-1 || Hero->Helper.Type != MODEL_HELPER+3 || Hero->SafeZone )
            {
            Hero->Object.Position[2] = RequestTerrainHeight(Hero->Object.Position[0],Hero->Object.Position[1]);
            }
            else
            {
                if ( gMapManager.WorldActive==WD_8TARKAN || gMapManager.WorldActive==WD_10HEAVEN )
                    Hero->Object.Position[2] = RequestTerrainHeight(Hero->Object.Position[0],Hero->Object.Position[1])+90.f;
                else
                    Hero->Object.Position[2] = RequestTerrainHeight(Hero->Object.Position[0],Hero->Object.Position[1])+30.f;
            }
        }

      if(EditMove)
      {
         BYTE PathX[1];
         BYTE PathY[1];
         PathX[0] = (BYTE)(Hero->Object.Position[0]/TERRAIN_SCALE);
         PathY[0] = (BYTE)(Hero->Object.Position[1]/TERRAIN_SCALE);

         #ifdef NEW_PROTOCOL_SYSTEM
            gProtocolSend.SendCharacterMoveNew(Hero->Key,Hero->Object.Angle[2],1,PathX,PathY,PathX[0],PathY[0]);
         #else
            SendCharacterMove(Hero->Key,Hero->Object.Angle[2],1,PathX,PathY,PathX[0],PathY[0]);
         #endif

            Hero->Path.PathNum = 0;
      }
   }
#endif //ENABLE_EDIT2

   CameraAngle[0] = 0.f;
   CameraAngle[1] = 0.f;

   if(CameraTopViewEnable)
   {
      CameraViewFar = 3200.f;
      //CameraViewFar = 60000.f;
      CameraPosition[0] = Hero->Object.Position[0];
      CameraPosition[1] = Hero->Object.Position[1];
      CameraPosition[2] = CameraViewFar;
   }
   else
   {
      int iIndex = TERRAIN_INDEX((Hero->PositionX),(Hero->PositionY));
      vec3_t Position,TransformPosition;
      float Matrix[3][4];

        if ( battleCastle::InBattleCastle2( Hero->Object.Position ) )
        {
            CameraViewFar = 3000.f;
        }
        else if ( gMapManager.InBattleCastle() && SceneFlag == MAIN_SCENE)
        {
            CameraViewFar = 2500.f;
        }
      else if (gMapManager.WorldActive == WD_51HOME_6TH_CHAR)
      {
         CameraViewFar = 2800.f * 1.15f;
      }
       else if(gMapManager.IsPKField()   || IsDoppelGanger2())
      {
         CameraViewFar = 3700.0f;
       }
        else
        {
            switch ( g_shCameraLevel )
            {
            case 0:
            if(SceneFlag == LOG_IN_SCENE)
            {
            }
            else if(SceneFlag == CHARACTER_SCENE)
            {
#ifdef PJH_NEW_SERVER_SELECT_MAP
               CameraViewFar = 3500.f;
#else //PJH_NEW_SERVER_SELECT_MAP
               CameraViewFar = 10000.f;
#endif //PJH_NEW_SERVER_SELECT_MAP
            }
            else if (g_Direction.m_CKanturu.IsMayaScene())
            {
               CameraViewFar = 2000.f * 10.0f * 0.115f;
            }
            else
            {
               CameraViewFar = 2000.f;
            }
            break;
            case 1: CameraViewFar = 2500.f; break;
            case 2: CameraViewFar = 2600.f; break;
            case 3: CameraViewFar = 2950.f; break;
         case 5:
            case 4: CameraViewFar = 3200.f; break;
            }
        }

      Vector(0.f,-CameraDistance,0.f,Position);//-750
      AngleMatrix(CameraAngle,Matrix);
      VectorIRotate(Position,Matrix,TransformPosition);

      if(SceneFlag == MAIN_SCENE)
      {
         g_pCatapultWindow->GetCameraPos(Position);
      }
      else if (CCameraMove::GetInstancePtr()->IsTourMode())
      {
         CCameraMove::GetInstancePtr()->UpdateTourWayPoint();
         CCameraMove::GetInstancePtr()->GetCurrentCameraPos(Position);
         CameraViewFar = 390.f * CCameraMove::GetInstancePtr()->GetCurrentCameraDistanceLevel();
      }

      if(g_Direction.IsDirection() && !g_Direction.m_bDownHero)
      {
         Hero->Object.Position[2] = 300.0f;
         g_shCameraLevel = g_Direction.GetCameraPosition(Position);
      }
       else if(gMapManager.IsPKField()   || IsDoppelGanger2())
      {
          g_shCameraLevel =5;
       }
      else if (IsDoppelGanger1())
      {
          g_shCameraLevel =5;
      }
      else g_shCameraLevel =0;

#ifdef PJH_NEW_SERVER_SELECT_MAP
      if(CCameraMove::GetInstancePtr()->IsTourMode())
      {
         vec3_t temp = {0.0f,0.0f,-100.0f};
         VectorAdd(TransformPosition, temp, TransformPosition);
      }
#endif //PJH_NEW_SERVER_SELECT_MAP

      VectorAdd ( Position,TransformPosition,CameraPosition);

        if ( gMapManager.InBattleCastle()==true )
        {
            CameraPosition[2] = 255.f;//700
        }
      else if (CCameraMove::GetInstancePtr()->IsTourMode());
        else
        {
            CameraPosition[2] = Hero->Object.Position[2];//700
        }
      
      if ( (TerrainWall[iIndex]&TW_HEIGHT)==TW_HEIGHT )
      {
         CameraPosition[2] = g_fSpecialHeight = 1200.f+1;
      }           
      CameraPosition[2] += CameraDistance-150.f;//700

      if (CCameraMove::GetInstancePtr()->IsTourMode())
      {
#ifdef PJH_NEW_SERVER_SELECT_MAP
         CCameraMove::GetInstancePtr()->SetAngleFrustum(-112.5f);
         CameraAngle[0] = CCameraMove::GetInstancePtr()->GetAngleFrustum();
#else   // PJH_NEW_SERVER_SELECT_MAP
         CameraAngle[0] = -78.5f;
#endif   // PJH_NEW_SERVER_SELECT_MAP
         CameraAngle[1] = 0.0f;
         CameraAngle[2] = CCameraMove::GetInstancePtr()->GetCameraAngle();
      }
      else if(SceneFlag == CHARACTER_SCENE)
      {
#ifdef PJH_NEW_SERVER_SELECT_MAP
         CameraAngle[0] = -84.5f;
         CameraAngle[1] = 0.0f;
         CameraAngle[2] = -75.0f;
          CameraPosition[0] = 9758.93f;
          CameraPosition[1] = 18913.11f;
          CameraPosition[2] = 675.5f;
#else //PJH_NEW_SERVER_SELECT_MAP
         CameraAngle[0] = -84.5f;
         CameraAngle[1] = 0.0f;
         CameraAngle[2] = -30.0f;
         CameraPosition[0] = 23566.75f;
         CameraPosition[1] = 14085.51f;
         CameraPosition[2] = 395.0f;
#endif //PJH_NEW_SERVER_SELECT_MAP
      }
      else
      {
         CameraAngle[0] = -48.5f;
         CameraAngle[0] += AngleY3D;
         CameraPosition[2] += AngleZ3D;
      }

      CameraAngle[0] += EarthQuake;

        if ( ( TerrainWall[iIndex]&TW_CAMERA_UP )==TW_CAMERA_UP )
        {
            if ( g_fCameraCustomDistance<=CUSTOM_CAMERA_DISTANCE1 )
            {
                g_fCameraCustomDistance+=10;
            }
        }
        else
        {
            if ( g_fCameraCustomDistance>0 )
            {
                g_fCameraCustomDistance-=10;
            }
        }

        if ( g_fCameraCustomDistance>0 )
        {
            vec3_t angle = { 0.f, 0.f, -45.f };
          Vector ( 0.f, g_fCameraCustomDistance, 0.f, Position );
          AngleMatrix ( angle, Matrix );
          VectorIRotate ( Position, Matrix, TransformPosition );
          VectorAdd ( CameraPosition, TransformPosition, CameraPosition );
        }
        else if ( g_fCameraCustomDistance<0 )
        {
            vec3_t angle = { 0.f, 0.f, -45.f };
          Vector ( 0.f, g_fCameraCustomDistance, 0.f, Position );
          AngleMatrix ( angle, Matrix );
          VectorIRotate ( Position, Matrix, TransformPosition );
          VectorAdd ( CameraPosition, TransformPosition, CameraPosition );
        }
   }
   if(gMapManager.WorldActive==5)
   {
      CameraAngle[0] += sinf(WorldTime*0.0005f)*2.f;
      CameraAngle[1] += sinf(WorldTime*0.0008f)*2.5f;
   }
    else if (CCameraMove::GetInstancePtr()->IsTourMode())
   {
      CameraDistanceTarget = 1100.f * CCameraMove::GetInstancePtr()->GetCurrentCameraDistanceLevel() * 0.1f;
      CameraDistance = CameraDistanceTarget;
   }
   else
    {
        if ( gMapManager.InBattleCastle() )
        {
            CameraDistanceTarget = 1100.f;
            CameraDistance = CameraDistanceTarget;
        }
        else
        {
            switch ( g_shCameraLevel )
            {
            case 0: CameraDistanceTarget = 1000.f; CameraDistance += (CameraDistanceTarget-CameraDistance)/3; break;
            case 1: CameraDistanceTarget = 1100.f; CameraDistance += (CameraDistanceTarget-CameraDistance)/3; break;
            case 2: CameraDistanceTarget = 1200.f; CameraDistance += (CameraDistanceTarget-CameraDistance)/3; break;
            case 3: CameraDistanceTarget = 1300.f; CameraDistance += (CameraDistanceTarget-CameraDistance)/3; break;
            case 4: CameraDistanceTarget = 1400.f; CameraDistance += (CameraDistanceTarget-CameraDistance)/3; break;
         case 5: CameraDistanceTarget = g_Direction.m_fCameraViewFar; CameraDistance += (CameraDistanceTarget-CameraDistance)/3; break;
            }
        }
    }
   // 3d camera
   // Field of vision

   if (CameraZoom > 0)
      CameraViewFar += 458.33f + (458.33f * CameraZoom);
   else
      CameraViewFar += 1458.33f;

    return bLockCamera;
}

void MoveMainScene()
{
   if(!InitMainScene)
   {
      g_pMainFrame->ResetSkillHotKey();
      
      g_ConsoleDebug->Write( MCD_NORMAL, "Join the game with the following character: %s", CharactersClient[SelectedHero].ID);

      g_ErrorReport.Write( "> Character selected <%d> \"%s\"\r\n", SelectedHero+1, CharactersClient[SelectedHero].ID);

        InitMainScene = true;
      
      g_ConsoleDebug->Write( MCD_SEND, "SendRequestJoinMapServer");

       SendRequestJoinMapServer(CharactersClient[SelectedHero].ID);

      CUIMng::Instance().CreateMainScene();

      CameraAngle[2] = -45.f;

      ClearInput();
      InputEnable     = false;
      TabInputEnable  = false;
      InputTextWidth  = 256;
      InputTextMax[0] = 42;
      InputTextMax[1] = 10;
      InputNumber     = 2;
      for(int i=0;i<MAX_WHISPER;i++)
      {
         g_pChatListBox->AddText("", "", SEASON3B::TYPE_WHISPER_MESSAGE);
      }

      g_GuildNotice[0][0] = '\0';
      g_GuildNotice[1][0] = '\0';
   
      g_pPartyManager->Create();

      g_pChatListBox->ClearAll();

      g_pSlideHelpMgr->Init();      
      g_pUIMapName->Init();

      g_GuildCache.Reset();

      g_PortalMgr.Reset();

      ClearAllObjectBlurs();
      
      SetFocus(g_hWnd);

      g_ErrorReport.Write( "> Main Scene init success. ");
      g_ErrorReport.WriteCurrentTime();

      g_ConsoleDebug->Write(MCD_NORMAL, "MainScene Init Success");
   }
   
   if(CurrentProtocolState == RECEIVE_JOIN_MAP_SERVER)
   {
      EnableMainRender = true;
   }
   if(EnableMainRender == false)
   {
      return;
   }
   //init
   EarthQuake *= 0.2f;

   InitTerrainLight();

#ifdef NEW_MUHELPER_ON
   if (pAIController->IsRunning())
   {
      pAIController->WhatToDoNext();
   }
#endif

   CheckInventory = NULL;
   CheckSkill = -1;
   MouseOnWindow = false;


   if(!CameraTopViewEnable   && LoadingWorld < 30 )
   {
      if(MouseY>=(int)(GetWindowsY - 51))
         MouseOnWindow = true;

      g_pPartyManager->Update();
      g_pNewUISystem->Update();
      
      if (MouseLButton == true && false == g_pNewUISystem->CheckMouseUse() && g_dwMouseUseUIID == 0 && g_pNewUISystem->IsVisible(SEASON3B::INTERFACE_CHATINPUTBOX) == false )
      {
         g_pWindowMgr->SetWindowsEnable(FALSE);
         g_pFriendMenu->HideMenu();
         g_dwKeyFocusUIID = 0;
         if(GetFocus() != g_hWnd)
         {
            SaveIMEStatus();
            SetFocus(g_hWnd);
         }
      }
      MoveInterface();
      MoveTournamentInterface();
      if( ErrorMessage != MESSAGE_LOG_OUT )
         g_pUIManager->UpdateInput();
   }

   if(ErrorMessage != NULL)
      MouseOnWindow = true;

    MoveObjects();
    if(!CameraTopViewEnable)
       MoveItems();
   if ( ( gMapManager.WorldActive==WD_0LORENCIA && HeroTile!=4 ) ||
         ( gMapManager.WorldActive==WD_2DEVIAS && HeroTile!=3 && HeroTile<10 )
       || gMapManager.WorldActive==WD_3NORIA
       || gMapManager.WorldActive==WD_7ATLANSE
       || gMapManager.InDevilSquare() == true
       || gMapManager.WorldActive==WD_10HEAVEN
         || gMapManager.InChaosCastle()==true
         || gMapManager.InBattleCastle()==true
       || M31HuntingGround::IsInHuntingGround()==true
       || M33Aida::IsInAida()==true
       || M34CryWolf1st::IsCyrWolf1st()==true
      || gMapManager.WorldActive == WD_42CHANGEUP3RD_2ND
      || IsIceCity()
      || IsSantaTown()
      || gMapManager.IsPKField()
      || IsDoppelGanger2()
      || gMapManager.IsEmpireGuardian1()
      || gMapManager.IsEmpireGuardian2()
      || gMapManager.IsEmpireGuardian3()
      || gMapManager.IsEmpireGuardian4()
      || IsUnitedMarketPlace()
    )
   {
        MoveLeaves();
   }
   
   MoveBoids();
      MoveFishs();
   MoveBugs();
   MoveChat();
   UpdatePersonalShopTitleImp();
   MoveHero();
    MoveCharactersClient();
   ThePetProcess().UpdatePets();
    MovePoints();
   MovePlanes();
   MoveEffects();
    MoveJoints();
    MoveParticles();
    MovePointers();

   g_Direction.CheckDirection();
   
#ifdef ENABLE_EDIT
    EditObjects();
#endif //ENABLE_EDIT

   g_GameCensorship->Update();

   g_ConsoleDebug->UpdateMainScene();
}

bool RenderMainScene()
{
   if(EnableMainRender == false) 
   {
      return false;
   }

    if(( LoadingWorld) > 30)
   {
      return false;
   }

    FogEnable = false;

    vec3_t pos;

    if(MoveMainCamera() == true)
    {
        VectorCopy ( Hero->Object.StartPosition, pos );
    }
    else
    {
      g_pCatapultWindow->GetCameraPos(pos);
      
      if(g_Direction.IsDirection() && g_Direction.m_bDownHero == false)
      {
         g_Direction.GetCameraPosition(pos);
      }
    }

   int Width,Height;

    BYTE byWaterMap = 0;

   if(CameraTopViewEnable == false)
   {
      Height = 480;   //480-48;
   }
   else
   {
      Height = 480;
   }

    Width = FrameBeginOpengl();
    if(gMapManager.WorldActive == WD_0LORENCIA)     
   {
      glClearColor(10/256.f,20/256.f,14/256.f,1.f);
   }
    else if(gMapManager.WorldActive == WD_2DEVIAS)
   {
      glClearColor(0.f/256.f,0.f/256.f,10.f/256.f,1.f);
   }
    else if(gMapManager.WorldActive == WD_10HEAVEN)
   {
      glClearColor(3.f/256.f,25.f/256.f,44.f/256.f,1.f);
   }
    else if(gMapManager.InChaosCastle() == true)
   {
      glClearColor(0/256.f,0/256.f,0/256.f,1.f);
   }
   else if(gMapManager.WorldActive >= WD_45CURSEDTEMPLE_LV1 && gMapManager.WorldActive <= WD_45CURSEDTEMPLE_LV6)
   {
      glClearColor(9.f/256.f,8.f/256.f,33.f/256.f,1.f);
   }
    else if(gMapManager.InHellas() == true)
    {
        byWaterMap = 1;
        glClearColor(0.f/256.f,0.f/256.f,0.f/256.f,1.f);
    }
    else   
   {
      glClearColor(0/256.f,0/256.f,0/256.f,1.f);
   }

   BeginOpengl(0, 0, (m_Resolution > 2 ? GetWindowsX : Width), GetWindowsY);

   CreateFrustrum((float)Width/(float)640, pos);

    if ( gMapManager.InBattleCastle() )
    {
        if ( battleCastle::InBattleCastle2( Hero->Object.Position ) )
        {
            vec3_t Color = { 0.f, 0.f, 0.f };
            battleCastle::StartFog ( Color );
        }
        else
        {
            glDisable ( GL_FOG );
        }
    }

   CreateScreenVector(MouseX,MouseY,MouseTarget);

    if ( IsWaterTerrain()==false )
    {
      if(gMapManager.WorldActive==WD_39KANTURU_3RD)
      {
         if(!g_Direction.m_CKanturu.IsMayaScene())
            RenderTerrain(false);
      }
      else
        if(gMapManager.WorldActive!=WD_10HEAVEN && gMapManager.WorldActive != -1)
        {
         if(gMapManager.IsPKField() || IsDoppelGanger2())
         {
            RenderObjects();
         }
            RenderTerrain(false);
        }
    }

   if(!gMapManager.IsPKField()   && !IsDoppelGanger2())
      RenderObjects();

   RenderEffectShadows();
      RenderBoids();

   RenderCharactersClient();

   if(EditFlag!=EDIT_NONE)
   {
      RenderTerrain(true);
    }
    if(!CameraTopViewEnable)
        RenderItems();

      RenderFishs();
      RenderBugs();
    RenderLeaves();

   if (!gMapManager.InChaosCastle())
      ThePetProcess().RenderPets();

   RenderBoids(true);
   RenderObjects_AfterCharacter();

    RenderJoints(byWaterMap);
   RenderEffects();
    RenderBlurs();
    CheckSprites();
    BeginSprite();

   if ((gMapManager.WorldActive == WD_2DEVIAS && HeroTile != 3 && HeroTile < 10)
      || IsIceCity()
      || IsSantaTown()
      || gMapManager.IsPKField()
      || IsDoppelGanger2()
      || gMapManager.IsEmpireGuardian1()
      || gMapManager.IsEmpireGuardian2()
      || gMapManager.IsEmpireGuardian3()
      || gMapManager.IsEmpireGuardian4()
      || IsUnitedMarketPlace()
      )
   {
      RenderLeaves();
   }

   RenderSprites();
   RenderParticles();

    if ( IsWaterTerrain()==false )
    {
        RenderPoints ( byWaterMap );
    }

    EndSprite();

   RenderAfterEffects();

    if(IsWaterTerrain() == true)
    {
        byWaterMap = 2;

      EndOpengl();
      if (gMapManager.InHellas(gMapManager.WorldActive))
      {
         BeginOpengl(0, 0, GetWindowsX, GetWindowsY);
      }
      else
      {
         BeginOpengl(0, 0, Width, Height);
      }
        RenderWaterTerrain();
        RenderJoints(byWaterMap );
        RenderEffects( true );
        RenderBlurs();
        CheckSprites();
        BeginSprite();

        if(gMapManager.WorldActive==WD_2DEVIAS && HeroTile!=3 && HeroTile<10)
            RenderLeaves();

      RenderSprites(byWaterMap);
      RenderParticles(byWaterMap);
        RenderPoints ( byWaterMap );

        EndSprite();
      EndOpengl();

      BeginOpengl( 0, 0, Width, Height );
    }

    if(gMapManager.InBattleCastle())
    {
        if(battleCastle::InBattleCastle2(Hero->Object.Position))
        {
            battleCastle::EndFog();
        }
    }

    SelectObjects();
   BeginBitmap();   
    RenderObjectDescription();
   
   if(CameraTopViewEnable == false)
   {
        RenderInterface(true);
   }
   RenderTournamentInterface();
   EndBitmap();                  
   
   g_pPartyManager->Render();
   g_pNewUISystem->Render();
   
   BeginBitmap();

   RenderInfomation();

#ifdef ENABLE_EDIT
   RenderDebugWindow();
#endif //ENABLE_EDIT

   EndBitmap();
   BeginBitmap();

    RenderCursor();

   EndBitmap();
    EndOpengl();
   
   return true;
}

int TimeRemain = 40;
extern int ChatTime;
extern int WaterTextureNumber;

int TestTime = 0;
extern int  GrabScreen;

void MoveCharacter(CHARACTER *c,OBJECT *o);

int TimePrior = GetTickCount();

double target_fps = 60;
double ms_per_frame = 1000.0 / target_fps;

void SetTargetFps(double targetFps)
{
   targetFps = -1;

   target_fps = targetFps;
   ms_per_frame = 1000.0 / target_fps;
}

double last_render_tick_count = 0;
double current_tick_count = 0;
double last_water_change = 0;

void UpdateSceneState()
{
   g_pNewKeyInput->ScanAsyncKeyState();

   g_dwMouseUseUIID = 0;

   switch (SceneFlag)
   {
   case LOG_IN_SCENE:
      NewMoveLogInScene();
      break;

   case CHARACTER_SCENE:
      NewMoveCharacterScene();
      break;

   case MAIN_SCENE:
      MoveMainScene();
      break;
   }

   MoveNotices();

   if (PressKey(VK_SNAPSHOT))
   {
      if (GrabEnable)
         GrabEnable = false;
      else
         GrabEnable = true;
   }
   if (ChatTime > 0) ChatTime--;
   if (MacroTime > 0) MacroTime--;

   
   SYSTEMTIME st;
   GetLocalTime(&st);
   sprintf(GrabFileName, gProtect->m_MainInfo.ScreenShotPath, st.wMonth, st.wDay, st.wHour, st.wMinute, GrabScreen);
   char Text[256];
   sprintf(Text, GlobalText[459], GrabFileName);
   char lpszTemp[64];
   wsprintf(lpszTemp, " [%s / %s]", g_ServerListManager->GetSelectServerName(), Hero->ID);
   strcat(Text, lpszTemp);
   int iCaptureMode = 1;
   
   if (GrabEnable)
   {
      SaveScreen();
   }

   if (GrabEnable && iCaptureMode == 1)
   {
      g_pChatListBox->AddText("", Text, SEASON3B::TYPE_SYSTEM_MESSAGE);
   }

   GrabEnable = false;
}

void MainScene(HDC hDC)
{
   if (LOG_IN_SCENE == SceneFlag || CHARACTER_SCENE == SceneFlag)
   {
      double dDeltaTick = g_pTimer->GetTimeElapsed();
      dDeltaTick = MIN(dDeltaTick, 200.0 * FPS_ANIMATION_FACTOR);
      //g_pTimer->ResetTimer();

      CInput::Instance().Update();
      CUIMng::Instance().Update(dDeltaTick);
   }

   constexpr int NumberOfWaterTextures = 32;
   constexpr double timePerFrame = 1000 / REFERENCE_FPS;
   auto time_since_last_render = current_tick_count - last_water_change;
   while (time_since_last_render > timePerFrame)
   {
      WaterTextureNumber++;
      WaterTextureNumber %= NumberOfWaterTextures;
      time_since_last_render -= timePerFrame;
      last_water_change = current_tick_count;
   }

   if (Destroy)
{
      return;
   }
      
   g_PhysicsManager.Move(0.025f * FPS_ANIMATION_FACTOR);

   Bitmaps.Manage();

   Set3DSoundPosition();

    if( gMapManager.WorldActive==WD_10HEAVEN )
    {
        glClearColor(3.f/256.f,25.f/256.f,44.f/256.f,1.f);
    }
#ifdef PJH_NEW_SERVER_SELECT_MAP
   else if (gMapManager.WorldActive == WD_73NEW_LOGIN_SCENE|| gMapManager.WorldActive == WD_74NEW_CHARACTER_SCENE)
    {
        glClearColor(0.0f, 0.0f, 0.0f, 1.0f );
    }
#endif //PJH_NEW_SERVER_SELECT_MAP
    else if (gMapManager.InHellas(gMapManager.WorldActive))
    {
        glClearColor(30.f/256.f,40.f/256.f,40.f/256.f,1.f);
    }
    else if ( gMapManager.InChaosCastle()==true )
    {
        glClearColor ( 0.f, 0.f, 0.f, 1.f );
    }
    else if ( gMapManager.InBattleCastle() && battleCastle::InBattleCastle2( Hero->Object.Position ) )
    {
        glClearColor ( 0.f, 0.f, 0.f, 1.f );
    }
   else if ( gMapManager.WorldActive >= WD_45CURSEDTEMPLE_LV1 && gMapManager.WorldActive <= WD_45CURSEDTEMPLE_LV6)
   {
      glClearColor(9.f/256.f,8.f/256.f,33.f/256.f,1.f);
   }
   else if ( gMapManager.WorldActive == WD_51HOME_6TH_CHAR
#ifndef PJH_NEW_SERVER_SELECT_MAP
      || World == WD_77NEW_LOGIN_SCENE
#endif //PJH_NEW_SERVER_SELECT_MAP
      )
   {
      glClearColor(178.f/256.f,178.f/256.f,178.f/256.f,1.f);
   }
#ifndef PJH_NEW_SERVER_SELECT_MAP
   else if(World == WD_78NEW_CHARACTER_SCENE)
   {
      glClearColor(0.f,0.f,0.f,1.f);
   }
#endif //PJH_NEW_SERVER_SELECT_MAP
   else if(gMapManager.WorldActive == WD_65DOPPLEGANGER1)
   {
      glClearColor(148.f/256.f,179.f/256.f,223.f/256.f,1.f);
   }
    else
    {
        glClearColor(0/256.f,0/256.f,0/256.f,1.f);
    }
      
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

   int32_t DifTimer = 0;
   uint32_t LastTimeCurrent = TimePrior;
   TimePrior = GetTickCount();

   bool Success = false;

   try
   {
      if (SceneFlag == LOG_IN_SCENE)
      {
         Success = NewRenderLogInScene(hDC);
      }
      else if (SceneFlag == CHARACTER_SCENE)
      {
         Success = NewRenderCharacterScene(hDC);
      }
      else if (SceneFlag == MAIN_SCENE)
      {
         Success = RenderMainScene();
      }

      g_PhysicsManager.Render();

      //#if defined(_DEBUG) || defined(LDS_FOR_DEVELOPMENT_TESTMODE) || defined(LDS_UNFIXED_FIXEDFRAME_FORDEBUG)
      BeginBitmap();
      unicode::t_char szDebugText[128];
      unicode::_sprintf(szDebugText, "FPS : %.1f Connected: %d", FPS, g_bGameServerConnected);
      unicode::t_char szMousePos[128];
      unicode::_sprintf(szMousePos, "MousePos : %d %d %d", MouseX, MouseY, MouseLButtonPush);
      g_pRenderText->SetFont(g_hFontBold);
      g_pRenderText->SetBgColor(0, 0, 0, 100);
      g_pRenderText->SetTextColor(255, 255, 255, 200);
      g_pRenderText->RenderText(120, 26, szDebugText);
      g_pRenderText->RenderText(120, 36, szMousePos);
      g_pRenderText->SetFont(g_hFont);
      EndBitmap();
      //#endif // defined(_DEBUG) || defined(LDS_FOR_DEVELOPMENT_TESTMODE) || defined(LDS_UNFIXED_FIXEDFRAME_FORDEBUG)

      if (Success)
      {
         SwapBuffers(hDC);
      }

      if (EnableSocket && SceneFlag == MAIN_SCENE)
      {
#ifdef NEW_PROTOCOL_SYSTEM
         if (!gProtocolSend.CheckConnected())
#else
         if (SocketClient.GetSocket() == INVALID_SOCKET)
#endif
         {
            static BOOL s_bClosed = FALSE;
            if (!s_bClosed)
            {
               s_bClosed = TRUE;
               g_ErrorReport.Write("> Connection closed. ");
               g_ErrorReport.WriteCurrentTime();
               SEASON3B::CreateMessageBox(MSGBOX_LAYOUT_CLASS(SEASON3B::CServerLostMsgBoxLayout));
            }
         }
      }

      if (SceneFlag == MAIN_SCENE)
      {
         switch (gMapManager.WorldActive)
         {
         case WD_0LORENCIA:
            if (HeroTile == 4)
            {
               StopBuffer(SOUND_WIND01, true);
               StopBuffer(SOUND_RAIN01, true);
            }
            else
            {
               PlayBuffer(SOUND_WIND01, NULL, true);
               if (RainCurrent > 0)
                  PlayBuffer(SOUND_RAIN01, NULL, true);
            }
            break;
         case WD_1DUNGEON:
            PlayBuffer(SOUND_DUNGEON01, NULL, true);
            break;
         case WD_2DEVIAS:
            if (HeroTile == 3 || HeroTile >= 10)
               StopBuffer(SOUND_WIND01, true);
            else
               PlayBuffer(SOUND_WIND01, NULL, true);
            break;
         case WD_3NORIA:
            PlayBuffer(SOUND_WIND01, NULL, true);
            if (rand() % 512 == 0)
               PlayBuffer(SOUND_FOREST01);
            break;
         case WD_4LOSTTOWER:
            PlayBuffer(SOUND_TOWER01, NULL, true);
            break;
         case WD_5UNKNOWN:
            //PlayBuffer(SOUND_BOSS01,NULL,true);
            break;
         case WD_7ATLANSE:
            PlayBuffer(SOUND_WATER01, NULL, true);
            break;
         case WD_8TARKAN:
            PlayBuffer(SOUND_DESERT01, NULL, true);
            break;
         case WD_10HEAVEN:
            PlayBuffer(SOUND_HEAVEN01, NULL, true);
            if ((rand() % 100) == 0)
            {
               //                PlayBuffer(SOUND_HEAVEN01);
            }
            else if ((rand() % 10) == 0)
            {
               //                PlayBuffer(SOUND_THUNDERS02);
            }
            break;
         case WD_58ICECITY_BOSS:
            PlayBuffer(SOUND_WIND01, NULL, true);
            break;
         case WD_79UNITEDMARKETPLACE:
         {
            PlayBuffer(SOUND_WIND01, NULL, true);
            PlayBuffer(SOUND_RAIN01, NULL, true);
         }
         break;
#ifdef ASG_ADD_MAP_KARUTAN
         case WD_80KARUTAN1:
            PlayBuffer(SOUND_KARUTAN_DESERT_ENV, NULL, true);
            break;
         case WD_81KARUTAN2:
            if (HeroTile == 12)
            {
               StopBuffer(SOUND_KARUTAN_DESERT_ENV, true);
               PlayBuffer(SOUND_KARUTAN_KARDAMAHAL_ENV, NULL, true);
            }
            else
            {
               StopBuffer(SOUND_KARUTAN_KARDAMAHAL_ENV, true);
               PlayBuffer(SOUND_KARUTAN_DESERT_ENV, NULL, true);
            }
            break;
#endif   // ASG_ADD_MAP_KARUTAN
         }
         if (gMapManager.WorldActive != WD_0LORENCIA && gMapManager.WorldActive != WD_2DEVIAS && gMapManager.WorldActive != WD_3NORIA && gMapManager.WorldActive != WD_58ICECITY_BOSS && gMapManager.WorldActive != WD_79UNITEDMARKETPLACE)
         {
            StopBuffer(SOUND_WIND01, true);
         }
         if (gMapManager.WorldActive != WD_0LORENCIA && gMapManager.InDevilSquare() == false && gMapManager.World
Titulo: Re: Source RoxGaming Main 5.2 - 60 FPS UPDATE
Posteado por: spartacus on July 06, 2025, 12:31:11 AM
@caminhada I put your code and it gave a lot of errors when compiling.
SMD.h
GMHellas.h
CComGem.h
ZzzScene.cpp
Winmain.h
MapManager.h