Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate

Autor Topic: takumi12 - MuHelper Main SRC 5.2  (Visto 4798 veces)

0 Miembros and 1 Guest are viewing this topic.

Offline takumi12 Posteado: January 31, 2023, 04:26:56 AM | Modificado: January 31, 2023, 04:30:26 AM by takumi12

  • MAESTRO

  • US. DE HONOR

  • LEYENDA

  • Php Coder
  • +11 puntos por ventas
  • *
  • *
  • Rank: Puto amo
  • Posts: 1.310
  • Gracias recibida: 40247
  • mx
PROCESO





FINALIZADO





CREDITOS: @takumi12




Las offset no se crea, ni se destruye, solo se transforma

Gracias:

OBBY, xhwlit, luizleao87, jonaaDev18, Marcelo07, fengyun52894, GX_KYO, Darckz, xlockee, Exynos9935, carper, culis93, birdy491, angel321, 4312204, 183358, kalleth, emersonx13, thziin, anhnt, clerio19, lthai2021, luckystar, hlinxuan20, ukvayha, saske98, duelador, muedit, testaccount, aykuang123, lkt22, hola23, Xysad, superrin, alimm03, idpnguyeni, NoeticR, djkaku, xiazaipw, welison14, hellboycp33, kellington, duongcao, thieugiapc, lehuuducmjnh, Greenland, ledemkhoc, goliloco, dark, tcbaoanh, e911217, fukpim, Kharnoxy, mpy1, jeferson11, pablosk4, regnor, DuelWar, SetecSoft, realman, tuananh92, Murilo, Kenpachi Zaraki, k33n00, afiqui, rbfd, qixar, KhongGianOL, bogart, bin9xhn2, BDCAM, kaiocnx, HaPKoTuK, nhaixuong, bebefox, idinero, neeck1234, nofearlose, wellihard, Đồng Văn Hiếu, Tmchien44, phongvan1987, kudaomobile, vladslav, YoshHatake, anderson2702, 331515194, Viper, anderinho, rando, ntcong295810, majoca10, okilove23, MooseJv, vokirval, tunhi3000, qq1988620, vaneavanea31, Saxius, Bladimir1, kimrubi, giveusatan, xufqing, orl4nd1, crlzmdq, nowalova, hald22, josecola, Ga4umy4u, thangnvv92, VERNERON, maximusos, networks1, hackluv, c4nhsatcodong, cachorroquente, max1musn1, josejose, TeamCB, sciphacker, z348870672, luciferlg, neuda, Honghai1992, josuedavud, llZeuzll, NVPGame, nsynecs, PachoRasta, antonionni, leehenry1208, NoobDK, 308508743, rikigandur, evenjams5554, comelon666, stopk, 1732313, Saige, maskarra2, hfhmu, 0911300989, Almdar, tammadall, login1, tangyi90, jeuzinn, tutu100, banam8910, giangpha, thongd45, Heimdall, Jarvis, hieu95, beecubin, samsung13, ailsoncost, duccom0123, muphantom, pulsefire, nachoman22, waltervg91, dreamboy7, coolgepds, lanxin3243, manfromvn, NghienMU, Denis Alves, warrior, InFamous, pimkungclub, httdeptrai, python, Part1zanBelarus, felipesanto, tyqhaha, SkazFire, kingteamus, deltime, m4rd0k, Amarilofx, hungngok9x, zeroalenda, wongda, bustafa, Kosh, aof10022535, cobyzero, ezesosa, draco425, 542201099, mavine, antoniodel, gang, wildriff66, binho, animator, Mathi, erickmalfoy, vcore30, me19900, m1sterio, wahaha, Androjd123, Dizzy, Van_Bom, Matt1995, lzm100001, Networks6, a269633915, yan1ycc, Nexus, stark98, victorrz17, rodrigoll89, quyanxu, Genius05, EaglE, concac123, Tester1838a, usersa, kove0816, Seya, sagat202, osvaldo1811, samsunggon, Smudevelop, Cartman, showmax, andreyzz, Genilson23, phuongcuongmsqm, son1xx2, knight.php, noahmaster, joselagos, Ryuno, GabrielDev, kksky, MsotoC, daimer, Ifreat, gredy, guibrooly, xuanyuan, Hugo, Erick05, byweltin@gmail.com, matheusgom, dasgrid, Wendigo, bimaloha, jorge2016, muzic25, roshux, ruojing, alexfy, hoanmaster, louis, Odisk, aemoscon, LABMU, Qubit, Nakamura, LTP Team, deathsquad, hennedy, dakosmu, h3yShOk, Sweng, redf0x, AishaCT, TryMenow, zhangjianle865, esteban, dahouzi, acelot, donciukas14, hanzel, Zeus, kaisudo, Kapocha33, vnshell, xz18786628, muccone, backerchen, Hoangsy99, malke, GoldSun, korron, RinOv, CorsarioDgx, npt.formu, mugloves99, Rindy

Offline CorsarioDgx #1 Posteado: January 31, 2023, 05:10:49 AM

  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 394
  • Gracias recibida: 6565
  • mx
Eres Grande ! Bro Lastima que esta muy en decadencia esto del Muonline !


Offline muccone #2 Posteado: January 31, 2023, 06:04:45 AM

  • 0 puntos por ventas
  • *
  • Rank: Dedicado
  • Posts: 35
  • Gracias recibida: 35
  • tw
For now, it's just the interface. It's pretty good.

Telegram Account :@mucone    develop Mu

Offline lunaticodeveloper #3 Posteado: January 31, 2023, 10:56:59 AM

  • MAESTRO

  • US. DE HONOR

  • +4 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 1.818
  • Gracias recibida: 22490
  • ar
Eres Grande ! Bro Lastima que esta muy en decadencia esto del Muonline !
nots nots nots

 cool2 si estamos mas activo que nunca papa

Soporte premium ya sabes contactame!
Experto en MuOnline! Mira mis aportes de primera!
Alojamiento de Servidores / Venta de Configuraciones Mu Online / Espacio de alojamiento para WebHost / Venta de diseño grafico.

Offline bimaloha #4 Posteado: January 31, 2023, 12:34:40 PM

  • 0 puntos por ventas
  • *
  • Rank: Sup. destacado
  • Posts: 118
  • Gracias recibida: 3891
  • vn

Gracias:


Offline oxey.mu #5 Posteado: January 31, 2023, 12:46:05 PM

  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 477
  • Gracias recibida: 440
  • ar
Yo quiero el helper+/offattack :v


Offline ulrick2023 #6 Posteado: January 31, 2023, 01:26:41 PM

  • 0 puntos por ventas
  • *
  • Rank: Principiante
  • Posts: 4
  • Gracias recibida: 0
  • uy
gracias por el aporte.. me indicarias donde ubico la definicion de  CNewUICheckBox , ya que me indicano esta  definido. Busque la definicion pero no la encontre en las source. Uso el main src v2019 aportado por Louis


Offline takumi12 #7 Posteado: January 31, 2023, 01:44:14 PM

  • MAESTRO

  • US. DE HONOR

  • LEYENDA

  • Php Coder
  • +11 puntos por ventas
  • *
  • *
  • Rank: Puto amo
  • Posts: 1.310
  • Gracias recibida: 40247
  • mx

Las offset no se crea, ni se destruye, solo se transforma

Offline ulrick2023 #8 Posteado: January 31, 2023, 02:56:49 PM

  • 0 puntos por ventas
  • *
  • Rank: Principiante
  • Posts: 4
  • Gracias recibida: 0
  • uy
gracias por el aporte.. me indicarias donde ubico la definicion de  CNewUICheckBox , ya que me indicano esta  definido. Busque la definicion pero no la encontre en las source. Uso el main src v2019 aportado por Louis

@takumi12  me indicarias lo de la definicion?


Offline takumi12 #9 Posteado: January 31, 2023, 04:35:25 PM

  • MAESTRO

  • US. DE HONOR

  • LEYENDA

  • Php Coder
  • +11 puntos por ventas
  • *
  • *
  • Rank: Puto amo
  • Posts: 1.310
  • Gracias recibida: 40247
  • mx
gracias por el aporte.. me indicarias donde ubico la definicion de  CNewUICheckBox , ya que me indicano esta  definido. Busque la definicion pero no la encontre en las source. Uso el main src v2019 aportado por Louis

@takumi12  me indicarias lo de la definicion?






Las offset no se crea, ni se destruye, solo se transforma

Gracias:


Offline backerchen #10 Posteado: February 01, 2023, 08:41:58 AM

  • 0 puntos por ventas
  • *
  • Rank: Principiante
  • Posts: 11
  • Gracias recibida: 2
3D Camera for S5.2 Code

Gracias:


Offline Odisk #11 Posteado: February 01, 2023, 01:14:54 PM

  • Colaborador
  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 881
  • Gracias recibida: 12416
  • pr
3D Camera for S5.2 Code

Spoiler for Hiden:
Code: [Select]

As promised, I will share with you my work on the 3D camera.

I want to inform you that I am still working on the 3D camera.

Unfinished or in preparation...
1. Damage listing function
2. Complete saving of settings in windows registry
- drawing objects on the map
3. FPS, CPU usage for maximum performance
4. Reworked feature for monster sounds

Here I will add instructions for the 3D camera, which is controlled by the arrow keys and the keys PgUp, PgOn, END

1. defining all variables
- In the ZzzOpenglUtil.cpp file, add the definitions
PHP Code:
//////////////////////////////////////////////////////////////////////////
//  Global Variable.
//////////////////////////////////////////////////////////////////////////
int     OpenglWindowX;     
int     OpenglWindowY;     
int     OpenglWindowWidth;
int     OpenglWindowHeight;
bool    CameraTopViewEnable = false;
float   CameraViewNear      = 20.f;
float   CameraViewFar       = 2000.f;
float   CameraFOV           = 55.f;
// ---- 3D camera ----
float    CameraZoom            = 0.f;
float    AngleX3D            = 0.f;
float    AngleY3D            = 0.f;
float    AngleRL                = 0.f;
// -------------------
vec3_t  CameraPosition;
vec3_t  CameraAngle;
float   CameraMatrix[3][4];
vec3_t  MousePosition;
vec3_t  MouseTarget;
float   g_fCameraCustomDistance = 0.f;
bool    FogEnable   = false;
GLfloat FogDensity  = 0.0004f;
GLfloat FogColor[4] = {30/256.f,20/256.f,10/256.f,};
- In the Winmain.h file, add the definition
PHP Code:
extern char m_ID[];
extern char m_Version[];
extern int  m_SoundOnOff;
extern int  m_MusicOnOff;
// ---- 3D camera ----
extern int    m_CameraOnOff;
// -------------------
extern int  m_Resolution;
extern int m_nColorDepth;
- In the Winmain.cpp file, find the BOOL OpenInitFile() function and add a definition above this function
PHP Code:
char m_ID[11];
char m_Version[11];
char m_ExeVersion[11];
int  m_SoundOnOff;
int  m_MusicOnOff;
// ---- 3D camera ----
int    m_CameraOnOff;
// -------------------
int  m_Resolution;
int    m_nColorDepth;
int    g_iRenderTextType = 0;

