Cokemonkey11
Spell Reviewer
- Joined
- May 9, 2006
- Messages
- 3,570
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
then to use
Another example of a long BJ would be
Compared to
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?
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?