- Joined
- Mar 24, 2013
- Messages
- 1,105
So I'm using WaterKnight's code from this link.
http://www.hiveworkshop.com/forums/1676883-post6.html
And while I can make it play the Panda-n-cub filter and the white/black one, the rest seem to just to default to the white filter. And I'm not sure what I'm doing wrong.
A test map is also attached
http://www.hiveworkshop.com/forums/1676883-post6.html
And while I can make it play the Panda-n-cub filter and the white/black one, the rest seem to just to default to the white filter. And I'm not sure what I'm doing wrong.
JASS:
library FadeFilter
function CinematicFadeCommonForPlayer takes player p, real red, real green, real blue, real duration, string tex, real startTrans, real endTrans returns nothing
if (duration == 0) then
set startTrans = endTrans
endif
if (GetLocalPlayer() == p) then
call EnableUserUI(false)
call SetCineFilterTexture(tex)
call SetCineFilterBlendMode(BLEND_MODE_NONE)
call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
call SetCineFilterStartUV(0, 0, 1, 1)
call SetCineFilterEndUV(0, 0, 1, 1)
call SetCineFilterStartColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100-startTrans))
call SetCineFilterEndColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100-endTrans))
call SetCineFilterDuration(duration)
call DisplayCineFilter(true)
endif
endfunction
function FinishCinematicFadeForPlayer takes nothing returns nothing
local integer playerid
local integer index = 0
loop
exitwhen index > 11
if (GetExpiredTimer() == udg_cineFadeFinishTimer[index]) then
set playerid = index
endif
set index = index + 1
endloop
call DestroyTimer(udg_cineFadeFinishTimer[playerid])
set udg_cineFadeFinishTimer[playerid] = null
if (GetPlayerId(GetLocalPlayer()) == playerid) then
call DisplayCineFilter(false)
call EnableUserUI(true)
endif
endfunction
function FinishCinematicFadeAfterForPlayer takes integer playerid, real duration returns nothing
set udg_cineFadeFinishTimer[playerid] = CreateTimer()
call TimerStart(udg_cineFadeFinishTimer[playerid], duration, false, function FinishCinematicFadeForPlayer)
endfunction
function ContinueCinematicFadeForPlayer takes nothing returns nothing
local integer playerid
local integer index = 0
loop
exitwhen index > 11
if (GetExpiredTimer() == udg_cineFadeContinueTimer[index]) then
set playerid = index
endif
set index = index + 1
endloop
call DestroyTimer(udg_cineFadeContinueTimer[playerid])
set udg_cineFadeContinueTimer[playerid] = null
call CinematicFadeCommonForPlayer(Player(playerid), udg_cineFadeContinueRed[playerid], udg_cineFadeContinueGreen[playerid], udg_cineFadeContinueBlue[playerid], udg_cineFadeContinueDuration[playerid], udg_cineFadeContinueTex[playerid], udg_cineFadeContinueTrans[playerid], 100)
endfunction
function ContinueCinematicFadeAfterForPlayer takes integer playerid, real duration, real red, real green, real blue, real trans, string tex returns nothing
set udg_cineFadeContinueRed[playerid] = red
set udg_cineFadeContinueGreen[playerid] = green
set udg_cineFadeContinueBlue[playerid] = blue
set udg_cineFadeContinueTrans[playerid] = trans
set udg_cineFadeContinueDuration[playerid] = duration
set udg_cineFadeContinueTex[playerid] = tex
set udg_cineFadeContinueTimer[playerid] = CreateTimer()
call TimerStart(udg_cineFadeContinueTimer[playerid], duration, false, function ContinueCinematicFadeForPlayer)
endfunction
function AbortCinematicFadeForPlayer takes integer playerid returns nothing
if (udg_cineFadeContinueTimer[playerid] != null) then
call DestroyTimer(udg_cineFadeContinueTimer[playerid])
endif
if (udg_cineFadeFinishTimer[playerid] != null) then
call DestroyTimer(udg_cineFadeFinishTimer[playerid])
endif
endfunction
function CinematicFadeForPlayer takes player p, integer fadetype, real duration, string tex, real red, real green, real blue, real trans returns nothing
local integer playerid = GetPlayerId(p)
if (fadetype == bj_CINEFADETYPE_FADEOUT) then
call AbortCinematicFadeForPlayer(playerid)
call CinematicFadeCommonForPlayer(p, red, green, blue, duration, tex, 100, trans)
elseif (fadetype == bj_CINEFADETYPE_FADEIN) then
call AbortCinematicFadeForPlayer(playerid)
call CinematicFadeCommonForPlayer(p, red, green, blue, duration, tex, trans, 100)
call FinishCinematicFadeAfterForPlayer(playerid, duration)
elseif (fadetype == bj_CINEFADETYPE_FADEOUTIN) then
if (duration > 0) then
call AbortCinematicFadeForPlayer(playerid)
call CinematicFadeCommonForPlayer(p, red, green, blue, duration * 0.5, tex, 100, trans)
call ContinueCinematicFadeAfterForPlayer(playerid, duration * 0.5, red, green, blue, trans, tex)
call FinishCinematicFadeAfterForPlayer(playerid, duration)
endif
endif
endfunction
endlibrary
JASS:
function Trig_Bloody_Screen_Copy_Actions takes nothing returns nothing
set udg_TempPlayer = GetTriggerPlayer()
set udg_fadeType = 1
set udg_duration = 10
set udg_texture = "ReplaceableTextures\\CameraMasks\\HazeAndFogFilter_Mask.blp"
/* Possible Textures
ReplaceableTextures\CameraMasks\White_mask.blp
ReplaceableTextures\CameraMasks\Black_mask.blp
ReplaceableTextures\CameraMasks\HazeFilter_mask.blp
ReplaceableTextures\CameraMasks\GroundFog_mask.blp
ReplaceableTextures\CameraMasks\HazeAndFogFilter_Mask.blp
ReplaceableTextures\CameraMasks\DiagonalSlash_mask.blp
ReplaceableTextures\CameraMasks\DreamFilter_Mask.blp
ReplaceableTextures\CameraMasks\Scope_Mask.blp
ReplaceableTextures\CameraMasks\SpecialPowMask.blp
ReplaceableTextures\CameraMasks\SpecialSplatMask.blp
ReplaceableTextures\CameraMasks\Panda-n-Cub.blp
*/
set udg_red = 100
set udg_green = 0
set udg_blue = 0
set udg_transparency = 0
call CinematicFadeForPlayer(udg_TempPlayer, udg_fadeType, udg_duration, udg_texture, udg_red, udg_green, udg_blue, udg_transparency)
endfunction
//===========================================================================
function InitTrig_Bloody_Screen takes nothing returns nothing
set gg_trg_Bloody_Screen = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Bloody_Screen, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Bloody_Screen, function Trig_Bloody_Screen_Copy_Actions )
endfunction
A test map is also attached