#ifdef LJH_ADD_SUPPORTING_MULTI_LANGUAGE
// ´Ů±ąľî Áöżř ·±ĂÄżˇĽ­ Ľ±ĹĂµČ ľđľî
char g_aszMLSelection[MAX_LANGUAGE_NAME_LENGTH] = {'\0'};
string g_strSelectedML = "";
#endif //LJH_ADD_SUPPORTING_MULTI_LANGUAGE

//int ĆÄŔĎ ŔĐ´Â ÇÔĽö
BOOL OpenInitFile()
{
2. Creating a 3D camera launcher using windows registry save
- Go to the BOOL OpenInitFile() function in the Winmain.cpp file and supply the following condition to validate and possibly write to the windows registry
PHP Code:
    m_ID[0] = '\0';
    m_SoundOnOff = 1;
    m_MusicOnOff = 1;
// ---- 3D camera ----
    m_CameraOnOff = 1;
// -------------------
    m_Resolution = 0;
    m_nColorDepth = 0;
PHP Code:
        dwSize = 11;
        if ( RegQueryValueEx (hKey, "ID", 0, NULL, (LPBYTE)m_ID, & dwSize) != ERROR_SUCCESS)
        {
        }
        dwSize = sizeof ( int);
        if ( RegQueryValueEx (hKey, "SoundOnOff", 0, NULL, (LPBYTE) & m_SoundOnOff, &dwSize) != ERROR_SUCCESS)
        {
            m_SoundOnOff = true;
        }
        dwSize = sizeof ( int);
        if ( RegQueryValueEx (hKey, "MusicOnOff", 0, NULL, (LPBYTE) & m_MusicOnOff, &dwSize) != ERROR_SUCCESS)
        {
            m_MusicOnOff = false;
        }
// ---- 3D camera ----
        dwSize = sizeof ( int);
        if ( RegQueryValueEx (hKey, "3DCameraOnOff", 0, NULL, (LPBYTE) & m_CameraOnOff, &dwSize) != ERROR_SUCCESS)
        {
            m_CameraOnOff = false;
        }
// -------------------
        dwSize = sizeof ( int);
        if ( RegQueryValueEx (hKey, "Resolution", 0, NULL, (LPBYTE) & m_Resolution, &dwSize) != ERROR_SUCCESS)
        {
            m_Resolution = 1;
        }
- Now go to the NewUIOptionWindow.h file and define a new public function
PHP Code:
void SetCameraOnOff();
- Then create a new function in the NewUIOptionWindow.cpp file
- This function checks if a setting for the camera exists in the registry and has permission to change the value of that setting
PHP Code:
void SEASON3B::CNewUIOptionWindow::SetCameraOnOff()
{

    HKEY hKey;
    DWORD dwDisp;
    DWORD dwSize;
    dwSize = sizeof ( int);
    if ( ERROR_SUCCESS == RegCreateKeyEx(HKEY_CURRENT_USER, "SOFTWARE\\Webzen\\Mu\\Config", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, & hKey, &dwDisp))
    {
        m_CameraOnOff = !m_CameraOnOff;
        RegSetValueEx(hKey, "3DCameraOnOff", 0, NULL, (LPBYTE) & m_CameraOnOff, dwSize);
    }
    RegCloseKey( hKey);
}
- Go to the Render Buttons() function in the NewUIOption Window.cpp file and create a checkbox for the 3D camera
- My settings save is next to the Effects render settings name
PHP Code:
    // 3D Camera checkbox
    if(m_CameraOnOff)
    {
        RenderImage(IMAGE_OPTION_BTN_CHECK, m_Pos.x+150, m_Pos.y+149, 15, 15, 0, 0);
    }
    else
    {
        RenderImage(IMAGE_OPTION_BTN_CHECK, m_Pos.x+150, m_Pos.y+149, 15, 15, 0, 15.f);
    }
- Go to the RenderContents() function in the NewUIOption Window.cpp file and create a dot before the description and the settings description itself for the 3D camera
PHP Code:
void SEASON3B::CNewUIOptionWindow::RenderContents()
{
    float x, y;
    x = m_Pos.x + 20.f;
    y = m_Pos.y + 46.f;
    RenderImage(IMAGE_OPTION_POINT, x, y, 10.f, 10.f);
    y += 22.f;
    RenderImage(IMAGE_OPTION_POINT, x, y, 10.f, 10.f);
    y += 22.f;
    RenderImage(IMAGE_OPTION_POINT, x, y, 10.f, 10.f);
    y += 40.f;
    RenderImage(IMAGE_OPTION_POINT, x, y, 10.f, 10.f);
    y += 22.f;
    RenderImage(IMAGE_OPTION_POINT, x, y, 10.f, 10.f);
    // 3D Camera
    RenderImage(IMAGE_OPTION_POINT, x+60, y, 10.f, 10.f);
   
    g_pRenderText->SetFont(g_hFont);
    g_pRenderText->SetTextColor(255, 255, 255, 255);
    g_pRenderText->SetBgColor(0);
    // 386 "ŔÚµż °ř°Ý"
    g_pRenderText->RenderText(m_Pos.x+40, m_Pos.y+48, GlobalText[386]);
    // 387 "±Ó¸» ľË¸˛Ŕ˝"
    g_pRenderText->RenderText(m_Pos.x+40, m_Pos.y+70, GlobalText[387]);
    // 389 "şĽ·ýÁ¶Ŕý"
    g_pRenderText->RenderText(m_Pos.x+40, m_Pos.y+92, GlobalText[389]);
    // 919 "˝˝¶óŔĚµĺ µµżň¸»"
    g_pRenderText->RenderText(m_Pos.x+40, m_Pos.y+132, GlobalText[919]);
    // 1840 "+Čż°úÁ¦ÇŃ"
    g_pRenderText->RenderText(m_Pos.x+40, m_Pos.y+154, "+Effect");
    // 3D Camera
    g_pRenderText->RenderText(m_Pos.x+100, m_Pos.y+154, "3D Camera");
}
- Now go to the UpdateMouseEvent() function in the NewUIOption Window.cpp file and create an action when the 3D camera checkbox is checked
PHP Code:
    if(SEASON3B::IsPress(VK_LBUTTON) && CheckMouseIn(m_Pos.x+150, m_Pos.y+127, 15, 15))
    {
        m_bSlideHelp = !m_bSlideHelp;
    }
    // 3D Camera
    if(SEASON3B::IsPress(VK_LBUTTON) && CheckMouseIn(m_Pos.x+150, m_Pos.y+149, 15, 15))
    {
        SetCameraOnOff();
    }
   
    if(CheckMouseIn(m_Pos.x+33-8, m_Pos.y+104, 124+8, 16))
Now we have our startup setup ready and we can get down to the 3D camera itself

3. Creating a 3D camera control
- This control setting is contained in the ZzzScene.cpp file and can be customized to your liking.
I chose keyboard control for the player's convenience.

- Go to the ZzzScene.cpp file in the MoveMainCamera() function and add the settings for the 3D camera.
- Edit the first condition of the function as follows.
PHP Code:
    if (
#ifdef PJH_NEW_SERVER_SELECT_MAP
        World == WD_73NEW_LOGIN_SCENE
#else
        World == 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 (World == WD_74NEW_CHARACTER_SCENE || World == WD_73NEW_LOGIN_SCENE) // Fix for opening scene and character selection
        {
            CameraZoom = 0;
            AngleY3D = 0;
        }
        CameraFOV = 35.f + CameraZoom;
        if( !g_pUIManager->IsInputEnable())
        {
            if (m_CameraOnOff == 1)
            {
                if(HIBYTE(GetAsyncKeyState(109))==128 || HIBYTE(GetAsyncKeyState(VK_PRIOR))==128) // PAGE UP or +
                {
                    if (CameraZoom < 12) CameraZoom += 2;
                }
                if(HIBYTE(GetAsyncKeyState(107))==128 || HIBYTE(GetAsyncKeyState(VK_NEXT))==128) // PAGE DOWN or -
                {
                    if (CameraZoom > -12) CameraZoom -= 2;
                }
                if(HIBYTE(GetAsyncKeyState(VK_RIGHT))==128) // RIGHT ARROW
                    CameraAngle[2] -= 4;
                if(HIBYTE(GetAsyncKeyState(VK_LEFT))==128) // LEFT ARROW
                    CameraAngle[2] += 4;
               
                if(HIBYTE(GetAsyncKeyState(VK_DOWN))==128) // DOWN ARROW
                    if (AngleY3D < 5) AngleY3D += 1;
                if(HIBYTE(GetAsyncKeyState(VK_UP))==128) // UP ARROW
                    if (AngleY3D > -10) AngleY3D -= 1;
                if(HIBYTE(GetAsyncKeyState(VK_END))==128) // END keys for reset 3D camera
                {
                    CameraZoom = 0;
                    CameraAngle[2] = -45.f;
                    AngleY3D = 0;
                }
            }
            else {
                CameraZoom = 0;
                CameraAngle[2] = -45.f;
                AngleY3D = 0;
            }
        }
    }
- In the same function, go to this condition and edit as follows
PHP Code:
        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;
            if (m_CameraOnOff == 1)
            {
                CameraAngle[0] += AngleY3D;
            }
        }
#endif
- At the end of this function, add the following condition before return bLockCamera;
PHP Code:
    // Field of vision
    if (m_CameraOnOff == 1)
    {
        if (CameraZoom > 0)
            CameraViewFar += 458.33f + (458.33f * CameraZoom);
        else
            CameraViewFar += 1458.33f;
    }
