• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

World Bounds v1.3

  • Like
Reactions: deepstrasz
  • World Bounds by Almia
  • Trigger:
    • World Bounds
      • Events
        • Map initialization
      • Conditions
      • Actions
        • -------- ------------------------------------------------------------------------ --------
        • -------- WORLD BOUNDS --------
        • -------- ------------------------------------------------------------------------ --------
        • Custom script: set udg_WB_World = GetWorldBounds()
        • -------- ------------------------------------------------------------------------ --------
        • -------- World Bounds Max and Min Coordinates --------
        • -------- ------------------------------------------------------------------------ --------
        • Set WB_MinX = (Min X of WB_World)
        • Set WB_MinY = (Min Y of WB_World)
        • Set WB_MaxX = (Max X of WB_World)
        • Set WB_MaxY = (Max Y of WB_World)
  • World Bounds Functionalities:
    JASS:
    //*************************************************************************************
    //*
    //*    World Bounds Functions by Almia
    //*
    //*************************************************************************************
    //*
    //*    API
    //*
    //*    function IsXInMap takes real x returns boolean
    //*    function IsYInMap takes real y returns boolean
    //*    function IsPointInMap takes real x, real y returns boolean
    //*    - Checks if coordinates is in map.
    //*
    //*    function BoundX takes real x returns real
    //*    function BoundY takes real y returns real
    //*    - Bounds the value of coordinate to min/max values if they are greater/less than min/max values.
    //*
    //*    function SetUnitBoundedX takes unit u, real x returns nothing
    //*    function SetUnitBoundedY takes unit u, real y returns nothing
    //*    - Moves unit in a bounded coordinate
    //*
    //*************************************************************************************
    function IsXInMap takes real x returns boolean
        return x >= udg_WB_MinX and x < udg_WB_MaxX
    endfunction
    
    function IsYInMap takes real y returns boolean
        return y >= udg_WB_MinY and y < udg_WB_MaxY
    endfunction
    
    function IsPointInMap takes real x, real y returns boolean
        return IsXInMap(x) and IsYInMap(y)
    endfunction
    
    function BoundX takes real x returns real
        if udg_WB_MinX > x then
            return udg_WB_MinX
        elseif udg_WB_MaxX < x then
            return udg_WB_MaxX
        endif
        return x
    endfunction
    
    function BoundY takes real y returns real
        if udg_WB_MinY > y then
            return udg_WB_MinY
        elseif udg_WB_MaxY < y then
            return udg_WB_MaxY
        endif
        return y
    endfunction
    
    function SetUnitBoundedX takes unit u, real x returns nothing
        call SetUnitX(u, BoundX(x))
    endfunction
    
    function SetUnitBoundedY takes unit u, real y returns nothing
        call SetUnitY(u, BoundY(y))
    endfunction
  • Credits : Nestharus
Contents

World Bounds v1.3 (Map)

Reviews
15:02, 1st Jul 2013 PurgeandFire: Changes made. Approved!

Moderator

M

Moderator

15:02, 1st Jul 2013
PurgeandFire: Changes made. Approved!
 
I like the vjass version better D:
May I suggest that you make the variables WB_MinX/MaxX/MinY/MaxY
Without the WB_ in front of it. I doubt anyone would have the user defined globals Max/Min x/y
Just sayin.
Same goes for Center variables. Nothing else to critique. FYI Nestharus's version uses integers instead of reals. Dunno if you noticed it.
4/5 - Until I get a response justifying your variables or changing them.
 
I don't think so :D
Let it private as it is. Some maps that has multimaps may have use the MaxX,MaxY etc.

I do noticed that it uses integers,however,GUI doesn't allow one to typecast integers to reals directly. (Integer can be typecasted to reals if you use them as of how you used reals). So,I chose reals so that users can easily use this than opening Convert - Integer to Real all over again,

For those beginners who doesn't know what is the function of this snippet,It allows you to retrieve constant values of the World Bounds or the Map Area,this includes the max X of the World Bounds, Max Y, etc.
 
I don't think so :D
Let it private as it is. Some maps that has multimaps may have use the MaxX,MaxY etc.

I do noticed that it uses integers,however,GUI doesn't allow one to typecast integers to reals directly. (Integer can be typecasted to reals if you use them as of how you used reals). So,I chose reals so that users can easily use this than opening Convert - Integer to Real all over again,
Fair enough. 5/5
 
It is just the same. Blizzard Math is slow(source : Nes)
This is not rightful in the Jass section(read section title),it is too obvious that this is GUI.
If you are making some Spell Generator systems(dummy system, projectile system, knockback system,etc.) this the system you are going to use,this is very important.
@Magtheridon96
Wut.
Why not let it stay there? I haven't seen an open map with "World" as a name of a var.
 
@Almia: Whoops. My mistake. I forgot people might use that.

You can remove the CenterX = 0.00 and CenterY = 0.00 now.
Also:
JASS:
function BoundY takes real y returns real
    if udg_WB_MinY > y then
        return udg_WB_MinY
    elseif udg_WB_MaxX < y then // change to udg_WB_MaxY
        return udg_WB_MaxY
    endif
    return y
endfunction
And SetBoundedY() should use SetUnitY() not SetUnitX(), and it should use BoundY() instead of BoundX().

Fix those and I'll approve. :)
 
Level 8
Joined
Oct 12, 2011
Messages
483
I find this too simple; it would take a person only slightly less time importing it than writing it... Though I guess since this is already prewritten the user won't have to worry about accidental bugs.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
It is just the same. Blizzard Math is slow(source : Nes)

No it's not...

Complexity of operations are as follows (from fastest to slowest)

Addition
Subtraction
Multiplication
Division


There is a huge difference in complexity between multiplication and division.

You'd only want to use division over multiplication to keep integers as integers (4/2 vs R2I(4*.5))


Yep.
I think Ill add some functionalities.

Please don't -.-. Super packs don't make you cool.
 
The GUI part is for the variable copy.

GUI / Triggers
I think not.


Edit:
The GUI part is the core of the system. Without it the addon functions provided are rendered useless. What I was trying to say in that post above is that if this becomes vanilla Jass GUIers won't use it. Though I would imagine those who still use GUI would find no use for such a resource. If the added functionality is the only thing that attracts GUI users, then it should be in GUI. As a Jass resource Nestharus beat it out with his original vJass world bounds. As a GUI resource, it loses functionality. If the majority of the resource is coded in Jass then I believe it should be labeled a Jass resource.

Also:
~Reserved
Why?
 
Last edited:
Top