1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[RenderEdge] Graphic modification for Warcraft III

Discussion in 'Warcraft Editing Tools' started by ENAleksey, Sep 20, 2016.

  1. aple

    aple

    Joined:
    May 20, 2009
    Messages:
    807
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    Running the Sample Map works totally fine, but when I try saving it the map becomes unplayable. What exact version of AdicHelper and JNGP are you using? Maybe something about the combination of versions I have corrupts the map to the point WC3 can't read it properly.

    I do have all JassHelper/vJass options in JNGP turned off, as well, as I figure that would probably mess with things.

    And I think I am also using the Experimental version as oppose to the Basic version. Maybe I should try using the Basic version and see if that fixes anything.

    EDIT: Switching to the Basic version does not fix it. All the sample maps (Experimental and Sample) work totally fine on the Experimental version without saving the map anyway, so I have no idea why using the Basic version would make it work or not.
     
    Last edited: Jul 3, 2017
  2. ENAleksey

    ENAleksey

    Joined:
    Nov 29, 2014
    Messages:
    189
    Resources:
    1
    Tools:
    1
    Resources:
    1
    You need to use the Basic version because there are no these natives in Experimental version.
    Also you shouldn't have turned JassHelper/vJass off. So you will have something like this:
    Снимок.PNG Снимок2.PNG
    You can also download this version of JNGP, it already contain Adic Helper and RenderEdge menu, so you can test map from World Edit:
    [RenderEdge] Experimental version
     
  3. aple

    aple

    Joined:
    May 20, 2009
    Messages:
    807
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    That's definitely not the version of AdicHelper I found. I turned off JassHelper/vJass before because it would give me an error when I tried to save it. It's not doing that anymore. I can now boot the map up from in-game after saving over it, though via test map does not work for some reason. But that's still good enough for me, I think.
     
  4. ENAleksey

    ENAleksey

    Joined:
    Nov 29, 2014
    Messages:
    189
    Resources:
    1
    Tools:
    1
    Resources:
    1

    Update 0.2.2a


    • Updated Direct3D8 calls interceptor;
    • Added new native function IsGamePaused;
    • Added new native function SetBlackBorders;
    • Updated Jass API, fixed some bugs with custom natives;
    • Fixed native functions that take boolean arguments;
    • Fixed re-adding triggers by TriggerRegister#Event functions after map restart;
    • EnableVsync function now works without the need to minimize the game;
    • Fixed an issue where new GUI elements did not have default green texture;
    • Improved debug log. The log file is cleared if the size has exceeded 100 KB.
    Now you can change the black borders dynamically:
    native SetBlackBorders takes real upper, real bottom returns nothing

    Set
    upper = 0.0
    and
    bottom = 0.0
    to hide black borders. By default
    upper = -0.02
    ,
    bottom = 0.13
    :

    war3 2017-07-06 20-42-05-34.png war3 2017-07-06 20-42-07-17.png
     
    Last edited: Jul 7, 2017
  5. aple

    aple

    Joined:
    May 20, 2009
    Messages:
    807
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    Oh, woah. That can be useful. The only thing really missing now is to be able to dynamically change the UI I think. (I think it's already possible to remove it right?)
     
  6. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,668
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    I managed to modify the UI elements recently.

    Accessing memory from the script - it's time of the revolution
     
  7. ENAleksey

    ENAleksey

    Joined:
    Nov 29, 2014
    Messages:
    189
    Resources:
    1
    Tools:
    1
    Resources:
    1
    Yes, yesterday I found a way to dynamically change any UI element. Here is an example with removed standard interface, which is replaced with my own, and a modified minimap:

    war3 2017-07-07 19-14-00-73.png

    Now I'm working on modifying the standard interface for any screen resolution:

    war3 2017-07-07 19-17-14-23.png war3 2017-07-07 19-29-33-71.png

    Next, I plan to move the entire UI to the left side of the screen, and then align to center.

    Can you change them dynamically?
     
    Last edited: Jul 7, 2017
  8. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,668
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    I haven't tried while in-game, just when hooked. I also need to update my addresses for the new patch, but I haven't had a need for it yet.

    It was sort of hacky though, because I identified which UI element was being passed by checking the X/Y parameters, then modifying it from there. You can change position and scale IIRC.

    Internally the game multiple classes related to frame positions. I forget the exact names but they are along the lines of FramePosAbsolute & FramePosRelative. So I assume there are various ways to position things.
     
  9. ENAleksey

    ENAleksey

    Joined:
    Nov 29, 2014
    Messages:
    189
    Resources:
    1
    Tools:
    1
    Resources:
    1
    Hooking of the function will not allow to dynamically change the interface. To do this you need to call this function:
    Code (C++):
    address_CtrlSetPosition = address_GameBase + 0x606770; // 1.26a
    void War3CtrlSetPosition(int pParentFrame, POINT point, int pFrame, POINT relativePoint, float xoffset, float yoffset)
    {
        fast_call<void**>(address_CtrlSetPosition, pParentFrame, 0, point, pFrame, relativePoint, xoffset, yoffset, 1);
    }

    void War3CtrlSetWidth(int pCtrl, float width)
    {
        fast_call<void**>(address_CtrlSetWidth, pCtrl, 0, width);
    }

    void War3CtrlSetHeight(int pCtrl, float height)
    {
        fast_call<void**>(address_CtrlSetHeight, pCtrl, 0, height);
    }
     
    But first you need to get a pair of pointers to the desired element in game.dll, for example, this is how to change the black borders:

    Снимок.PNG
    Code (C++):
    void SetBlackBorders(float upper, float bottom)
    {
        uint gameui = GetGameUI(0, 0);
        War3CtrlSetPosition(*((DWORD*)gameui + 239) + 180, 2, gameui + 180, 2, 0.0f, upper);
        War3CtrlSetPosition(*((DWORD*)gameui + 239) + 180, 6, gameui + 180, 6, 0.0f, bottom);
    }

    // And there are some other functions to change standard interface

    void SetMinimap(float x, float y, float size)
    {
        uint gameui = GetGameUI(0, 0);
        War3CtrlSetPosition(*((DWORD*)gameui + 240) + 180, 6, *((DWORD*)gameui + 263) + 180, 6, x, 0.6f - y - size * fWideScreenMul);
        War3CtrlSetPosition(*((DWORD*)gameui + 240) + 180, 2, *((DWORD*)gameui + 263) + 180, 6, x + size, 0.6f - y);
    }

    void SetPortrait(float x, float y, float size)
    {
        uint gameui = GetGameUI(0, 0);
        War3CtrlSetWidth(*((DWORD*)gameui + 253) + 180, size);
        War3CtrlSetHeight(*((DWORD*)gameui + 253) + 180, size * fWideScreenMul);
        War3CtrlSetPosition(*((DWORD*)gameui + 253) + 180, 6, *((DWORD*)gameui + 265) + 180, 6, x, 0.6f - y - size * fWideScreenMul);
    }
     
    Last edited: Jul 7, 2017
  10. MindWorX

    MindWorX

    Joined:
    Aug 3, 2004
    Messages:
    690
    Resources:
    5
    Tools:
    1
    Tutorials:
    4
    Resources:
    5
    I've mapped several elements if you're interested, I'll see if I have any uncommitted findings. If you have any additional findings, that would be great.

    Do you have any idea what the constants between the elements are for? They look like enums. Compare the function with the framedef files.
    Code (Text):
    SetPoint TOPLEFT, "AllianceDialog", TOPLEFT, 0.03375, -0.03,
    You can see the arguments are the same order. We just need a way to figure out what the different numbers are.
     
  11. ENAleksey

    ENAleksey

    Joined:
    Nov 29, 2014
    Messages:
    189
    Resources:
    1
    Tools:
    1
    Resources:
    1
    Edit:
    Maybe it will be useful?
    Region/SetPoint - World of Warcraft Programming: A Guide and Reference for Creating WoW Addons

    Edit2:
    Done!
    Code (C++):
    enum FRAMEPOINT
    {
        TOPLEFT = 0,
        TOP = 1,
        TOPRIGHT = 2,
        LEFT = 3,
        CENTER = 4,
        RIGHT = 5,
        BOTTOMLEFT = 6,
        BOTTOM = 7,
        BOTTOMRIGHT = 8
    };

    address_SetFramePoint = address_GameBase + 0x606770;
    void SetFramePoint(int32 pFrame, FRAMEPOINT point, int32 pParentFrame, FRAMEPOINT relativePoint, float offsetX, float offsetY)
    {
        fast_call<void**>(address_SetFramePoint, pFrame, 0, point, pParentFrame, relativePoint, offsetX, offsetY, 1);
    }

    address_SetFrameWidth = address_GameBase + 0x605D90;
    void SetFrameWidth(int32 pFrame, float width)
    {
        fast_call<void**>(address_SetFrameWidth, pFrame, 0, width);
    }

    address_SetFrameHeight = address_GameBase + 0x605DB0;
    void SetFrameHeight(int32 pFrame, float height)
    {
        fast_call<void**>(address_SetFrameHeight, pFrame, 0, height);
    }
     
    Last edited: Jul 8, 2017
  12. RollBoat

    RollBoat

    Joined:
    Jun 21, 2011
    Messages:
    238
    Resources:
    1
    Skins:
    1
    Resources:
    1
    will this modification be able to increase maps CameraBounds ,canvas size above 480x480?Is it even possible?Just asking!
     
  13. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,668
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    As far as I know, 480x480 is an internal limit that cannot be bypassed without some serious modifications to the game (which are unknown).
     
  14. MindWorX

    MindWorX

    Joined:
    Aug 3, 2004
    Messages:
    690
    Resources:
    5
    Tools:
    1
    Tutorials:
    4
    Resources:
    5
    That looks correct to me. :D That's awesome. Should be very helpful.
     
  15. aple

    aple

    Joined:
    May 20, 2009
    Messages:
    807
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    According to Bob Fitch, the lead Engineer for StarCraft, StarCraft's pathfinding breaks the map up into smaller regions which A* then uses for units to pathfind out of into whatever region they're trying to go to and then to the specific point. I would not be surprised if WC3 did something similar. (Link to Tweet: Bob Fitch on Twitter)

    In theory this means any map of any size can work properly for pathfinding for the most part as each unit's path finding is never searching the entire map for their path, just within their region to get to the next region they want to go to and repeat (Probably something along the lines of using an A* algorithm to find the next region to go to then using an A* algorithm to find the specific point in that region). Give or take some other complications with the pathfinding that may slow it down (Eventually at some point, maybe too many regions can start to wear on performance, and probably too many paths being calculated at the same time is a problem but judging from certain maps there seems to be pretty high tolerance there).

    Extending pass 480x480 without too much modification should be possible in theory. Each cell is 64x64 units. 64*480 doesn't even come close to the 16-bit limit so as far as actual size limits go that's okay. So anything limiting it to 480x480 is probably purposely built into the game or perhaps caused by the way textures are mapped to the map or maybe a limitation on those regions. 480 is a weird number, though, and I can't really figure out where it comes from. Anybody else know why?
     
  16. ENAleksey

    ENAleksey

    Joined:
    Nov 29, 2014
    Messages:
    189
    Resources:
    1
    Tools:
    1
    Resources:
    1

    Update v0.2.3a and v0.2.3b


    • Added new native function CtrlSetSize;
    • Added new native function CtrlSetAlignment;
    • CtrlSetPosition and CtrlNew functions now take offsetX and offsetY instead of x and y;
    • Deleted CtrlSetRect function;
    • Fixed alignment relative to other UI elements (v0.2.3b).

    Demonstration of the graphic interface and camera control





    Using of CtrlSetAlignment function



    Code (vJASS):
    constant integer ALIGN_TOPLEFT = 0
    constant integer ALIGN_TOP = 1
    constant integer ALIGN_TOPRIGHT = 2
    constant integer ALIGN_LEFT = 3
    constant integer ALIGN_CENTER = 4
    constant integer ALIGN_RIGHT = 5
    constant integer ALIGN_BOTTOMLEFT = 6
    constant integer ALIGN_BOTTOM = 7
    constant integer ALIGN_BOTTOMRIGHT = 8

    native CtrlSetAlignment takes integer id, integer parentId, integer alignment returns nothing

    To align to the entire window, set
    parentId = -1
    .

    war3 2017-07-10 18-58-51-38.png war3 2017-07-10 18-58-56-22.png war3 2017-07-10 18-59-12-10.png war3 2017-07-10 18-59-19-35.png
    war3 2017-07-10 20-07-09-28.png war3 2017-07-10 20-09-48-66.png

    Used Code
    Code (vJASS):
    function TestAlignment takes nothing returns nothing
        local integer parentId = 1000 // -1

        call CtrlNew(1000, 100, 200, 400, 400)
        call CtrlSetTexture(1000, "Textures\\white.blp")
        call CtrlSetColor(1000, 0xA0FFFFFF)

        call CtrlNew(1001,  0,   0,  64, 64) // TOPLEFT
        call CtrlNew(1002, -32,  0,  64, 64) // TOP
        call CtrlNew(1003, -64,  0,  64, 64) // TOPRIGHT
        call CtrlNew(1004,  0,  -32, 64, 64) // LEFT
        call CtrlNew(1005, -32, -32, 64, 64) // CENTER
        call CtrlNew(1006, -64, -32, 64, 64) // RIGHT
        call CtrlNew(1007,  0,  -64, 64, 64) // BOTTOMLEFT
        call CtrlNew(1008, -32, -64, 64, 64) // BOTTOM
        call CtrlNew(1009, -64, -64, 64, 64) // BOTTOMRIGHT

        call CtrlSetAlignment(1001, parentId, ALIGN_TOPLEFT)
        call CtrlSetAlignment(1002, parentId, ALIGN_TOP)
        call CtrlSetAlignment(1003, parentId, ALIGN_TOPRIGHT)
        call CtrlSetAlignment(1004, parentId, ALIGN_LEFT)
        call CtrlSetAlignment(1005, parentId, ALIGN_CENTER)
        call CtrlSetAlignment(1006, parentId, ALIGN_RIGHT)
        call CtrlSetAlignment(1007, parentId, ALIGN_BOTTOMLEFT)
        call CtrlSetAlignment(1008, parentId, ALIGN_BOTTOM)
        call CtrlSetAlignment(1009, parentId, ALIGN_BOTTOMRIGHT)
    endfunction
     
    Last edited: Jul 10, 2017
  17. MindWorX

    MindWorX

    Joined:
    Aug 3, 2004
    Messages:
    690
    Resources:
    5
    Tools:
    1
    Tutorials:
    4
    Resources:
    5
    Does CtrlNew/CtrlSetTexture/etc. use the internal frame functions or is it your directx hooks?
     
  18. ENAleksey

    ENAleksey

    Joined:
    Nov 29, 2014
    Messages:
    189
    Resources:
    1
    Tools:
    1
    Resources:
    1
    The GUI system was created from scratch, it doesn't use standard UI functions from Game.dll, only DirectX. Textures are loaded from map and RenderEdge.mpq using functions from Storm.dll.
     
    Last edited: Jul 10, 2017
  19. datsatthune

    datsatthune

    Joined:
    Sep 9, 2015
    Messages:
    23
    Resources:
    0
    Resources:
    0
    So cool :eek: Can you add this feature to the WidescreenFix too?
     
  20. ENAleksey

    ENAleksey

    Joined:
    Nov 29, 2014
    Messages:
    189
    Resources:
    1
    Tools:
    1
    Resources:
    1

    Update v0.2.4a


    • Added new native function SetPortrait;
    • CtrlSetSize function does not change the width or height if you set the corresponding argument to -1;
    • Changed CtrlSetAlignment function name to CtrlSetAnchor;
    • Changed HP Bars fix;
    • Fixed dynamic controls alignment relative to other UI elements;
    • Fixed height of the wrapped text;
    • Fixed the height of the wrapped text when the width was changed dynamically;
    • Fixed safety issues. If a bold, italic or bold italic font is not available, then a normal font is used.
    war3 2017-07-19 15-17-26-02.png Also, the sample map was rewritten using vJass, so you don't need to install additional plugins in JNGP.

    Most likely yes.
     
    Last edited: Aug 4, 2017