- Go to the MoveMainScene() function and modify this condition. Thus...
PHP Code:
    if(!CameraTopViewEnable
        || m_CameraOnOff == 1    // <= 3D Camera
#ifdef LDS_FIX_DISABLE_INPUTJUNKKEY_WHEN_LORENMARKT
#ifdef LDS_FIX_DISABLE_INPUTJUNKKEY_WHEN_LORENMARKT_EX01    // °řĽşŔü, ĹëÇŐ˝ĂŔĺŔş Ľ­ąö ·Îµů˝Ă°ŁŔĚ ±ćľî ·ÎµůÁß Ĺ°ŔÔ·Â şí·°.
        && ( g_bReponsedMoveMapFromServer == TRUE )        // Ĺ°ŔÔ·Â ¸·±â : Ľ­ąö·ÎşÎĹÍ ·Îµů żůµĺ ŔŔ´äŔĚ ľČżÂ °ćżě¸¸.
#else // LDS_FIX_DISABLE_INPUTJUNKKEY_WHEN_LORENMARKT_EX01
        && LoadingWorld < 30
#endif // LDS_FIX_DISABLE_INPUTJUNKKEY_WHEN_LORENMARKT_EX01
#endif // LDS_FIX_DISABLE_INPUTJUNKKEY_WHEN_LORENMARKT
        )
    {
#ifdef MOD_MOUSE_Y_CLICK_AREA
        if(GFxProcess::GetInstancePtr()->GetUISelect() == 1)
        {
            if(MouseY>=(int)(480))
                MouseOnWindow = true;
        }
        else
        {
            if(MouseY>=(int)(480-48))
                MouseOnWindow = true;
        }
#else //MOD_MOUSE_Y_CLICK_AREA
        if(MouseY>=(int)(480-48))
            MouseOnWindow = true;
#endif //MOD_MOUSE_Y_CLICK_AREA

        g_pPartyManager->Update();
        g_pNewUISystem->Update();
       
        // Ŕ©µµżě ľĆ´Ń°÷ Ŭ¸Ż˝Ă
        if (MouseLButton == true
            && false == g_pNewUISystem->CheckMouseUse() /* NewUIżë ¸¶żě˝ş ĂĽĹ© */
            && g_dwMouseUseUIID == 0 /* ±âÁ¸ŔÇ UI ¸¶żě˝ş ĂĽĹ© ŔüżŞ şŻĽö */
            && 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);
            }
        }
#ifdef _PVP_ADD_MOVE_SCROLL
        g_MurdererMove.MurdererMoveCheck();
#endif    // _PVP_ADD_MOVE_SCROLL
       
        MoveInterface();
        MoveTournamentInterface();
        if( ErrorMessage != MESSAGE_LOG_OUT )
            g_pUIManager->UpdateInput();
    }
- Go to the next condition in the MoveMainScene() function and edit that condition. Thus...
PHP Code:
    if(!CameraTopViewEnable
        || m_CameraOnOff == 1) // <= 3D Camera
        MoveItems();
    if ( ( World==WD_0LORENCIA && HeroTile!=4 ) ||
         ( World==WD_2DEVIAS && HeroTile!=3 && HeroTile<10 )
         || World==WD_3NORIA
         || World==WD_7ATLANSE
         || InDevilSquare() == true
         || World==WD_10HEAVEN
         || InChaosCastle()==true
         || battleCastle::InBattleCastle()==true
         || M31HuntingGround::IsInHuntingGround()==true
         || M33Aida::IsInAida()==true
         || M34CryWolf1st::IsCyrWolf1st()==true
        || World == WD_42CHANGEUP3RD_2ND
#ifdef CSK_ADD_MAP_ICECITY
        || IsIceCity()
#endif // CSK_ADD_MAP_ICECITY
#ifdef YDG_ADD_MAP_SANTA_TOWN
        || IsSantaTown()
#endif    // YDG_ADD_MAP_SANTA_TOWN
#ifdef PBG_ADD_PKFIELD
        || IsPKField()
#endif //PBG_ADD_PKFIELD
#ifdef YDG_ADD_MAP_DOPPELGANGER2
        || IsDoppelGanger2()
#endif    // YDG_ADD_MAP_DOPPELGANGER2
#ifdef LDS_ADD_EMPIRE_GUARDIAN
        || IsEmpireGuardian1()
        || IsEmpireGuardian2()
        || IsEmpireGuardian3()
        || IsEmpireGuardian4()
#endif //LDS_ADD_EMPIRE_GUARDIAN
#ifdef LDS_ADD_MAP_UNITEDMARKETPLACE
        || IsUnitedMarketPlace()
#endif    // LDS_ADD_MAP_UNITEDMARKETPLACE
     )
    {
        MoveLeaves();
    }
- Go to the next condition in the RenderMainScene() function and edit that condition. Thus...
PHP Code:
    BYTE byWaterMap = 0;

    if(CameraTopViewEnable == false
        || m_CameraOnOff == 1) // 3D Camera
    {
#ifdef MOD_MAINSCENE_HEIGHT
        Height = 480;
#else //MOD_MAINSCENE_HEIGHT
        Height = 480-48;
#endif //MOD_MAINSCENE_HEIGHT
    }
    else
    {
        Height = 480;
    }
- And the last condition in this file in the RenderMainScene() function modify this condition. Thus...
PHP Code:
    RenderCharactersClient();   //  Äł¸ŻĹÍ ą¦»ç.

    if(EditFlag!=EDIT_NONE)     //  żˇµđĹÍżˇĽ­¸¸ Ăł¸®.
    {
        RenderTerrain(true);
    }
    if(!CameraTopViewEnable
        || m_CameraOnOff == 1)    // <=  3D Camera
         RenderItems();
3. Problem with rotating figure and head when moving the cursor.
Webzen did not expect that someone would create a 3D camera. Because of this, an abnormality will appear when the camera is turned to the right or left side.
- Go to the ZzzInterface.cpp file and find the MoveHero() function. Modify the following condition as follows.
PHP Code:
    //  ! ¸¶żě˝ş µű¶óĽ­ Äł¸ŻĹÍŔÇ Č¸Ŕü °˘µµ¸¦ şŻ°ćÇŃ´Ů.
    if( g_isCharacterBuff(o, eDeBuff_Stun)
        || g_isCharacterBuff(o, eDeBuff_Sleep)
#ifdef WORLDCUP_ADD
        || o->CurrentAction == PLAYER_POINT_DANCE
#endif //WORLDCUP_ADD
#ifdef PBG_ADD_NEWCHAR_MONK_SKILL
        || o->CurrentAction == PLAYER_SKILL_GIANTSWING
#endif //PBG_ADD_NEWCHAR_MONK_SKILL
            )
    {
        Angle = (int)Hero->Object.Angle[2];
        bLookAtMouse = false;
    }
    else
    {
        if (m_CameraOnOff == 1)
            Angle = (int)(Hero->Object.Angle[2]+CreateAngle((float)HeroX,(float)HeroY,(float)MouseX,(float)MouseY)) + 360 + CameraAngle[2];
        else
            Angle = (int)(Hero->Object.Angle[2]+CreateAngle((float)HeroX,(float)HeroY,(float)MouseX,(float)MouseY)) + 360 - 45;

        Angle %= 360;
        if(Angle < 120) Angle = 120;
        if(Angle > 240) Angle = 240;
        Angle += 180;
        Angle %= 360;
    }
       
    Hero->Object.HeadTargetAngle[2] = 0.f;
- Find another condition and edit it like this
PHP Code:
        if(StandTime >= 40 && !MouseOnWindow && !Hero->Dead &&
            o->CurrentAction!=PLAYER_POSE1 && o->CurrentAction!=PLAYER_POSE_FEMALE1 &&
            o->CurrentAction!=PLAYER_SIT1  && o->CurrentAction!=PLAYER_SIT_FEMALE1 && NoAutoAttacking &&
            o->CurrentAction!=PLAYER_ATTACK_TELEPORT &&
            o->CurrentAction!=PLAYER_ATTACK_RIDE_TELEPORT &&
            o->CurrentAction != PLAYER_FENRIR_ATTACK_DARKLORD_TELEPORT &&
#ifdef PBG_ADD_NEWCHAR_MONK_SKILL
            o->CurrentAction != PLAYER_SKILL_ATT_UP_OURFORCES &&
            o->CurrentAction != PLAYER_SKILL_HP_UP_OURFORCES &&
#endif //PBG_ADD_NEWCHAR_MONK_SKILL
            Hero->AttackTime == 0)
        {
            StandTime = 0;
            if (m_CameraOnOff == 1)
                HeroAngle = -(int)(CameraAngle[2]+CreateAngle((float)MouseX,(float)MouseY,(float)HeroX,(float)HeroY)) + 360;
            else
                HeroAngle = -(int)(CreateAngle((float)MouseX,(float)MouseY,(float)HeroX,(float)HeroY)) + 360 + 45;

            HeroAngle %= 360;
            BYTE Angle1 = ((BYTE)((o->Angle[2]+22.5f)/360.f*8.f+1.f)%8);
            BYTE Angle2 = ((BYTE)(((float)HeroAngle+22.5f)/360.f*8.f+1.f)%8);
            if(Angle1 != Angle2)
            {
                if ( o->CurrentAction!=PLAYER_ATTACK_SKILL_SWORD2 )
                {
                    Hero->Object.Angle[2] = (float)HeroAngle;
                }
                SendRequestAction(AT_STAND1,((BYTE)((HeroAngle+22.5f)/360.f*8.f+1.f)%8));
            }
        }
Now, even when moving sideways, the figure and head will rotate behind the cursor.

4. The distance of drawing objects from the character
- Go to the ZzzLodTerrain.cpp file and find the function bool TestFrustrum2D(float x,float y,float Range). Edit it as follows.
PHP Code:
bool TestFrustrum2D(float x,float y,float Range)
{
    if ( SceneFlag == SERVER_LIST_SCENE || SceneFlag == WEBZEN_SCENE || SceneFlag == LOADING_SCENE)
        return true;

    int j = 3;
    for(int i=0;i<4;j=i,i++)
    {
        if (m_CameraOnOff == 1)   
        {
            if (CameraZoom > 0)
                Range -= ((50.f/2.5f) * CameraZoom);//Range -= 600.f;
            else
                Range -= 50.f;

            if (AngleY3D < 0)
                Range += 15.f * AngleY3D;
        }

        if((FrustrumX[i]-x) * (FrustrumY[j]-y) - (FrustrumX[j]-x) * (FrustrumY[i]-y) <= Range)
        {
            return false;
        }
    }
    return true;
}
- Then find the function bool bool TestFrustrum(vec3_t Position,float Range). Edit it as follows.
PHP Code:
bool TestFrustrum(vec3_t Position,float Range)
{
    for(int i=0;i<5;i++)
    {
        float Value;
        if (m_CameraOnOff == 1)
        {
            if (CameraZoom > 0)
                Range += 0.f + ((41.66f/2.5f) * CameraZoom);//Range += 500.f;
            else
                Range += 41.66f;
        }
        Value = FrustrumFaceD[i] + DotProduct(Position,FrustrumFaceNormal[i]);
        if(Value < -(Range)) return false;
    }
    return true;
}

[BONUS]
5. Fog around field of vision.
Another problem is rendering objects while walking. Objects just disappear and it looks ugly. This problem can also be solved.

