• 🏆 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!

[JASS] Blizzard.j limit

Status
Not open for further replies.

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,534
I understand that you're supposed to use natives as often as possible instead of Blizzard.j functions.

I also understand that in some cases it's better to use blizzard.j functions if they make a big enough difference.

So what's the limit?

Is it better to use

JASS:
call PercentToInt(5,50)

then to use

JASS:
local integer result = R2I(5 * I2R(50) * 0.01)
    if (result < 0) then
        set result = 0
    elseif (result > 50) then
        set result = 50
    endif


Another example of a long BJ would be

JASS:
call CinematicFadeBJ(int,real,string,real,real,real,real)

Compared to

JASS:
    if (fadetype == bj_CINEFADETYPE_FADEOUT) then
        // Fade out to the requested color.
        call AbortCinematicFadeBJ()
        call CinematicFadeCommonBJ(red, green, blue, duration, tex, 100, trans)
    elseif (fadetype == bj_CINEFADETYPE_FADEIN) then
        // Fade in from the requested color.
        call AbortCinematicFadeBJ()
        call CinematicFadeCommonBJ(red, green, blue, duration, tex, trans, 100)
        call FinishCinematicFadeAfterBJ(duration)
    elseif (fadetype == bj_CINEFADETYPE_FADEOUTIN) then
        // Fade out to the requested color, and then fade back in from it.
        if (duration > 0) then
            call AbortCinematicFadeBJ()
            call CinematicFadeCommonBJ(red, green, blue, duration * 0.5, tex, 100, trans)
            call ContinueCinematicFadeAfterBJ(duration * 0.5, red, green, blue, trans, tex)
            call FinishCinematicFadeAfterBJ(duration)
        endif
    else
        // Unrecognized fadetype - ignore the request.
    endif

9 of which are also BJ's; after their conversion it ends up being 4x or so as long.

Of course if you don't need the entire functionality of CinematicFadeBJ and you only want bj_CINEFADETYPE_FADEOUT, it will shorten it substantially.

Answer doesn't have to be exact, I'm just looking for something to base off.

To sum up my question,
How do I know when to use blizzard.j's instead of converting them to natives? At one point is the size increase so great that it isn't worth the speed increase?
 
Status
Not open for further replies.
Top