My camera option

Results 1 to 14 of 14
  1. #1
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    My camera option

    So I wanted to see if I could make my own camera option, turned out to be pretty easy, and since I don't see a lot of servers with it, I figured i'd release it (I'm sure it's not the cleanest code you guys have seen, it's probably downright shitty looking, but it gets the job done. Also, updatedist is a optional function for resetting the distance in game, i won't post it because it's simple to create. a function with one line of code in it)


    Step 1:Open ZCOnfiguration.cpp.

    search for this:
    childElement.GetChildContents(&m_Etc.nCrossHair, ZTOK_ETC_CROSSHAIR);
    Add this below it :
    childElement.GetChildContents(&m_Etc.nCameraDistance, ZTOK_ETC_CAMERA);
    Step 2:
    search for this :
    parentElement.AppendText("\n\t\t");
    aElement = parentElement.CreateChildElement(ZTOK_ETC_CROSSHAIR);
    sprintf(temp, "%d", m_Etc.nCrossHair);
    aElement.SetContents(temp);
    Under it, add this:
    //Camera Distance
    parentElement.AppendText("\n\t\t");
    aElement = parentElement.CreateChildElement(ZTOK_ETC_CAMERA);
    sprintf(temp, "%d", m_Etc.nCameraDistance);
    aElement.SetContents(temp);
    Step 3:
    Search for this :
    m_Etc.nCrossHair = 0;
    Under it, add this: m_Etc.nCameraDistance = 290.f; // 290.f = default value
    Step 4: Open ZConfiguration.h
    Search for this int nCrossHair;
    under it, add this:
    int nCameraDistance;
    step 5:
    Search for this :
    #define ZTOK_ETC_CROSSHAIR "CROSSHAIR"
    under it, add this:
    #define ZTOK_ETC_CAMERA "CAMERA"
    Step 6:
    search for this:
    #define Z_ETC_CROSSHAIR (ZGetConfiguration()->GetEtc()->nCrossHair)
    under it, add this:
    #define Z_ETC_CAMERA (ZGetConfiguration()->GetEtc()->nCameraDistance)
    Step 7:Open ZOptionInterface.cpp
    At the top add this under #include "ZInterfaceListener.h":
    #include "ZCamera.h"
    Step 8:
    Search for this:
    ZCanvas* pCrossHairPreview = (ZCanvas*)pResource->FindWidget("CrossHairPreviewCanvas");
    if (pCrossHairPreview)
    {
    pCrossHairPreview->SetOnDrawCallback(ZCrossHair::OnDrawOptionCrossHairPreview);
    }
    Under it, add this:
    pComboBox = (MComboBox*)pResource->FindWidget("CameraDistance");
    if (pComboBox)
    {
    pComboBox->SetSelIndex(Z_ETC_CAMERA);
    ZGetCamera()->RSetCameraDistance(Z_ETC_CAMERA);
    }
    Step 9:
    search for this:
    MComboBox* pComboBox = (MComboBox*)pResource->FindWidget("CrossHairComboBox");
    if (pComboBox)
    {
    Z_ETC_CROSSHAIR = pComboBox->GetSelIndex();
    }

    Under it, add this:

    pComboBox = (MComboBox*)pResource->FindWidget("CameraDistance");
    if (pComboBox)
    {
    Z_ETC_CAMERA = pComboBox->GetSelIndex ();
    ZGetCamera()->RSetCameraDistance(Z_ETC_CAMERA);
    ZGetCamera()->UpdateDist();
    }
    Step 10: Open ZCamera.h
    under this:
    void StopShock();
    Add this:
    void RSetCameraDistance(unsigned short nCameraDistance = 0.f);
    Step 11:Open ZCamera.cpp
    At the top, under CAMERA_WALL_TRACKSPEED, add this:
    unsigned short g_nCameraDistance = 0.f;
    Step 12:
    Search for ZCamera::Init(), above it, add this:

    void ZCamera::RSetCameraDistance(unsigned short nCameraDistance)
    {
    switch (nCameraDistance)
    {
    case 0: { g_nCameraDistance = 290.f; } break;
    case 1: { g_nCameraDistance = 390.f; } break;
    case 2: { g_nCameraDistance = 490.f; } break;
    case 3: { g_nCameraDistance = 590.f; } break;
    case 4: { g_nCameraDistance = 690.f; } break;
    case 5: { g_nCameraDistance = 790.f; } break;
    case 6: { g_nCameraDistance = 890.f; } break;
    case 7: { g_nCameraDistance = 990.f; } break;
    default:{ g_nCameraDistance = 290.f; } break;
    }
    }
    Step 13:
    Inside, ZCamera::Init(), near the top, replace m_fdist and m_fcurrantdist with this:

    m_fDist = g_nCameraDistance;
    m_fCurrentDist = g_nCameraDistance;
    Step 14:

    Add this to your option.xml(note, change the optiongroup to whatever you want):
    <LABEL item="Label" parent="VideoOptionGroup2">
    <FONT>FONTa9</FONT>
    <TEXTCOLOR>
    <R>205</R>
    <G>205</G>
    <B>205</B>
    </TEXTCOLOR>
    <BOUNDS>
    <X>2</X>
    <Y>240</Y>
    <W>300</W>
    <H>24</H>
    </BOUNDS>
    <TEXT>CameraDistance</TEXT> <!-- 1초당 프레임 제한 -->
    </LABEL>
    <COMBOBOX item="CameraDistance" parent="VideoOptionGroup">
    <LISTBOXLOOK>CustomListBoxLook</LISTBOXLOOK>
    <BUTTONLOOK>ListBoxButtonLook</BUTTONLOOK>
    <FONT>FONTa9</FONT>
    <TEXTCOLOR>
    <R>205</R>
    <G>205</G>
    <B>205</B>
    </TEXTCOLOR>
    <TEXTALIGN>
    <VALIGN>center</VALIGN>
    <HALIGN>left</HALIGN>
    </TEXTALIGN>
    <BOUNDS>
    <X>105</X>
    <Y>240</Y>
    <W>90</W>
    <H>24</H>
    </BOUNDS>
    <ALIGN>
    <HALIGN>right</HALIGN>
    </ALIGN>
    <LISTITEM selected="true">Default</LISTITEM>
    <LISTITEM>390</LISTITEM>
    <LISTITEM>490</LISTITEM>
    <LISTITEM>590</LISTITEM>
    <LISTITEM>690</LISTITEM>
    <LISTITEM>790</LISTITEM>
    <LISTITEM>890</LISTITEM>
    <LISTITEM>990</LISTITEM>
    <DROPSIZE>80</DROPSIZE>
    <COMBOTYPE>1</COMBOTYPE>
    </COMBOBOX>
    If this was already release I apologize, I didnt see it though :) if you guys have any questionsor problems let me know.
    Last edited by jetman82; 31-10-14 at 05:31 AM.


  2. #2
    Pandora imback is offline
    MemberRank
    Dec 2011 Join Date
    408Posts

    Re: My camera option

    in Step 7.
    There is no #include "ZInterfaceListener.h":

  3. #3
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Re: My camera option

    Oh really? Must have added something else to my source, i have a hard time remembering everything i've added. Just put it under w/e the last #include file is of course.

  4. #4
    Pandora imback is offline
    MemberRank
    Dec 2011 Join Date
    408Posts

    Re: My camera option

    i got this problem when i try to build for.
    3 IntelliSense: class "ZCONFIG_ETC" has no member "nCameraDistance" d:\1-2-3\Source\Source\Gunz\ZOptionInterface.cpp 455 26 Gunz
    7 IntelliSense: class "ZCamera" has no member "UpdateDist" d:\1-2-3\Source\Source\Gunz\ZOptionInterface.cpp 900 17 Gunz
    Error 2 error C2039: 'UpdateDist' : is not a member of 'ZCamera' D:\1-2-3\Source\Source\Gunz\ZOptionInterface.cpp 900 1 Gunz

  5. #5
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Re: My camera option

    I said in the beginning paragraph that updatedist is optional code, you have to do that part yourself, just remove updatedist from that line. And the first error is because you didn't add int nCameraDistance in ZCONFIG_ETC.

  6. #6
    Account Upgraded | Title Enabled! Arenbunny is offline
    MemberRank
    Mar 2013 Join Date
    Peru - AyacuchoLocation
    273Posts

    Re: My camera option

    Quote Originally Posted by imback View Post
    i got this problem when i try to build for.
    bother to comment and you're very good, but I'm sure you know nothing about nothing gunz, not that you get trouble.

  7. #7
    I am THE DON Joe9099 is offline
    MemberRank
    Jan 2007 Join Date
    England, UkLocation
    3,655Posts

    Re: My camera option

    Am i being dumb or is this just another saying for FOV distance?

  8. #8
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Re: My camera option

    fov and camera are 2 totally different things. your default fov is 70/180 * pi, your default camera distance is 290.f. when you change your camera you aren't changing the field of view, doing the field of view can make the game look like quake, doing the camera just lets you zoom in/out, doesn't affect FOV.

    For example, look at franscescos fov add-on, and then compare it to this image:

    http://prntscr.com/51mjuf

    The camera is zoomed out, but the field of view value remains the same, so you don't get that long view distance that you would if you toyed with the fov.

    I've had a couple people ask me how i did the updatedist function, i guess i'll post it, it's very simple.

    Step 1:

    Open ZCamera.h, search for void setnextlookmode, add this under it:

    void UpdateDist();

    Step 2:, open ZCamera.cpp, at the bottom of the cpp, add this:

    void ZCamera::UpdateDist()
    {
    m_fDist = g_nCameraDistance;
    }

    What this does is when you change the game option in game, it'll update the camera rather than requiring you to rejoin the room.
    Last edited by jetman82; 31-10-14 at 04:38 PM.

  9. #9
    Account Upgraded | Title Enabled! Arenbunny is offline
    MemberRank
    Mar 2013 Join Date
    Peru - AyacuchoLocation
    273Posts

    Re: My camera option

    Quote Originally Posted by Joe9099 View Post
    Am i being dumb or is this just another saying for FOV distance?
    it's same! FOV CAM no diference

  10. #10
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Re: My camera option

    Actually you're totally wrong on that one, the fov can affect the distance at which you view your character, but it causes issues with the view distance looking distorted, this zooms the camera out and leaves the fov value alone. Search the source yourself, they're 2 different things.

    Think of FOV being your ability to see left/right/up/down *like with your eyes, humans have a fov of around 135 degrees), camera distance is simply how close the camera is to your character, it doesn't affect the field of view in the slightest. *think of the camera as binoculars, they zoom in your view distance, and if you remove them, your view distance goes back to normal*
    Last edited by jetman82; 31-10-14 at 07:25 PM.

  11. #11
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Re: My camera option

    Quote Originally Posted by Orby View Post
    Help @jetman82 this error appears.

    Reread my first post, you missed adding the functions in zcamera.h and zcamera.cpp

  12. #12
    Orby? Orby ? @-@ Orby is offline
    MemberRank
    Oct 2015 Join Date
    AstraLocation
    278Posts

    Re: My camera option

    Thank you @jetman82 worked perfectly

  13. #13
    Member diguhey is offline
    MemberRank
    Jun 2015 Join Date
    87Posts

    Re: My camera option

    thanks
    Last edited by diguhey; 20-06-16 at 09:49 AM.

  14. #14
    Proficient Member kryst4l is offline
    MemberRank
    Sep 2016 Join Date
    150Posts

    Re: My camera option

    best tut release very thanks



Advertisement