- Go to the ZzzOpenglUtil.cpp file and find the void BeginOpengl(int x,int y,int Width,int Height ) function. Adjust the fog condition as follows.
PHP Code:
    glDisable(GL_ALPHA_TEST);
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_CULL_FACE);
       glDepthMask(true);
    AlphaTestEnable = false;
    TextureEnable   = true;
    DepthTestEnable = true;
    CullFaceEnable  = true;
    DepthMaskEnable = true;
    glDepthFunc(GL_LEQUAL);
    glAlphaFunc(GL_GREATER,0.25f);

    if(FogEnable)
    {
        if (m_CameraOnOff == 1)
        {
            glEnable(GL_FOG);
            glFogf( GL_FOG_MODE, GL_LINEAR );
            glFogf(GL_FOG_START, 2000.f);
            glFogf(GL_FOG_END, 2700.f);

            glFogf(GL_FOG_DENSITY, FogDensity);
            float color[] = {10/256.f,10/256.f,10/256.f,5.0};
            glFogfv(GL_FOG_COLOR, color);
        }
        else
        {
            glEnable(GL_FOG);
            glFogi(GL_FOG_MODE, GL_LINEAR);
            glFogf(GL_FOG_DENSITY, FogDensity);
            glFogfv(GL_FOG_COLOR, FogColor);
        }
    }
    else
    {
        glDisable(GL_FOG);
    }

    GetOpenGLMatrix(CameraMatrix);
- Go to the ZzzScene.cpp file and find the RenderMainScene() function. Replace the following line
PHP Code:
FogEnable = true;
with this line
PHP Code:
FogEnable   = (m_CameraOnOff)?true:false;
If you did everything right, your 3D camera is now almost ready.
When I finish the other edits I can provide them as well.

During this tutorial I modified the code to make it faster. It's not a win.


leorond

one day

next generation ♥ !
https://nextmu.dev/

Gracias:


Offline backerchen #12 Posteado: February 02, 2023, 03:26:29 AM | Modificado: February 02, 2023, 03:28:13 AM by backerchen

  • 0 puntos por ventas
  • *
  • Rank: Principiante
  • Posts: 11
  • Gracias recibida: 2
3D Camera for S5.2 Code

Spoiler for Hiden:
Code: [Select]

As promised, I will share with you my work on the 3D camera.

I want to inform you that I am still working on the 3D camera.

Unfinished or in preparation...
1. Damage listing function
2. Complete saving of settings in windows registry
- drawing objects on the map
3. FPS, CPU usage for maximum performance
4. Reworked feature for monster sounds

Here I will add instructions for the 3D camera, which is controlled by the arrow keys and the keys PgUp, PgOn, END

1. defining all variables
- In the ZzzOpenglUtil.cpp file, add the definitions
PHP Code:
//////////////////////////////////////////////////////////////////////////
//  Global Variable.
//////////////////////////////////////////////////////////////////////////
int     OpenglWindowX;     
int     OpenglWindowY;     
int     OpenglWindowWidth;
int     OpenglWindowHeight;
bool    CameraTopViewEnable = false;
float   CameraViewNear      = 20.f;
float   CameraViewFar       = 2000.f;
float   CameraFOV           = 55.f;
// ---- 3D camera ----
float    CameraZoom            = 0.f;
float    AngleX3D            = 0.f;
float    AngleY3D            = 0.f;
float    AngleRL                = 0.f;
// -------------------
vec3_t  CameraPosition;
vec3_t  CameraAngle;
float   CameraMatrix[3][4];
vec3_t  MousePosition;
vec3_t  MouseTarget;
float   g_fCameraCustomDistance = 0.f;
bool    FogEnable   = false;
GLfloat FogDensity  = 0.0004f;
GLfloat FogColor[4] = {30/256.f,20/256.f,10/256.f,};
- In the Winmain.h file, add the definition
PHP Code:
extern char m_ID[];
extern char m_Version[];
extern int  m_SoundOnOff;
extern int  m_MusicOnOff;
// ---- 3D camera ----
extern int    m_CameraOnOff;
// -------------------
extern int  m_Resolution;
extern int m_nColorDepth;
- In the Winmain.cpp file, find the BOOL OpenInitFile() function and add a definition above this function
PHP Code:
char m_ID[11];
char m_Version[11];
char m_ExeVersion[11];
int  m_SoundOnOff;
int  m_MusicOnOff;
// ---- 3D camera ----
int    m_CameraOnOff;
// -------------------
int  m_Resolution;
int    m_nColorDepth;
int    g_iRenderTextType = 0;

#ifdef LJH_ADD_SUPPORTING_MULTI_LANGUAGE
// ´Ů±ąľî Áöżř ·±ĂÄżˇĽ­ Ľ±ĹĂµČ ľđľî
char g_aszMLSelection[MAX_LANGUAGE_NAME_LENGTH] = {'\0'};
string g_strSelectedML = "";
#endif //LJH_ADD_SUPPORTING_MULTI_LANGUAGE

//int ĆÄŔĎ ŔĐ´Â ÇÔĽö
BOOL OpenInitFile()
{
2. Creating a 3D camera launcher using windows registry save
- Go to the BOOL OpenInitFile() function in the Winmain.cpp file and supply the following condition to validate and possibly write to the windows registry
PHP Code:
    m_ID[0] = '\0';
    m_SoundOnOff = 1;
    m_MusicOnOff = 1;
// ---- 3D camera ----
    m_CameraOnOff = 1;
// -------------------
    m_Resolution = 0;
    m_nColorDepth = 0;
PHP Code:
        dwSize = 11;
        if ( RegQueryValueEx (hKey, "ID", 0, NULL, (LPBYTE)m_ID, & dwSize) != ERROR_SUCCESS)
        {
        }
        dwSize = sizeof ( int);
        if ( RegQueryValueEx (hKey, "SoundOnOff", 0, NULL, (LPBYTE) & m_SoundOnOff, &dwSize) != ERROR_SUCCESS)
        {
            m_SoundOnOff = true;
        }
        dwSize = sizeof ( int);
        if ( RegQueryValueEx (hKey, "MusicOnOff", 0, NULL, (LPBYTE) & m_MusicOnOff, &dwSize) != ERROR_SUCCESS)
        {
            m_MusicOnOff = false;
        }
// ---- 3D camera ----
        dwSize = sizeof ( int);
        if ( RegQueryValueEx (hKey, "3DCameraOnOff", 0, NULL, (LPBYTE) & m_CameraOnOff, &dwSize) != ERROR_SUCCESS)
        {
            m_CameraOnOff = false;
        }
// -------------------
        dwSize = sizeof ( int);
        if ( RegQueryValueEx (hKey, "Resolution", 0, NULL, (LPBYTE) & m_Resolution, &dwSize) != ERROR_SUCCESS)
        {
            m_Resolution = 1;
        }
- Now go to the NewUIOptionWindow.h file and define a new public function
PHP Code:
void SetCameraOnOff();
- Then create a new function in the NewUIOptionWindow.cpp file
- This function checks if a setting for the camera exists in the registry and has permission to change the value of that setting
PHP Code:
void SEASON3B::CNewUIOptionWindow::SetCameraOnOff()
{

    HKEY hKey;
    DWORD dwDisp;
    DWORD dwSize;
    dwSize = sizeof ( int);
    if ( ERROR_SUCCESS == RegCreateKeyEx(HKEY_CURRENT_USER, "SOFTWARE\\Webzen\\Mu\\Config", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, & hKey, &dwDisp))
    {
        m_CameraOnOff = !m_CameraOnOff;
        RegSetValueEx(hKey, "3DCameraOnOff", 0, NULL, (LPBYTE) & m_CameraOnOff, dwSize);
    }
    RegCloseKey( hKey);
}
- Go to the Render Buttons() function in the NewUIOption Window.cpp file and create a checkbox for the 3D camera
- My settings save is next to the Effects render settings name
PHP Code:
    // 3D Camera checkbox
    if(m_CameraOnOff)
    {
        RenderImage(IMAGE_OPTION_BTN_CHECK, m_Pos.x+150, m_Pos.y+149, 15, 15, 0, 0);
    }
    else
    {
        RenderImage(IMAGE_OPTION_BTN_CHECK, m_Pos.x+150, m_Pos.y+149, 15, 15, 0, 15.f);
    }
- Go to the RenderContents() function in the NewUIOption Window.cpp file and create a dot before the description and the settings description itself for the 3D camera
PHP Code:
void SEASON3B::CNewUIOptionWindow::RenderContents()
{
    float x, y;
    x = m_Pos.x + 20.f;
    y = m_Pos.y + 46.f;
    RenderImage(IMAGE_OPTION_POINT, x, y, 10.f, 10.f);
    y += 22.f;
    RenderImage(IMAGE_OPTION_POINT, x, y, 10.f, 10.f);
    y += 22.f;
    RenderImage(IMAGE_OPTION_POINT, x, y, 10.f, 10.f);
    y += 40.f;
    RenderImage(IMAGE_OPTION_POINT, x, y, 10.f, 10.f);
    y += 22.f;
    RenderImage(IMAGE_OPTION_POINT, x, y, 10.f, 10.f);
    // 3D Camera
    RenderImage(IMAGE_OPTION_POINT, x+60, y, 10.f, 10.f);
   
    g_pRenderText->SetFont(g_hFont);
    g_pRenderText->SetTextColor(255, 255, 255, 255);
    g_pRenderText->SetBgColor(0);
    // 386 "ŔÚµż °ř°Ý"
    g_pRenderText->RenderText(m_Pos.x+40, m_Pos.y+48, GlobalText[386]);
    // 387 "±Ó¸» ľË¸˛Ŕ˝"
    g_pRenderText->RenderText(m_Pos.x+40, m_Pos.y+70, GlobalText[387]);
    // 389 "şĽ·ýÁ¶Ŕý"
    g_pRenderText->RenderText(m_Pos.x+40, m_Pos.y+92, GlobalText[389]);
    // 919 "˝˝¶óŔĚµĺ µµżň¸»"
    g_pRenderText->RenderText(m_Pos.x+40, m_Pos.y+132, GlobalText[919]);
    // 1840 "+Čż°úÁ¦ÇŃ"
    g_pRenderText->RenderText(m_Pos.x+40, m_Pos.y+154, "+Effect");
    // 3D Camera
    g_pRenderText->RenderText(m_Pos.x+100, m_Pos.y+154, "3D Camera");
}
- Now go to the UpdateMouseEvent() function in the NewUIOption Window.cpp file and create an action when the 3D camera checkbox is checked
PHP Code:
    if(SEASON3B::IsPress(VK_LBUTTON) && CheckMouseIn(m_Pos.x+150, m_Pos.y+127, 15, 15))
    {
        m_bSlideHelp = !m_bSlideHelp;
    }
    // 3D Camera
    if(SEASON3B::IsPress(VK_LBUTTON) && CheckMouseIn(m_Pos.x+150, m_Pos.y+149, 15, 15))
    {
        SetCameraOnOff();
    }
   
    if(CheckMouseIn(m_Pos.x+33-8, m_Pos.y+104, 124+8, 16))
Now we have our startup setup ready and we can get down to the 3D camera itself

3. Creating a 3D camera control
- This control setting is contained in the ZzzScene.cpp file and can be customized to your liking.
I chose keyboard control for the player's convenience.

- Go to the ZzzScene.cpp file in the MoveMainCamera() function and add the settings for the 3D camera.
- Edit the first condition of the function as follows.
PHP Code:
    if (
#ifdef PJH_NEW_SERVER_SELECT_MAP
        World == WD_73NEW_LOGIN_SCENE
#else
        World == 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 (World == WD_74NEW_CHARACTER_SCENE || World == WD_73NEW_LOGIN_SCENE) // Fix for opening scene and character selection
        {
            CameraZoom = 0;
            AngleY3D = 0;
        }
        CameraFOV = 35.f + CameraZoom;
        if( !g_pUIManager->IsInputEnable())
        {
            if (m_CameraOnOff == 1)
            {
                if(HIBYTE(GetAsyncKeyState(109))==128 || HIBYTE(GetAsyncKeyState(VK_PRIOR))==128) // PAGE UP or +
                {
                    if (CameraZoom < 12) CameraZoom += 2;
                }
                if(HIBYTE(GetAsyncKeyState(107))==128 || HIBYTE(GetAsyncKeyState(VK_NEXT))==128) // PAGE DOWN or -
                {
                    if (CameraZoom > -12) CameraZoom -= 2;
                }
                if(HIBYTE(GetAsyncKeyState(VK_RIGHT))==128) // RIGHT ARROW
                    CameraAngle[2] -= 4;
                if(HIBYTE(GetAsyncKeyState(VK_LEFT))==128) // LEFT ARROW
                    CameraAngle[2] += 4;
               
                if(HIBYTE(GetAsyncKeyState(VK_DOWN))==128) // DOWN ARROW
                    if (AngleY3D < 5) AngleY3D += 1;
                if(HIBYTE(GetAsyncKeyState(VK_UP))==128) // UP ARROW
                    if (AngleY3D > -10) AngleY3D -= 1;
                if(HIBYTE(GetAsyncKeyState(VK_END))==128) // END keys for reset 3D camera
                {
                    CameraZoom = 0;
                    CameraAngle[2] = -45.f;
                    AngleY3D = 0;
                }
            }
            else {
                CameraZoom = 0;
                CameraAngle[2] = -45.f;
                AngleY3D = 0;
            }
        }
    }
- In the same function, go to this condition and edit as follows
PHP Code:
        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;
            if (m_CameraOnOff == 1)
            {
                CameraAngle[0] += AngleY3D;
            }
        }
#endif
- At the end of this function, add the following condition before return bLockCamera;
PHP Code:
    // Field of vision
    if (m_CameraOnOff == 1)
    {
        if (CameraZoom > 0)
            CameraViewFar += 458.33f + (458.33f * CameraZoom);
        else
            CameraViewFar += 1458.33f;
    }
- Go to the MoveMainScene() function and modify this condition. Thus...
PHP Code:
    if(!CameraTopViewEnable
        || m_CameraOnOff == 1    // <= 3D Camera
#ifdef LDS_FIX_DISABLE_INPUTJUNKKEY_WHEN_LORENMARKT
#ifdef LDS_FIX_DISABLE_INPUTJUNKKEY_WHEN_LORENMARKT_EX01    // °řĽşŔü, ĹëÇŐ˝ĂŔĺŔş Ľ­ąö ·Îµů˝Ă°ŁŔĚ ±ćľî ·ÎµůÁß Ĺ°ŔÔ·Â şí·°.
        && ( g_bReponsedMoveMapFromServer == TRUE )        // Ĺ°ŔÔ·Â ¸·±â : Ľ­ąö·ÎşÎĹÍ ·Îµů żůµĺ ŔŔ´äŔĚ ľČżÂ °ćżě¸¸.
#else // LDS_FIX_DISABLE_INPUTJUNKKEY_WHEN_LORENMARKT_EX01
        && LoadingWorld < 30
#endif // LDS_FIX_DISABLE_INPUTJUNKKEY_WHEN_LORENMARKT_EX01
#endif // LDS_FIX_DISABLE_INPUTJUNKKEY_WHEN_LORENMARKT
        )
    {
#ifdef MOD_MOUSE_Y_CLICK_AREA
        if(GFxProcess::GetInstancePtr()->GetUISelect() == 1)
        {
            if(MouseY>=(int)(480))
                MouseOnWindow = true;
        }
        else
        {
            if(MouseY>=(int)(480-48))
                MouseOnWindow = true;
        }
#else //MOD_MOUSE_Y_CLICK_AREA
        if(MouseY>=(int)(480-48))
            MouseOnWindow = true;
#endif //MOD_MOUSE_Y_CLICK_AREA

        g_pPartyManager->Update();
        g_pNewUISystem->Update();
       
        // Ŕ©µµżě ľĆ´Ń°÷ Ŭ¸Ż˝Ă
        if (MouseLButton == true
            && false == g_pNewUISystem->CheckMouseUse() /* NewUIżë ¸¶żě˝ş ĂĽĹ© */
            && g_dwMouseUseUIID == 0 /* ±âÁ¸ŔÇ UI ¸¶żě˝ş ĂĽĹ© ŔüżŞ şŻĽö */
            && 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);
            }
        }
#ifdef _PVP_ADD_MOVE_SCROLL
        g_MurdererMove.MurdererMoveCheck();
#endif    // _PVP_ADD_MOVE_SCROLL
       
        MoveInterface();
        MoveTournamentInterface();
        if( ErrorMessage != MESSAGE_LOG_OUT )
            g_pUIManager->UpdateInput();
    }
- Go to the next condition in the MoveMainScene() function and edit that condition. Thus...
PHP Code:
    if(!CameraTopViewEnable
        || m_CameraOnOff == 1) // <= 3D Camera
        MoveItems();
    if ( ( World==WD_0LORENCIA && HeroTile!=4 ) ||
         ( World==WD_2DEVIAS && HeroTile!=3 && HeroTile<10 )
         || World==WD_3NORIA
         || World==WD_7ATLANSE
         || InDevilSquare() == true
         || World==WD_10HEAVEN
         || InChaosCastle()==true
         || battleCastle::InBattleCastle()==true
         || M31HuntingGround::IsInHuntingGround()==true
         || M33Aida::IsInAida()==true
         || M34CryWolf1st::IsCyrWolf1st()==true
        || World == WD_42CHANGEUP3RD_2ND
#ifdef CSK_ADD_MAP_ICECITY
        || IsIceCity()
#endif // CSK_ADD_MAP_ICECITY
#ifdef YDG_ADD_MAP_SANTA_TOWN
        || IsSantaTown()
#endif    // YDG_ADD_MAP_SANTA_TOWN
#ifdef PBG_ADD_PKFIELD
        || IsPKField()
#endif //PBG_ADD_PKFIELD
#ifdef YDG_ADD_MAP_DOPPELGANGER2
        || IsDoppelGanger2()
#endif    // YDG_ADD_MAP_DOPPELGANGER2
#ifdef LDS_ADD_EMPIRE_GUARDIAN
        || IsEmpireGuardian1()
        || IsEmpireGuardian2()
        || IsEmpireGuardian3()
        || IsEmpireGuardian4()
#endif //LDS_ADD_EMPIRE_GUARDIAN
#ifdef LDS_ADD_MAP_UNITEDMARKETPLACE
        || IsUnitedMarketPlace()
#endif    // LDS_ADD_MAP_UNITEDMARKETPLACE
     )
    {
        MoveLeaves();
    }
- Go to the next condition in the RenderMainScene() function and edit that condition. Thus...
PHP Code:
    BYTE byWaterMap = 0;

    if(CameraTopViewEnable == false
        || m_CameraOnOff == 1) // 3D Camera
    {
#ifdef MOD_MAINSCENE_HEIGHT
        Height = 480;
#else //MOD_MAINSCENE_HEIGHT
        Height = 480-48;
#endif //MOD_MAINSCENE_HEIGHT
    }
    else
    {
        Height = 480;
    }
- And the last condition in this file in the RenderMainScene() function modify this condition. Thus...
PHP Code:
    RenderCharactersClient();   //  Äł¸ŻĹÍ ą¦»ç.

    if(EditFlag!=EDIT_NONE)     //  żˇµđĹÍżˇĽ­¸¸ Ăł¸®.
    {
        RenderTerrain(true);
    }
    if(!CameraTopViewEnable
        || m_CameraOnOff == 1)    // <=  3D Camera
         RenderItems();
3. Problem with rotating figure and head when moving the cursor.
Webzen did not expect that someone would create a 3D camera. Because of this, an abnormality will appear when the camera is turned to the right or left side.
- Go to the ZzzInterface.cpp file and find the MoveHero() function. Modify the following condition as follows.
PHP Code:
    //  ! ¸¶żě˝ş µű¶óĽ­ Äł¸ŻĹÍŔÇ Č¸Ŕü °˘µµ¸¦ şŻ°ćÇŃ´Ů.
    if( g_isCharacterBuff(o, eDeBuff_Stun)
        || g_isCharacterBuff(o, eDeBuff_Sleep)
#ifdef WORLDCUP_ADD
        || o->CurrentAction == PLAYER_POINT_DANCE
#endif //WORLDCUP_ADD
#ifdef PBG_ADD_NEWCHAR_MONK_SKILL
        || o->CurrentAction == PLAYER_SKILL_GIANTSWING
#endif //PBG_ADD_NEWCHAR_MONK_SKILL
            )
    {
        Angle = (int)Hero->Object.Angle[2];
        bLookAtMouse = false;
    }
    else
    {
        if (m_CameraOnOff == 1)
            Angle = (int)(Hero->Object.Angle[2]+CreateAngle((float)HeroX,(float)HeroY,(float)MouseX,(float)MouseY)) + 360 + CameraAngle[2];
        else
            Angle = (int)(Hero->Object.Angle[2]+CreateAngle((float)HeroX,(float)HeroY,(float)MouseX,(float)MouseY)) + 360 - 45;

        Angle %= 360;
        if(Angle < 120) Angle = 120;
        if(Angle > 240) Angle = 240;
        Angle += 180;
        Angle %= 360;
    }
       
    Hero->Object.HeadTargetAngle[2] = 0.f;
- Find another condition and edit it like this
PHP Code:
        if(StandTime >= 40 && !MouseOnWindow && !Hero->Dead &&
            o->CurrentAction!=PLAYER_POSE1 && o->CurrentAction!=PLAYER_POSE_FEMALE1 &&
            o->CurrentAction!=PLAYER_SIT1  && o->CurrentAction!=PLAYER_SIT_FEMALE1 && NoAutoAttacking &&
            o->CurrentAction!=PLAYER_ATTACK_TELEPORT &&
            o->CurrentAction!=PLAYER_ATTACK_RIDE_TELEPORT &&
            o->CurrentAction != PLAYER_FENRIR_ATTACK_DARKLORD_TELEPORT &&
#ifdef PBG_ADD_NEWCHAR_MONK_SKILL
            o->CurrentAction != PLAYER_SKILL_ATT_UP_OURFORCES &&
            o->CurrentAction != PLAYER_SKILL_HP_UP_OURFORCES &&
#endif //PBG_ADD_NEWCHAR_MONK_SKILL
            Hero->AttackTime == 0)
        {
            StandTime = 0;
            if (m_CameraOnOff == 1)
                HeroAngle = -(int)(CameraAngle[2]+CreateAngle((float)MouseX,(float)MouseY,(float)HeroX,(float)HeroY)) + 360;
            else
                HeroAngle = -(int)(CreateAngle((float)MouseX,(float)MouseY,(float)HeroX,(float)HeroY)) + 360 + 45;

            HeroAngle %= 360;
            BYTE Angle1 = ((BYTE)((o->Angle[2]+22.5f)/360.f*8.f+1.f)%8);
            BYTE Angle2 = ((BYTE)(((float)HeroAngle+22.5f)/360.f*8.f+1.f)%8);
            if(Angle1 != Angle2)
            {
                if ( o->CurrentAction!=PLAYER_ATTACK_SKILL_SWORD2 )
                {
                    Hero->Object.Angle[2] = (float)HeroAngle;
                }
                SendRequestAction(AT_STAND1,((BYTE)((HeroAngle+22.5f)/360.f*8.f+1.f)%8));
            }
        }
Now, even when moving sideways, the figure and head will rotate behind the cursor.

4. The distance of drawing objects from the character
- Go to the ZzzLodTerrain.cpp file and find the function bool TestFrustrum2D(float x,float y,float Range). Edit it as follows.
PHP Code:
bool TestFrustrum2D(float x,float y,float Range)
{
    if ( SceneFlag == SERVER_LIST_SCENE || SceneFlag == WEBZEN_SCENE || SceneFlag == LOADING_SCENE)
        return true;

    int j = 3;
    for(int i=0;i<4;j=i,i++)
    {
        if (m_CameraOnOff == 1)   
        {
            if (CameraZoom > 0)
                Range -= ((50.f/2.5f) * CameraZoom);//Range -= 600.f;
            else
                Range -= 50.f;

            if (AngleY3D < 0)
                Range += 15.f * AngleY3D;
        }

        if((FrustrumX[i]-x) * (FrustrumY[j]-y) - (FrustrumX[j]-x) * (FrustrumY[i]-y) <= Range)
        {
            return false;
        }
    }
    return true;
}
- Then find the function bool bool TestFrustrum(vec3_t Position,float Range). Edit it as follows.
PHP Code:
bool TestFrustrum(vec3_t Position,float Range)
{
    for(int i=0;i<5;i++)
    {
        float Value;
        if (m_CameraOnOff == 1)
        {
            if (CameraZoom > 0)
                Range += 0.f + ((41.66f/2.5f) * CameraZoom);//Range += 500.f;
            else
                Range += 41.66f;
        }
        Value = FrustrumFaceD[i] + DotProduct(Position,FrustrumFaceNormal[i]);
        if(Value < -(Range)) return false;
    }
    return true;
}

[BONUS]
5. Fog around field of vision.
Another problem is rendering objects while walking. Objects just disappear and it looks ugly. This problem can also be solved.

- Go to the ZzzOpenglUtil.cpp file and find the void BeginOpengl(int x,int y,int Width,int Height ) function. Adjust the fog condition as follows.
PHP Code:
    glDisable(GL_ALPHA_TEST);
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_CULL_FACE);
       glDepthMask(true);
    AlphaTestEnable = false;
    TextureEnable   = true;
    DepthTestEnable = true;
    CullFaceEnable  = true;
    DepthMaskEnable = true;
    glDepthFunc(GL_LEQUAL);
    glAlphaFunc(GL_GREATER,0.25f);

    if(FogEnable)
    {
        if (m_CameraOnOff == 1)
        {
            glEnable(GL_FOG);
            glFogf( GL_FOG_MODE, GL_LINEAR );
            glFogf(GL_FOG_START, 2000.f);
            glFogf(GL_FOG_END, 2700.f);

            glFogf(GL_FOG_DENSITY, FogDensity);
            float color[] = {10/256.f,10/256.f,10/256.f,5.0};
            glFogfv(GL_FOG_COLOR, color);
        }
        else
        {
            glEnable(GL_FOG);
            glFogi(GL_FOG_MODE, GL_LINEAR);
            glFogf(GL_FOG_DENSITY, FogDensity);
            glFogfv(GL_FOG_COLOR, FogColor);
        }
    }
    else
    {
        glDisable(GL_FOG);
    }

    GetOpenGLMatrix(CameraMatrix);
- Go to the ZzzScene.cpp file and find the RenderMainScene() function. Replace the following line
PHP Code:
FogEnable = true;
with this line
PHP Code:
FogEnable   = (m_CameraOnOff)?true:false;
If you did everything right, your 3D camera is now almost ready.
When I finish the other edits I can provide them as well.

During this tutorial I modified the code to make it faster. It's not a win.

Is there a code for roller control? I added the keyboard
leorond


Offline animator #13 Posteado: March 15, 2023, 05:44:00 PM

  • 0 puntos por ventas
  • *
  • Rank: Principiante
  • Posts: 16
  • Gracias recibida: 5
  • sk
Did anyone reverse engineered the MUHelper struct? I think the size is 639.

Gracias:


Offline muccone #14 Posteado: March 15, 2023, 08:11:36 PM

  • 0 puntos por ventas
  • *
  • Rank: Dedicado
  • Posts: 35
  • Gracias recibida: 35
  • tw
Did anyone reverse engineered the MUHelper struct? I think the size is 639.


Telegram Account :@mucone    develop Mu

Offline animator #15 Posteado: March 16, 2023, 03:37:00 AM

  • 0 puntos por ventas
  • *
  • Rank: Principiante
  • Posts: 16
  • Gracias recibida: 5
  • sk
Did anyone reverse engineered the MUHelper struct? I think the size is 639.



Well I did not mean some custom struct which is easy to develop on the client and server. I meant the original MUHelper struct from Season 6.


Offline vcore30 #16 Posteado: April 28, 2023, 05:32:48 PM | Modificado: October 27, 2023, 02:58:28 PM by vcore30

  • 0 puntos por ventas
  • *
  • Rank: Destacado
  • Posts: 90
  • Gracias recibida: 710
  • ru
3D Camera for S5.2 Code

Spoiler for Hiden:
Code: [Select]

As promised, I will share with you my work on the 3D camera.

I want to inform you that I am still working on the 3D camera.

Unfinished or in preparation...
1. Damage listing function
2. Complete saving of settings in windows registry
- drawing objects on the map
3. FPS, CPU usage for maximum performance
4. Reworked feature for monster sounds

Here I will add instructions for the 3D camera, which is controlled by the arrow keys and the keys PgUp, PgOn, END

1. defining all variables
- In the ZzzOpenglUtil.cpp file, add the definitions
PHP Code:
//////////////////////////////////////////////////////////////////////////
//  Global Variable.
//////////////////////////////////////////////////////////////////////////
int     OpenglWindowX;     
int     OpenglWindowY;     
int     OpenglWindowWidth;
int     OpenglWindowHeight;
bool    CameraTopViewEnable = false;
float   CameraViewNear      = 20.f;
float   CameraViewFar       = 2000.f;
float   CameraFOV           = 55.f;
// ---- 3D camera ----
float    CameraZoom            = 0.f;
float    AngleX3D            = 0.f;
float    AngleY3D            = 0.f;
float    AngleRL                = 0.f;
// -------------------
vec3_t  CameraPosition;
vec3_t  CameraAngle;
float   CameraMatrix[3][4];
vec3_t  MousePosition;
vec3_t  MouseTarget;
float   g_fCameraCustomDistance = 0.f;
bool    FogEnable   = false;
GLfloat FogDensity  = 0.0004f;
GLfloat FogColor[4] = {30/256.f,20/256.f,10/256.f,};
- In the Winmain.h file, add the definition
PHP Code:
extern char m_ID[];
extern char m_Version[];
extern int  m_SoundOnOff;
extern int  m_MusicOnOff;
// ---- 3D camera ----
extern int    m_CameraOnOff;
// -------------------
extern int  m_Resolution;
extern int m_nColorDepth;
- In the Winmain.cpp file, find the BOOL OpenInitFile() function and add a definition above this function
PHP Code:
char m_ID[11];
char m_Version[11];
char m_ExeVersion[11];
int  m_SoundOnOff;
int  m_MusicOnOff;
// ---- 3D camera ----
int    m_CameraOnOff;
// -------------------
int  m_Resolution;
int    m_nColorDepth;
int    g_iRenderTextType = 0;

#ifdef LJH_ADD_SUPPORTING_MULTI_LANGUAGE
// ´Ů±ąľî Áöżř ·±ĂÄżˇĽ­ Ľ±ĹĂµČ ľđľî
char g_aszMLSelection[MAX_LANGUAGE_NAME_LENGTH] = {'\0'};
string g_strSelectedML = "";
#endif //LJH_ADD_SUPPORTING_MULTI_LANGUAGE

//int ĆÄŔĎ ŔĐ´Â ÇÔĽö
BOOL OpenInitFile()
{
2. Creating a 3D camera launcher using windows registry save
- Go to the BOOL OpenInitFile() function in the Winmain.cpp file and supply the following condition to validate and possibly write to the windows registry
PHP Code:
    m_ID[0] = '\0';
    m_SoundOnOff = 1;
    m_MusicOnOff = 1;
// ---- 3D camera ----
    m_CameraOnOff = 1;
// -------------------
    m_Resolution = 0;
    m_nColorDepth = 0;
PHP Code:
        dwSize = 11;
        if ( RegQueryValueEx (hKey, "ID", 0, NULL, (LPBYTE)m_ID, & dwSize) != ERROR_SUCCESS)
        {
        }
        dwSize = sizeof ( int);
        if ( RegQueryValueEx (hKey, "SoundOnOff", 0, NULL, (LPBYTE) & m_SoundOnOff, &dwSize) != ERROR_SUCCESS)
        {
            m_SoundOnOff = true;
        }
        dwSize = sizeof ( int);
        if ( RegQueryValueEx (hKey, "MusicOnOff", 0, NULL, (LPBYTE) & m_MusicOnOff, &dwSize) != ERROR_SUCCESS)
        {
            m_MusicOnOff = false;
        }
// ---- 3D camera ----
        dwSize = sizeof ( int);
        if ( RegQueryValueEx (hKey, "3DCameraOnOff", 0, NULL, (LPBYTE) & m_CameraOnOff, &dwSize) != ERROR_SUCCESS)
        {
            m_CameraOnOff = false;
        }
// -------------------
        dwSize = sizeof ( int);
        if ( RegQueryValueEx (hKey, "Resolution", 0, NULL, (LPBYTE) & m_Resolution, &dwSize) != ERROR_SUCCESS)
        {
            m_Resolution = 1;
        }
- Now go to the NewUIOptionWindow.h file and define a new public function
PHP Code:
void SetCameraOnOff();
- Then create a new function in the NewUIOptionWindow.cpp file
- This function checks if a setting for the camera exists in the registry and has permission to change the value of that setting
PHP Code:
void SEASON3B::CNewUIOptionWindow::SetCameraOnOff()
{

    HKEY hKey;
    DWORD dwDisp;
    DWORD dwSize;
    dwSize = sizeof ( int);
    if ( ERROR_SUCCESS == RegCreateKeyEx(HKEY_CURRENT_USER, "SOFTWARE\\Webzen\\Mu\\Config", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, & hKey, &dwDisp))
    {
        m_CameraOnOff = !m_CameraOnOff;
        RegSetValueEx(hKey, "3DCameraOnOff", 0, NULL, (LPBYTE) & m_CameraOnOff, dwSize);
    }
    RegCloseKey( hKey);
}
- Go to the Render Buttons() function in the NewUIOption Window.cpp file and create a checkbox for the 3D camera
- My settings save is next to the Effects render settings name
PHP Code:
    // 3D Camera checkbox
    if(m_CameraOnOff)
    {
        RenderImage(IMAGE_OPTION_BTN_CHECK, m_Pos.x+150, m_Pos.y+149, 15, 15, 0, 0);
    }
    else
    {
        RenderImage(IMAGE_OPTION_BTN_CHECK, m_Pos.x+150, m_Pos.y+149, 15, 15, 0, 15.f);
    }
- Go to the RenderContents() function in the NewUIOption Window.cpp file and create a dot before the description and the settings description itself for the 3D camera
PHP Code:
void SEASON3B::CNewUIOptionWindow::RenderContents()
{
    float x, y;
    x = m_Pos.x + 20.f;
    y = m_Pos.y + 46.f;
    RenderImage(IMAGE_OPTION_POINT, x, y, 10.f, 10.f);
    y += 22.f;
    RenderImage(IMAGE_OPTION_POINT, x, y, 10.f, 10.f);
    y += 22.f;
    RenderImage(IMAGE_OPTION_POINT, x, y, 10.f, 10.f);
    y += 40.f;
    RenderImage(IMAGE_OPTION_POINT, x, y, 10.f, 10.f);
    y += 22.f;
    RenderImage(IMAGE_OPTION_POINT, x, y, 10.f, 10.f);
    // 3D Camera
    RenderImage(IMAGE_OPTION_POINT, x+60, y, 10.f, 10.f);
   
    g_pRenderText->SetFont(g_hFont);
    g_pRenderText->SetTextColor(255, 255, 255, 255);
    g_pRenderText->SetBgColor(0);
    // 386 "ŔÚµż °ř°Ý"
    g_pRenderText->RenderText(m_Pos.x+40, m_Pos.y+48, GlobalText[386]);
    // 387 "±Ó¸» ľË¸˛Ŕ˝"
    g_pRenderText->RenderText(m_Pos.x+40, m_Pos.y+70, GlobalText[387]);
    // 389 "şĽ·ýÁ¶Ŕý"
    g_pRenderText->RenderText(m_Pos.x+40, m_Pos.y+92, GlobalText[389]);
    // 919 "˝˝¶óŔĚµĺ µµżň¸»"
    g_pRenderText->RenderText(m_Pos.x+40, m_Pos.y+132, GlobalText[919]);
    // 1840 "+Čż°úÁ¦ÇŃ"
    g_pRenderText->RenderText(m_Pos.x+40, m_Pos.y+154, "+Effect");
    // 3D Camera
    g_pRenderText->RenderText(m_Pos.x+100, m_Pos.y+154, "3D Camera");
}
- Now go to the UpdateMouseEvent() function in the NewUIOption Window.cpp file and create an action when the 3D camera checkbox is checked
PHP Code:
    if(SEASON3B::IsPress(VK_LBUTTON) && CheckMouseIn(m_Pos.x+150, m_Pos.y+127, 15, 15))
    {
        m_bSlideHelp = !m_bSlideHelp;
    }
    // 3D Camera
    if(SEASON3B::IsPress(VK_LBUTTON) && CheckMouseIn(m_Pos.x+150, m_Pos.y+149, 15, 15))
    {
        SetCameraOnOff();
    }
   
    if(CheckMouseIn(m_Pos.x+33-8, m_Pos.y+104, 124+8, 16))
Now we have our startup setup ready and we can get down to the 3D camera itself

3. Creating a 3D camera control
- This control setting is contained in the ZzzScene.cpp file and can be customized to your liking.
I chose keyboard control for the player's convenience.

- Go to the ZzzScene.cpp file in the MoveMainCamera() function and add the settings for the 3D camera.
- Edit the first condition of the function as follows.
PHP Code:
    if (
#ifdef PJH_NEW_SERVER_SELECT_MAP
        World == WD_73NEW_LOGIN_SCENE
#else
        World == 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 (World == WD_74NEW_CHARACTER_SCENE || World == WD_73NEW_LOGIN_SCENE) // Fix for opening scene and character selection
        {
            CameraZoom = 0;
            AngleY3D = 0;
        }
        CameraFOV = 35.f + CameraZoom;
        if( !g_pUIManager->IsInputEnable())
        {
            if (m_CameraOnOff == 1)
            {
                if(HIBYTE(GetAsyncKeyState(109))==128 || HIBYTE(GetAsyncKeyState(VK_PRIOR))==128) // PAGE UP or +
                {
                    if (CameraZoom < 12) CameraZoom += 2;
                }
                if(HIBYTE(GetAsyncKeyState(107))==128 || HIBYTE(GetAsyncKeyState(VK_NEXT))==128) // PAGE DOWN or -
                {
                    if (CameraZoom > -12) CameraZoom -= 2;
                }
                if(HIBYTE(GetAsyncKeyState(VK_RIGHT))==128) // RIGHT ARROW
                    CameraAngle[2] -= 4;
                if(HIBYTE(GetAsyncKeyState(VK_LEFT))==128) // LEFT ARROW
                    CameraAngle[2] += 4;
               
                if(HIBYTE(GetAsyncKeyState(VK_DOWN))==128) // DOWN ARROW
                    if (AngleY3D < 5) AngleY3D += 1;
                if(HIBYTE(GetAsyncKeyState(VK_UP))==128) // UP ARROW
                    if (AngleY3D > -10) AngleY3D -= 1;
                if(HIBYTE(GetAsyncKeyState(VK_END))==128) // END keys for reset 3D camera
                {
                    CameraZoom = 0;
                    CameraAngle[2] = -45.f;
                    AngleY3D = 0;
                }
            }
            else {
                CameraZoom = 0;
                CameraAngle[2] = -45.f;
                AngleY3D = 0;
            }
        }
    }
- In the same function, go to this condition and edit as follows
PHP Code:
        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;
            if (m_CameraOnOff == 1)
            {
                CameraAngle[0] += AngleY3D;
            }
        }
#endif
- At the end of this function, add the following condition before return bLockCamera;
PHP Code:
    // Field of vision
    if (m_CameraOnOff == 1)
    {
        if (CameraZoom > 0)
            CameraViewFar += 458.33f + (458.33f * CameraZoom);
        else
            CameraViewFar += 1458.33f;
    }
- Go to the MoveMainScene() function and modify this condition. Thus...
PHP Code:
    if(!CameraTopViewEnable
        || m_CameraOnOff == 1    // <= 3D Camera
#ifdef LDS_FIX_DISABLE_INPUTJUNKKEY_WHEN_LORENMARKT
#ifdef LDS_FIX_DISABLE_INPUTJUNKKEY_WHEN_LORENMARKT_EX01    // °řĽşŔü, ĹëÇŐ˝ĂŔĺŔş Ľ­ąö ·Îµů˝Ă°ŁŔĚ ±ćľî ·ÎµůÁß Ĺ°ŔÔ·Â şí·°.
        && ( g_bReponsedMoveMapFromServer == TRUE )        // Ĺ°ŔÔ·Â ¸·±â : Ľ­ąö·ÎşÎĹÍ ·Îµů żůµĺ ŔŔ´äŔĚ ľČżÂ °ćżě¸¸.
#else // LDS_FIX_DISABLE_INPUTJUNKKEY_WHEN_LORENMARKT_EX01
        && LoadingWorld < 30
#endif // LDS_FIX_DISABLE_INPUTJUNKKEY_WHEN_LORENMARKT_EX01
#endif // LDS_FIX_DISABLE_INPUTJUNKKEY_WHEN_LORENMARKT
        )
    {
#ifdef MOD_MOUSE_Y_CLICK_AREA
        if(GFxProcess::GetInstancePtr()->GetUISelect() == 1)
        {
            if(MouseY>=(int)(480))
                MouseOnWindow = true;
        }
        else
        {
            if(MouseY>=(int)(480-48))
                MouseOnWindow = true;
        }
#else //MOD_MOUSE_Y_CLICK_AREA
        if(MouseY>=(int)(480-48))
            MouseOnWindow = true;
#endif //MOD_MOUSE_Y_CLICK_AREA

        g_pPartyManager->Update();
        g_pNewUISystem->Update();
       
        // Ŕ©µµżě ľĆ´Ń°÷ Ŭ¸Ż˝Ă
        if (MouseLButton == true
            && false == g_pNewUISystem->CheckMouseUse() /* NewUIżë ¸¶żě˝ş ĂĽĹ© */
            && g_dwMouseUseUIID == 0 /* ±âÁ¸ŔÇ UI ¸¶żě˝ş ĂĽĹ© ŔüżŞ şŻĽö */
            && 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);
            }
        }
#ifdef _PVP_ADD_MOVE_SCROLL
        g_MurdererMove.MurdererMoveCheck();
#endif    // _PVP_ADD_MOVE_SCROLL
       
        MoveInterface();
        MoveTournamentInterface();
        if( ErrorMessage != MESSAGE_LOG_OUT )
            g_pUIManager->UpdateInput();
    }
- Go to the next condition in the MoveMainScene() function and edit that condition. Thus...
PHP Code:
    if(!CameraTopViewEnable
        || m_CameraOnOff == 1) // <= 3D Camera
        MoveItems();
    if ( ( World==WD_0LORENCIA && HeroTile!=4 ) ||
         ( World==WD_2DEVIAS && HeroTile!=3 && HeroTile<10 )
         || World==WD_3NORIA
         || World==WD_7ATLANSE
         || InDevilSquare() == true
         || World==WD_10HEAVEN
         || InChaosCastle()==true
         || battleCastle::InBattleCastle()==true
         || M31HuntingGround::IsInHuntingGround()==true
         || M33Aida::IsInAida()==true
         || M34CryWolf1st::IsCyrWolf1st()==true
        || World == WD_42CHANGEUP3RD_2ND
#ifdef CSK_ADD_MAP_ICECITY
        || IsIceCity()
#endif // CSK_ADD_MAP_ICECITY
#ifdef YDG_ADD_MAP_SANTA_TOWN
        || IsSantaTown()
#endif    // YDG_ADD_MAP_SANTA_TOWN
#ifdef PBG_ADD_PKFIELD
        || IsPKField()
#endif //PBG_ADD_PKFIELD
#ifdef YDG_ADD_MAP_DOPPELGANGER2
        || IsDoppelGanger2()
#endif    // YDG_ADD_MAP_DOPPELGANGER2
#ifdef LDS_ADD_EMPIRE_GUARDIAN
        || IsEmpireGuardian1()
        || IsEmpireGuardian2()
        || IsEmpireGuardian3()
        || IsEmpireGuardian4()
#endif //LDS_ADD_EMPIRE_GUARDIAN
#ifdef LDS_ADD_MAP_UNITEDMARKETPLACE
        || IsUnitedMarketPlace()
#endif    // LDS_ADD_MAP_UNITEDMARKETPLACE
     )
    {
        MoveLeaves();
    }
- Go to the next condition in the RenderMainScene() function and edit that condition. Thus...
PHP Code:
    BYTE byWaterMap = 0;

    if(CameraTopViewEnable == false
        || m_CameraOnOff == 1) // 3D Camera
    {
#ifdef MOD_MAINSCENE_HEIGHT
        Height = 480;
#else //MOD_MAINSCENE_HEIGHT
        Height = 480-48;
#endif //MOD_MAINSCENE_HEIGHT
    }
    else
    {
        Height = 480;
    }
- And the last condition in this file in the RenderMainScene() function modify this condition. Thus...
PHP Code:
    RenderCharactersClient();   //  Äł¸ŻĹÍ ą¦»ç.

    if(EditFlag!=EDIT_NONE)     //  żˇµđĹÍżˇĽ­¸¸ Ăł¸®.
    {
        RenderTerrain(true);
    }
    if(!CameraTopViewEnable
        || m_CameraOnOff == 1)    // <=  3D Camera
         RenderItems();
3. Problem with rotating figure and head when moving the cursor.
Webzen did not expect that someone would create a 3D camera. Because of this, an abnormality will appear when the camera is turned to the right or left side.
- Go to the ZzzInterface.cpp file and find the MoveHero() function. Modify the following condition as follows.
PHP Code:
    //  ! ¸¶żě˝ş µű¶óĽ­ Äł¸ŻĹÍŔÇ Č¸Ŕü °˘µµ¸¦ şŻ°ćÇŃ´Ů.
    if( g_isCharacterBuff(o, eDeBuff_Stun)
        || g_isCharacterBuff(o, eDeBuff_Sleep)
#ifdef WORLDCUP_ADD
        || o->CurrentAction == PLAYER_POINT_DANCE
#endif //WORLDCUP_ADD
#ifdef PBG_ADD_NEWCHAR_MONK_SKILL
        || o->CurrentAction == PLAYER_SKILL_GIANTSWING
#endif //PBG_ADD_NEWCHAR_MONK_SKILL
            )
    {
        Angle = (int)Hero->Object.Angle[2];
        bLookAtMouse = false;
    }
    else
    {
        if (m_CameraOnOff == 1)
            Angle = (int)(Hero->Object.Angle[2]+CreateAngle((float)HeroX,(float)HeroY,(float)MouseX,(float)MouseY)) + 360 + CameraAngle[2];
        else
            Angle = (int)(Hero->Object.Angle[2]+CreateAngle((float)HeroX,(float)HeroY,(float)MouseX,(float)MouseY)) + 360 - 45;

        Angle %= 360;
        if(Angle < 120) Angle = 120;
        if(Angle > 240) Angle = 240;
        Angle += 180;
        Angle %= 360;
    }
       
    Hero->Object.HeadTargetAngle[2] = 0.f;
- Find another condition and edit it like this
PHP Code:
        if(StandTime >= 40 && !MouseOnWindow && !Hero->Dead &&
            o->CurrentAction!=PLAYER_POSE1 && o->CurrentAction!=PLAYER_POSE_FEMALE1 &&
            o->CurrentAction!=PLAYER_SIT1  && o->CurrentAction!=PLAYER_SIT_FEMALE1 && NoAutoAttacking &&
            o->CurrentAction!=PLAYER_ATTACK_TELEPORT &&
            o->CurrentAction!=PLAYER_ATTACK_RIDE_TELEPORT &&
            o->CurrentAction != PLAYER_FENRIR_ATTACK_DARKLORD_TELEPORT &&
#ifdef PBG_ADD_NEWCHAR_MONK_SKILL
            o->CurrentAction != PLAYER_SKILL_ATT_UP_OURFORCES &&
            o->CurrentAction != PLAYER_SKILL_HP_UP_OURFORCES &&
#endif //PBG_ADD_NEWCHAR_MONK_SKILL
            Hero->AttackTime == 0)
        {
            StandTime = 0;
            if (m_CameraOnOff == 1)
                HeroAngle = -(int)(CameraAngle[2]+CreateAngle((float)MouseX,(float)MouseY,(float)HeroX,(float)HeroY)) + 360;
            else
                HeroAngle = -(int)(CreateAngle((float)MouseX,(float)MouseY,(float)HeroX,(float)HeroY)) + 360 + 45;

            HeroAngle %= 360;
            BYTE Angle1 = ((BYTE)((o->Angle[2]+22.5f)/360.f*8.f+1.f)%8);
            BYTE Angle2 = ((BYTE)(((float)HeroAngle+22.5f)/360.f*8.f+1.f)%8);
            if(Angle1 != Angle2)
            {
                if ( o->CurrentAction!=PLAYER_ATTACK_SKILL_SWORD2 )
                {
                    Hero->Object.Angle[2] = (float)HeroAngle;
                }
                SendRequestAction(AT_STAND1,((BYTE)((HeroAngle+22.5f)/360.f*8.f+1.f)%8));
            }
        }
Now, even when moving sideways, the figure and head will rotate behind the cursor.

4. The distance of drawing objects from the character
- Go to the ZzzLodTerrain.cpp file and find the function bool TestFrustrum2D(float x,float y,float Range). Edit it as follows.
PHP Code:
bool TestFrustrum2D(float x,float y,float Range)
{
    if ( SceneFlag == SERVER_LIST_SCENE || SceneFlag == WEBZEN_SCENE || SceneFlag == LOADING_SCENE)
        return true;

    int j = 3;
    for(int i=0;i<4;j=i,i++)
    {
        if (m_CameraOnOff == 1)   
        {
            if (CameraZoom > 0)
                Range -= ((50.f/2.5f) * CameraZoom);//Range -= 600.f;
            else
                Range -= 50.f;

            if (AngleY3D < 0)
                Range += 15.f * AngleY3D;
        }

        if((FrustrumX[i]-x) * (FrustrumY[j]-y) - (FrustrumX[j]-x) * (FrustrumY[i]-y) <= Range)
        {
            return false;
        }
    }
    return true;
}
- Then find the function bool bool TestFrustrum(vec3_t Position,float Range). Edit it as follows.
PHP Code:
bool TestFrustrum(vec3_t Position,float Range)
{
    for(int i=0;i<5;i++)
    {
        float Value;
        if (m_CameraOnOff == 1)
        {
            if (CameraZoom > 0)
                Range += 0.f + ((41.66f/2.5f) * CameraZoom);//Range += 500.f;
            else
                Range += 41.66f;
        }
        Value = FrustrumFaceD[i] + DotProduct(Position,FrustrumFaceNormal[i]);
        if(Value < -(Range)) return false;
    }
    return true;
}

[BONUS]
5. Fog around field of vision.
Another problem is rendering objects while walking. Objects just disappear and it looks ugly. This problem can also be solved.

- Go to the ZzzOpenglUtil.cpp file and find the void BeginOpengl(int x,int y,int Width,int Height ) function. Adjust the fog condition as follows.
PHP Code:
    glDisable(GL_ALPHA_TEST);
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_CULL_FACE);
       glDepthMask(true);
    AlphaTestEnable = false;
    TextureEnable   = true;
    DepthTestEnable = true;
    CullFaceEnable  = true;
    DepthMaskEnable = true;
    glDepthFunc(GL_LEQUAL);
    glAlphaFunc(GL_GREATER,0.25f);

    if(FogEnable)
    {
        if (m_CameraOnOff == 1)
        {
            glEnable(GL_FOG);
            glFogf( GL_FOG_MODE, GL_LINEAR );
            glFogf(GL_FOG_START, 2000.f);
            glFogf(GL_FOG_END, 2700.f);

            glFogf(GL_FOG_DENSITY, FogDensity);
            float color[] = {10/256.f,10/256.f,10/256.f,5.0};
            glFogfv(GL_FOG_COLOR, color);
        }
        else
        {
            glEnable(GL_FOG);
            glFogi(GL_FOG_MODE, GL_LINEAR);
            glFogf(GL_FOG_DENSITY, FogDensity);
            glFogfv(GL_FOG_COLOR, FogColor);
        }
    }
    else
    {
        glDisable(GL_FOG);
    }

    GetOpenGLMatrix(CameraMatrix);
- Go to the ZzzScene.cpp file and find the RenderMainScene() function. Replace the following line
PHP Code:
FogEnable = true;
with this line
PHP Code:
FogEnable   = (m_CameraOnOff)?true:false;
If you did everything right, your 3D camera is now almost ready.
When I finish the other edits I can provide them as well.

During this tutorial I modified the code to make it faster. It's not a win.


leorond


How to make the fog cover the black background?


Offline neuda #17 Posteado: May 28, 2023, 11:58:33 PM

  • 0 puntos por ventas
  • *
  • Rank: Principiante
  • Posts: 9
  • Gracias recibida: 8
  • ua
How i can added Muhelper in 1.02.19 main? Who can help me? please


Offline vcore30 #18 Posteado: October 27, 2023, 03:01:41 PM

  • 0 puntos por ventas
  • *
  • Rank: Destacado
  • Posts: 90
  • Gracias recibida: 710
  • ru
Hello. If anyone has it, share with class COptionButtonGroup.


Offline hoanmaster #19 Posteado: October 28, 2023, 10:35:08 AM

  • 0 puntos por ventas
  • *
  • Rank: Principiante
  • Posts: 26
  • Gracias recibida: 17
  • vn
Hello. If anyone has it, share with class COptionButtonGroup.
can you share ??  aplausos


Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate


 

Related Topics

  Subject / Started by Replies Last post
8 Replies
1616 Views
Last post July 18, 2020, 11:51:10 AM
by LeeHenry
27 Replies
4278 Views
Last post October 10, 2020, 09:39:44 PM
by Heitaok77
33 Replies
4652 Views
Last post November 14, 2021, 03:43:48 PM
by jorge2016
0 Replies
214 Views
Last post November 10, 2023, 03:47:48 AM
by wellihard
6 Replies
2417 Views
Last post February 06, 2024, 09:48:48 PM
by Bladimir1