Name | Type | is_array | initial_value |
//TESH.scrollpos=0
//TESH.alwaysfold=0
library_once TimerUtils initializer init
//*********************************************************************
//* TimerUtils (Blue flavor for 1.23b or later)
//* ----------
//*
//* To implement it , create a custom text trigger called TimerUtils
//* and paste the contents of this script there.
//*
//* To copy from a map to another, copy the trigger holding this
//* library to your map.
//*
//* (requires vJass) More scripts: htt://www.wc3campaigns.net
//*
//* For your timer needs:
//* * Attaching
//* * Recycling (with double-free protection)
//*
//* set t=NewTimer() : Get a timer (alternative to CreateTimer)
//* ReleaseTimer(t) : Relese a timer (alt to DestroyTimer)
//* SetTimerData(t,2) : Attach value 2 to timer
//* GetTimerData(t) : Get the timer's value.
//* You can assume a timer's value is 0
//* after NewTimer.
//*
//* Blue Flavor: Slower than the red flavor, it got a 408000 handle id
//* limit, which means that if more than 408000 handle ids
//* are used in your map, TimerUtils might fail, this
//* value is quite big and it is much bigger than the
//* timer limit in Red flavor.
//*
//********************************************************************
//==================================================================================================
globals
private hashtable hasht //I <3 blizz
endglobals
//It is dependent on jasshelper's recent inlining optimization in order to perform correctly.
function SetTimerData takes timer t, integer value returns nothing
call SaveInteger(hasht,0, GetHandleId(t), value)
endfunction
function GetTimerData takes timer t returns integer
return LoadInteger(hasht, 0, GetHandleId(t))
endfunction
//==========================================================================================
globals
private timer array tT
private integer tN = 0
private constant integer HELD=0x28829022
//use a totally random number here, the more improbable someone uses it, the better.
endglobals
//==========================================================================================
function NewTimer takes nothing returns timer
if (tN==0) then
set tT[0]=CreateTimer()
else
set tN=tN-1
endif
call SetTimerData(tT[tN],0)
return tT[tN]
endfunction
//==========================================================================================
function ReleaseTimer takes timer t returns nothing
if(t==null) then
debug call BJDebugMsg("Warning: attempt to release a null timer")
return
endif
if (tN==8191) then
debug call BJDebugMsg("Warning: Timer stack is full, destroying timer!!")
//stack is full, the map already has much more troubles than the chance of bug
call DestroyTimer(t)
else
call PauseTimer(t)
if(GetTimerData(t)==HELD) then
debug call BJDebugMsg("Warning: ReleaseTimer: Double free!")
return
endif
call SetTimerData(t,HELD)
set tT[tN]=t
set tN=tN+1
endif
endfunction
private function init takes nothing returns nothing
set hasht = InitHashtable()
endfunction
endlibrary
//TESH.scrollpos=74
//TESH.alwaysfold=0
library basic requires Bezier
globals
unit array Actor
private location LLL = Location(0,0)
endglobals
function IsBStart takes integer bc, real INPUT returns boolean
if BC == bc and INPUT < didt then
return true
endif
return false
endfunction
function CreateActor takes player p, integer id, real x, real y, real face, integer index returns unit
set Actor[index] = CreateUnit(p,id,x,y,face)
call UnitAddAbility(Actor[index],'Arav')
return Actor[index]
endfunction
function SetUnit takes unit u, real x, real y, real face returns nothing
call SetUnitX(u,x)
call SetUnitY(u,y)
call IssueImmediateOrder(u,"stop")
call SetUnitFacing(u,face)
endfunction
function GetPointZ takes real x, real y returns real
call MoveLocation(LLL,x,y)
return GetLocationZ(LLL)
endfunction
//Credit to Spec
function ParabolaZ takes real h, real d, real x returns real
return (4 * h / d) * (d - x) * (x / d)
endfunction
//smooth angle system
globals
real relativemaxAV = .01
real AngularA = .005
real currenth = 0
real currentv = 0
//note: These two are currently used backwards
real velh = 0
real velv = 0
endglobals
function RangeAngle takes real angle returns real
return bj_RADTODEG*Atan2(Sin(bj_DEGTORAD*angle),Cos(bj_DEGTORAD*angle))
endfunction
function AngleDiff takes real angle1, real angle2 returns real
return RangeAngle(RangeAngle(angle2) - RangeAngle(angle1))
endfunction
function GetHAngle takes real TargH returns real
local real HDiff
local real absvel
set HDiff = AngleDiff(currenth,TargH)
if HDiff > 0 then
set velv = velv + AngularA * ((60 + RAbsBJ(HDiff)) / 240)
else
set velv = velv - AngularA * ((60 + RAbsBJ(HDiff)) / 240)
endif
if RAbsBJ(velv) > RAbsBJ(HDiff) * relativemaxAV then
set absvel = RAbsBJ(HDiff) * relativemaxAV
if HDiff > 0 then
set velv = absvel
else
set velv = - absvel
endif
endif
set currenth = currenth + velv
return currenth
endfunction
function GetVAngle takes real TargV returns real
local real VDiff
local real absvel
set VDiff = AngleDiff(currentv,TargV)
if VDiff > 0 then
set velh = velh + AngularA * ((60 + RAbsBJ(VDiff)) / 240)
else
set velh = velh - AngularA * ((60 + RAbsBJ(VDiff)) / 240)
endif
if RAbsBJ(velh) > RAbsBJ(VDiff) * relativemaxAV then
set absvel = RAbsBJ(VDiff) * relativemaxAV
if VDiff > 0 then
set velh = absvel
else
set velh = - absvel
endif
endif
set currentv = currentv + velh
return currentv
endfunction
//Use to simulate target functionality when using angle approach method
//with target points
function GetCoordTargetH takes real fx, real fy returns real
return bj_RADTODEG*Atan2(fy - BY,fx - BX)
endfunction
function GetCoordTargetV takes real fx, real fy, real fz returns real
return bj_RADTODEG*Atan2(fz - BZ,SquareRoot((fx - BX)*(fx - BX) + (fy - BY)*(fy - BY)))
endfunction
//Use to do the same thing as above but for using a cam pos tangent
//to the current bezier curve
function GetFollowH takes nothing returns real
call Diff(BC,Input)
return bj_RADTODEG*Atan2(dBY,dBX)
endfunction
function GetFollowV takes nothing returns real
call Diff(BC,Input)
return bj_RADTODEG*Atan2(dBZ,SquareRoot(dBX*dBX + dBY*dBY))
endfunction
//Roll for camera follow system; not necessary; depends on use of GetHAngle
globals
real relativemaxRV = .01
real RollA = .03
real currentr = 0
real velr = 0
endglobals
//Initial version, used in Section 1
function GetFollowR takes real MagnitudeAndSign returns real
local real RDiff
local real absvel
call Diff(BC,Input)
set RDiff = AngleDiff(currentr,velv)
if RDiff > 0 then
set velr = velr + RollA * ((60 + RAbsBJ(RDiff)) / 240)
else
set velr = velr - RollA * ((60 + RAbsBJ(RDiff)) / 240)
endif
if RAbsBJ(velr) > RAbsBJ(RDiff) * relativemaxRV then
set absvel = RAbsBJ(RDiff) * relativemaxRV
if RDiff > 0 then
set velr = absvel
else
set velr = - absvel
endif
endif
set currentr = currentr + velr
return currentr * MagnitudeAndSign
endfunction
//Revised Functions, unfortuanately with inconsistant naming to avoid conflict:
function GetRollAngle takes real roll, real MagnitudeAndSign returns real
local real RDiff
local real absvel
call Diff(BC,Input)
set RDiff = AngleDiff(currentr,roll)
if RDiff > 0 then
set velr = velr + RollA * ((60 + RAbsBJ(RDiff)) / 240)
else
set velr = velr - RollA * ((60 + RAbsBJ(RDiff)) / 240)
endif
if RAbsBJ(velr) > RAbsBJ(RDiff) * relativemaxRV then
set absvel = RAbsBJ(RDiff) * relativemaxRV
if RDiff > 0 then
set velr = absvel
else
set velr = - absvel
endif
endif
set currentr = currentr + velr
return currentr * MagnitudeAndSign
endfunction
function GetFollowRoll takes nothing returns real
return velv
endfunction
function ResetBASystem takes nothing returns nothing
set Input = 0
set relativemaxAV = .01
set AngularA = .005
set currenth = 0
set currentv = 0
set velh = 0
set velv = 0
set relativemaxRV = .01
set RollA = .03
set currentr = 0
set velr = 0
set didt = 0
set AutoVSmoothing = true
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
// Coordinate Cameras
// By uberfoop
//
//
// ->What is this?
// It is a snippet with functions designed to allow the positioning
// of the wc3 camera based on spatial coordinates instead of target
// positions, distance to target, and what have you.
//
// ->Functions:
//
// function SetCameraCoord takes real x, real y, real z, real azimuth, real vertical, real roll returns nothing
// x, y, and z are spatial coordinates of the camera.
// azimuth is the horizontal rotation of the camera.
// vertical is the vertical angle of the camera. For example,
// '30' is 30 degrees up from paralell with the ground.
// roll is the roll angle of the camera.
//
// function SetCameraCoordB takes real x, real y, real z, real azimuth, real vertical, real roll returns nothing
// This is the same as SetCameraCoord for everything except vertical.
// For vertical, this uses the angle down from the zenith. For example,
// '30' is 60 degrees up from paralell with the ground.
//
// function SetCameraCoordTarget takes real x, real y, real z, real fx, real fy, real fz, real roll returns nothing
// x, y, and z are spatial coordinates of the camera.
// fx, fy, and fz are spatial coordinates that the camera will face.
// roll is the roll angle of the camera.
library cc requires cameramap
private function GetZ takes real a, real b, real z returns real
return z-GetCamOffset(a,b)
endfunction
function SetCameraCoord takes real x, real y, real z, real azimuth, real vertical, real roll returns nothing
local real tz = GetZ(x+100*Cos(bj_DEGTORAD*vertical)*Cos(bj_DEGTORAD*azimuth),y+100*Cos(bj_DEGTORAD*vertical)*Sin(bj_DEGTORAD*azimuth),z + 100*Sin(bj_DEGTORAD*vertical))
local real f = 100*Cos(bj_DEGTORAD*vertical)
local real tx = x + f*Cos(bj_DEGTORAD*azimuth)
local real ty = y + f*Sin(bj_DEGTORAD*azimuth)
call SetCameraPosition(tx,ty)
call SetCameraField(CAMERA_FIELD_ZOFFSET,tz,-.01)
call SetCameraField(CAMERA_FIELD_ZOFFSET,tz,.01)
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,100,0)
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK,vertical,0)
call SetCameraField(CAMERA_FIELD_ROTATION,azimuth,0)
call SetCameraField(CAMERA_FIELD_ROLL,roll,0)
endfunction
/*function SetCameraCoordB takes real x, real y, real z, real azimuth, real vertical, real roll returns nothing
local real tz = GetZ(z + 100*Cos(bj_DEGTORAD*vertical))
local real f = 100*Sin(bj_DEGTORAD*vertical)
local real tx = x + f*Cos(bj_DEGTORAD*azimuth)
local real ty = y + f*Sin(bj_DEGTORAD*azimuth)
call SetCameraPosition(tx,ty)
call SetCameraField(CAMERA_FIELD_ZOFFSET,tz,-.01)
call SetCameraField(CAMERA_FIELD_ZOFFSET,tz,.01)
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,100,0)
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK,90 - vertical,0)
call SetCameraField(CAMERA_FIELD_ROTATION,azimuth,0)
call SetCameraField(CAMERA_FIELD_ROLL,roll,0)
endfunction*/
function SetCameraCoordTarget takes real x, real y, real z, real fx, real fy, real fz, real roll returns nothing
local real a = bj_RADTODEG*Atan2(fy - y,fx - x)
local real v = bj_RADTODEG*Atan2(fz - z,SquareRoot((fx - x)*(fx - x) + (fy - y)*(fy - y)))
local real tz = GetZ(x+100*Cos(bj_DEGTORAD*v)*Cos(bj_DEGTORAD*a),y+100*Cos(bj_DEGTORAD*v)*Sin(bj_DEGTORAD*a),z + 100*Sin(bj_DEGTORAD*v))
local real f = 100*Cos(bj_DEGTORAD*v)
local real tx = x + f*Cos(bj_DEGTORAD*a)
local real ty = y + f*Sin(bj_DEGTORAD*a)
call SetCameraPosition(tx,ty)
call SetCameraField(CAMERA_FIELD_ZOFFSET,tz,-.01)
call SetCameraField(CAMERA_FIELD_ZOFFSET,tz,.01)
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,100,0)
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK,v,0)
call SetCameraField(CAMERA_FIELD_ROTATION,a,0)
call SetCameraField(CAMERA_FIELD_ROLL,roll,0)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library RGBA initializer Init
//Configurable globals
globals
private constant real RGBA_TIMEOUT = .03125 //Interval between calls of callback function
//Increasing this will slow transitions for a given 'rate',
//and be choppier, but improve performance
//.03125 is 32 callbacks per second
private constant real RGBA_RATE = 1 //Default maximum quantity of change per call of callback
endglobals //Increasing this will increase the default rate of transition
//'r<x>' members of UCT structs default to this value
//True rate of RGBA change will equal rate/UCTS_TIMEOUT
//stuff
globals
private timer RGBA_TIMER
private rgba array RGBA_ACTIVE
private integer RGBA_QUANTITY = -1
endglobals
//Applies the color transitions themselves
private function RGBACallback takes nothing returns nothing
local integer i = 0
local real m
local rgba s
loop
exitwhen i > RGBA_QUANTITY
set s = RGBA_ACTIVE[i]
set m = s.tr - s.r
if m*m <= s.rr*s.rr then
set s.r = s.tr
elseif m < 1 then
set s.r = s.r - s.rr
else
set s.r = s.r + s.rr
endif
set m = s.tg - s.g
if m*m <= s.rg*s.rg then
set s.g = s.tg
elseif m < 1 then
set s.g = s.g - s.rg
else
set s.g = s.g + s.rg
endif
set m = s.tb - s.b
if m*m <= s.rb*s.rb then
set s.b = s.tb
elseif m < 1 then
set s.b = s.b - s.rb
else
set s.b = s.b + s.rb
endif
set m = s.ta - s.a
if m*m <= s.ra*s.ra then
set s.a = s.ta
elseif m < 1 then
set s.a = s.a - s.ra
else
set s.a = s.a + s.ra
endif
if s.r == s.tr and s.g == s.tg and s.b == s.tb and s.a == s.ta then
set RGBA_ACTIVE[i] = RGBA_ACTIVE[RGBA_QUANTITY]
set RGBA_QUANTITY = RGBA_QUANTITY - 1
set s.SAFETY = -1
endif
set i = i + 1
endloop
if RGBA_QUANTITY == -1 then
call PauseTimer(RGBA_TIMER)
endif
endfunction
//===============//
//Start of struct//
//===============//
struct rgba
//Current RGBA values for a unit
public real r
public real g
public real b
public real a
//RGBA values to approach
public real tr
public real tg
public real tb
public real ta
//Safety
public integer SAFETY
//Rates, change per callback
public real rr
public real rg
public real rb
public real ra
//Unit u will apply the stated basic RGBA values immediately
static method create takes real CurrentR, real CurrentG, real CurrentB, real CurrentA returns rgba
local rgba s = rgba.allocate()
set s.r = CurrentR
set s.g = CurrentG
set s.b = CurrentB
set s.a = CurrentA
set s.tr = s.r
set s.tg = s.g
set s.tb = s.b
set s.ta = s.a
set s.rr = RGBA_RATE
set s.rg = RGBA_RATE
set s.rb = RGBA_RATE
set s.ra = RGBA_RATE
set s.SAFETY = -1
return s
endmethod
//Makes a UCT struct active if applicable. Called automatically by SetInstantRGBA and TargetRGBA.
//Should only be called directly if someone changes color-related members without using one of
//the SetInstantRGBA or TargetRGBA methods.
method rgbaAdd takes nothing returns nothing
if (.r != .tr or .g != .tg or .b != .tb or .a != .ta) and .SAFETY == -1 then
set RGBA_QUANTITY = RGBA_QUANTITY + 1
set RGBA_ACTIVE[RGBA_QUANTITY] = this
set .SAFETY = RGBA_QUANTITY
if RGBA_QUANTITY == 0 then
call TimerStart(RGBA_TIMER,RGBA_TIMEOUT,true,function RGBACallback)
endif
endif
endmethod
method pauseRGBA takes boolean b returns nothing
if b == true then
if .SAFETY >= 0 then
set RGBA_ACTIVE[.SAFETY] = RGBA_ACTIVE[RGBA_QUANTITY]
set RGBA_QUANTITY = RGBA_QUANTITY - 1
endif
set .SAFETY = -2
else
if .SAFETY == -2 or .SAFETY == -1 then
set .SAFETY = -1
call .rgbaAdd()
endif
endif
endmethod
//Intended as a replacement for an instant SetUnitVertexColor call if this system is in use, so that the
//strrgba will take into account the changes and not immediately change to something else.
//Boolean targettoo determines whether or not the target values should be changed as well.
method setInstantRGBA takes real r, real g, real b, real a, boolean targettoo returns nothing
set .r = r
set .g = g
set .b = b
set .a = a
if targettoo == true then
set .tr = r
set .tg = g
set .tb = b
set .ta = a
else
call .rgbaAdd()
endif
endmethod
//Sets the target values for the unit's RGBA to approach.
//If you don't need to change all the values, just input their strrgba members into the
//appropriate slots, ie: call thing.TargetRGBA(225,thing.tg,thing.tb,thing.ta)
method targetRGBA takes real r, real g, real b, real a returns nothing
set .tr = r
set .tg = g
set .tb = b
set .ta = a
call this.rgbaAdd()
endmethod
//Input a rate in change/second, and this method will scale
//it and fill in the spot.
method setRate takes real r, real g, real b, real a returns nothing
set .rr = r*RGBA_TIMEOUT
set .rg = g*RGBA_TIMEOUT
set .rb = b*RGBA_TIMEOUT
set .ra = a*RGBA_TIMEOUT
endmethod
//Removes active use of struct
method onDestroy takes nothing returns nothing
if .SAFETY >= 0 then
set RGBA_ACTIVE[.SAFETY] = RGBA_ACTIVE[RGBA_QUANTITY]
set RGBA_QUANTITY = RGBA_QUANTITY - 1
endif
set .SAFETY = -2
endmethod
endstruct
//Creates the timer
private function Init takes nothing returns nothing
set RGBA_TIMER = CreateTimer()
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
//Unit Color Transition
library UCT initializer Init
globals
private constant real UCT_TIMEOUT = .03125
endglobals
globals
private timer UCT_TIMER
private rgba array UCT_ACTIVE
private integer UCT_QUANTITY = -1
endglobals
private function CALLBACK takes nothing returns nothing
local integer i = 0
local rgba s
local uct u
loop
exitwhen i > UCT_QUANTITY
set u = UCT_ACTIVE[i]
set s = u.c
call SetUnitVertexColor(u.u,R2I(s.r),R2I(s.g),R2I(s.b),R2I(s.a))
set i = i + 1
endloop
if UCT_QUANTITY == -1 then
call PauseTimer(UCT_TIMER)
endif
endfunction
struct uct
unit u
rgba c
integer SAFETY
method uctAdd takes nothing returns nothing
set UCT_QUANTITY = UCT_QUANTITY + 1
set UCT_ACTIVE[UCT_QUANTITY] = this
set .SAFETY = UCT_QUANTITY
if UCT_QUANTITY == 0 then
call TimerStart(UCT_TIMER,UCT_TIMEOUT,true,function CALLBACK)
endif
endmethod
static method create takes unit u, rgba c returns uct
local uct s = uct.allocate()
set s.u = u
set s.c = c
call s.uctAdd()
return s
endmethod
method onDestroy takes nothing returns nothing
local integer i = .SAFETY
set UCT_ACTIVE[i] = UCT_ACTIVE[UCT_QUANTITY]
set UCT_QUANTITY = UCT_QUANTITY - 1
endmethod
endstruct
function CreateUCT takes unit u, rgba r returns uct
return uct.create(u,r)
endfunction
function DestroyUCT takes uct r returns nothing
call r.destroy()
endfunction
private function Init takes nothing returns nothing
set UCT_TIMER = CreateTimer()
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library cameramap initializer cameramapInit
globals
location cameramapLoc
real array camOffset[90][90]
real mapMinX
real mapMinY
real mapMaxX
real mapMaxY
endglobals
function GetGridCamOffset takes integer ix, integer iy, integer offx, integer offy returns real
local real r
local integer ixl = ix-1
local integer ixr = ix+1
local integer iyd = iy-1
local integer iyu = iy+1
if ixl<0 then
set ixl = 0
endif
if iyd<0 then
set iyd = 0
endif
if ixr>256 then
set ixr=256
endif
if iyu>256 then
set iyu=256
endif
if offx>0 then
if offy>0 then
set r = .089696*camOffset[ixl][iyu]+ .139657*camOffset[ix][iyu]+ .097349*camOffset[ixr][iyu]
set r = r+.130989*camOffset[ixl][iy] + .099380*camOffset[ix][iy] + .139657*camOffset[ixr][iy]
set r = r+.082587*camOffset[ixl][iyd]+ .130989*camOffset[ix][iyd]+ .089696*camOffset[ixr][iyd]
elseif offy<0 then
set r = .082587*camOffset[ixl][iyu]+ .130989*camOffset[ix][iyu]+ .089696*camOffset[ixr][iyu]
set r = r+.130989*camOffset[ixl][iy] + .099380*camOffset[ix][iy] + .139657*camOffset[ixr][iy]
set r = r+.089696*camOffset[ixl][iyd]+ .139657*camOffset[ix][iyd]+ .097349*camOffset[ixr][iyd]
else
set r = .084604*camOffset[ixl][iyu]+ .134226*camOffset[ix][iyu]+ .091913*camOffset[ixr][iyu]
set r = r+.134017*camOffset[ixl][iy] + .101594*camOffset[ix][iy] + .142877*camOffset[ixr][iy]
set r = r+.084604*camOffset[ixl][iyd]+ .134226*camOffset[ix][iyd]+ .091913*camOffset[ixr][iyd]
endif
elseif offx<0 then
if offy>0 then
set r = .097349*camOffset[ixl][iyu]+ .139657*camOffset[ix][iyu]+ .089696*camOffset[ixr][iyu]
set r = r+.139657*camOffset[ixl][iy] + .099380*camOffset[ix][iy] + .130989*camOffset[ixr][iy]
set r = r+.089696*camOffset[ixl][iyd]+ .130989*camOffset[ix][iyd]+ .082587*camOffset[ixr][iyd]
elseif offy<0 then
set r = .089696*camOffset[ixl][iyu]+ .130989*camOffset[ix][iyu]+ .082587*camOffset[ixr][iyu]
set r = r+.139657*camOffset[ixl][iy] + .099380*camOffset[ix][iy] + .130989*camOffset[ixr][iy]
set r = r+.097349*camOffset[ixl][iyd]+ .139657*camOffset[ix][iyd]+ .089696*camOffset[ixr][iyd]
else
set r = .091913*camOffset[ixl][iyu]+ .134226*camOffset[ix][iyu]+ .084604*camOffset[ixr][iyu]
set r = r+.142877*camOffset[ixl][iy] + .101594*camOffset[ix][iy] + .134017*camOffset[ixr][iy]
set r = r+.091913*camOffset[ixl][iyd]+ .134226*camOffset[ix][iyd]+ .084604*camOffset[ixr][iyd]
endif
else
if offy>0 then
set r = .091913*camOffset[ixl][iyu]+ .142877*camOffset[ix][iyu]+ .091913*camOffset[ixr][iyu]
set r = r+.134226*camOffset[ixl][iy] + .101594*camOffset[ix][iy] + .134226*camOffset[ixr][iy]
set r = r+.084604*camOffset[ixl][iyd]+ .134017*camOffset[ix][iyd]+ .084604*camOffset[ixr][iyd]
elseif offy<0 then
set r = .084604*camOffset[ixl][iyu]+ .134017*camOffset[ix][iyu]+ .084604*camOffset[ixr][iyu]
set r = r+.134226*camOffset[ixl][iy] + .101594*camOffset[ix][iy] + .134226*camOffset[ixr][iy]
set r = r+.091913*camOffset[ixl][iyd]+ .142877*camOffset[ix][iyd]+ .091913*camOffset[ixr][iyd]
else
set r = .086125*camOffset[ixl][iyu]+ .136429*camOffset[ix][iyu]+ .086125*camOffset[ixr][iyu]
set r = r+.136429*camOffset[ixl][iy] + .109784*camOffset[ix][iy] + .136429*camOffset[ixr][iy]
set r = r+.086125*camOffset[ixl][iyd]+ .136429*camOffset[ix][iyd]+ .086125*camOffset[ixr][iyd]
endif
endif
return r
endfunction
function GetCamOffset takes real x, real y returns real
local integer iXLo = R2I((x-mapMinX)/512.+.5)
local integer iYLo = R2I((y-mapMinY)/512.+.5)
local integer iXHi = iXLo+1
local integer iYHi = iYLo+1
local integer iChkXLo
local integer iChkXLoOff
local integer iChkXHi
local integer iChkXHiOff
local integer iChkYLo
local integer iChkYLoOff
local integer iChkYHi
local integer iChkYHiOff
local real XLo
local real YLo
local real XHi
local real YHi
local real rX
local real rY
local real r
local real LoDX = (x-mapMinX)-(iXLo*512.-256.)
local real LoDY = (y-mapMinY)-(iYLo*512.-256.)
if LoDX<=12 then
set iChkXLo = iXLo
set iChkXLoOff = 0
set iChkXHi = iXLo
set iChkXHiOff = 1
elseif LoDX<500 then
set iChkXLo = iXLo
set iChkXLoOff = 1
set iChkXHi = iXHi
set iChkXHiOff =-1
else
set iChkXLo = iXHi
set iChkXLoOff =-1
set iChkXHi = iXHi
set iChkXHiOff = 0
endif
if LoDY<=12 then
set iChkYLo = iYLo
set iChkYLoOff = 0
set iChkYHi = iYLo
set iChkYHiOff = 1
elseif LoDY<500 then
set iChkYLo = iYLo
set iChkYLoOff = 1
set iChkYHi = iYHi
set iChkYHiOff =-1
else
set iChkYLo = iYHi
set iChkYLoOff =-1
set iChkYHi = iYHi
set iChkYHiOff = 0
endif
set XLo = iChkXLo*512.+iChkXLoOff*12.-256.
set XHi = iChkXHi*512.+iChkXHiOff*12.-256.
set YLo = iChkYLo*512.+iChkYLoOff*12.-256.
set YHi = iChkYHi*512.+iChkYHiOff*12.-256.
set rX = ((x-mapMinX)-XLo)/(XHi-XLo)
set rY = ((y-mapMinY)-YLo)/(YHi-YLo)
set r = GetGridCamOffset(iChkXHi,iChkYHi,iChkXHiOff,iChkYHiOff)*rX*rY
set r = r+GetGridCamOffset(iChkXLo,iChkYHi,iChkXLoOff,iChkYHiOff)*(1-rX)*rY
set r = r+GetGridCamOffset(iChkXHi,iChkYLo,iChkXHiOff,iChkYLoOff)*rX*(1-rY)
set r = r+GetGridCamOffset(iChkXLo,iChkYLo,iChkXLoOff,iChkYLoOff)*(1-rX)*(1-rY)
return r
endfunction
function cameramapInit_GridSub takes real x, real y returns real
local integer index
local integer iX = -6
local integer iY
local real z
local real r
local real i = 64 //9*4+12*2+4
call MoveLocation(cameramapLoc,x,y)
set z = GetLocationZ(cameramapLoc)
set r = 0.
call MoveLocation(cameramapLoc,x-128.,y)
set r = r+GetLocationZ(cameramapLoc)*4./i
call MoveLocation(cameramapLoc,x,y)
set r = r+GetLocationZ(cameramapLoc)*4./i
call MoveLocation(cameramapLoc,x+128.,y)
set r = r+GetLocationZ(cameramapLoc)*4./i
call MoveLocation(cameramapLoc,x-128.,y+128.)
set r = r+GetLocationZ(cameramapLoc)*4./i
call MoveLocation(cameramapLoc,x,y+128.)
set r = r+GetLocationZ(cameramapLoc)*4./i
call MoveLocation(cameramapLoc,x+128.,y+128.)
set r = r+GetLocationZ(cameramapLoc)*4./i
call MoveLocation(cameramapLoc,x-128.,y-128.)
set r = r+GetLocationZ(cameramapLoc)*4./i
call MoveLocation(cameramapLoc,x,y-128.)
set r = r+GetLocationZ(cameramapLoc)*4./i
call MoveLocation(cameramapLoc,x+128.,y-128.)
set r = r+GetLocationZ(cameramapLoc)*4./i
call MoveLocation(cameramapLoc,x-256.,y-128.)
set r = r+GetLocationZ(cameramapLoc)*2./i
call MoveLocation(cameramapLoc,x-256.,y)
set r = r+GetLocationZ(cameramapLoc)*2./i
call MoveLocation(cameramapLoc,x-256.,y+128.)
set r = r+GetLocationZ(cameramapLoc)*2./i
call MoveLocation(cameramapLoc,x+256.,y-128.)
set r = r+GetLocationZ(cameramapLoc)*2./i
call MoveLocation(cameramapLoc,x+256.,y)
set r = r+GetLocationZ(cameramapLoc)*2./i
call MoveLocation(cameramapLoc,x+256.,y+128.)
set r = r+GetLocationZ(cameramapLoc)*2./i
call MoveLocation(cameramapLoc,x-128.,y-256.)
set r = r+GetLocationZ(cameramapLoc)*2./i
call MoveLocation(cameramapLoc,x,y-256.)
set r = r+GetLocationZ(cameramapLoc)*2./i
call MoveLocation(cameramapLoc,x+128.,y-256.)
set r = r+GetLocationZ(cameramapLoc)*2./i
call MoveLocation(cameramapLoc,x-128.,y+256.)
set r = r+GetLocationZ(cameramapLoc)*2./i
call MoveLocation(cameramapLoc,x,y+256.)
set r = r+GetLocationZ(cameramapLoc)*2./i
call MoveLocation(cameramapLoc,x+128.,y+256.)
set r = r+GetLocationZ(cameramapLoc)*2./i
call MoveLocation(cameramapLoc,x+256.,y+256.)
set r = r+GetLocationZ(cameramapLoc)*1./i
call MoveLocation(cameramapLoc,x+256.,y-256.)
set r = r+GetLocationZ(cameramapLoc)*1./i
call MoveLocation(cameramapLoc,x-256.,y+256.)
set r = r+GetLocationZ(cameramapLoc)*1./i
call MoveLocation(cameramapLoc,x-256.,y-256.)
set r = r+GetLocationZ(cameramapLoc)*1./i
return r
endfunction
function cameramapInit_DoRow takes nothing returns nothing
local real x = mapMinX+256.
local real y = mapMinY+256.
local integer iX = bj_forLoopAIndex
local integer iY = 0
loop
exitwhen y+iY*512.>mapMaxY
set camOffset[(iX+1)][iY+1] = cameramapInit_GridSub(x+iX*512.,y+iY*512.)
set iY = iY + 1
endloop
endfunction
function cameramapInit takes nothing returns nothing
local real x
local real y
local integer iX = 0
local integer iY
local rect map = GetWorldBounds()
set mapMinX = GetRectMinX(map)
set mapMinY = GetRectMinY(map)
set mapMaxX = GetRectMaxX(map)
set mapMaxY = GetRectMaxY(map)
call RemoveRect(map)
set map = null
set x = mapMinX+256.
set y = mapMinY+256.
set cameramapLoc = Location(0,0)
loop
exitwhen x+iX*512.>mapMaxX
set bj_forLoopAIndex = iX
call ExecuteFunc("cameramapInit_DoRow")
set iX = iX + 1
endloop
call RemoveLocation(cameramapLoc)
set cameramapLoc = null
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library Bezier
globals
//Points
real array P0X
real array P0Y
real array P0Z
real array P1X
real array P1Y
real array P1Z
real array P2X
real array P2Y
real array P2Z
//Output Points
real BX = 0
real BY = 0
real BZ = 0
//Derivative Outputs
real dBX = 0
real dBY = 0
real dBZ = 0
//Curve Input Stuff
real Input = 0
real didt = 0
//Stuff for picking the right curve
integer BC = 0
integer Incriment = 0
//Changes didt automatically when moving from Bezier curves of different endpoint velocities if true
boolean AutoVSmoothing = true
endglobals
//f and s are first and second
function GetBezierRelativeV takes integer f, integer s returns real
local real a = (P2X[f] - P1X[f])*(P2X[f] - P1X[f]) + (P2Y[f] - P1Y[f])*(P2Y[f] - P1Y[f]) + (P2Z[f] - P1Z[f])*(P2Z[f] - P1Z[f])
local real b = (P1X[s] - P0X[s])*(P1X[s] - P0X[s]) + (P1Y[s] - P0Y[s])*(P1Y[s] - P0Y[s]) + (P1Z[s] - P0Z[s])*(P1Z[s] - P0Z[s])
return SquareRoot(a/b)
endfunction
function BIncriment takes nothing returns nothing
set Input = Input + didt
if Input > 1 then
set Input = Input - 1
set BC = BC + Incriment
if AutoVSmoothing == true and BC >= 1 then
if GetBezierRelativeV(BC - 1, BC) == 0 then
debug call BJDebugMsg("AutoVSmoothing Error, check bezier curve members")
endif
set didt = didt * GetBezierRelativeV(BC - 1, BC)
endif
endif
endfunction
function SetBCurve takes integer i, real x0, real y0, real z0, real x1, real y1, real z1, real x2, real y2, real z2 returns nothing
set P0X[i] = x0
set P0Y[i] = y0
set P0Z[i] = z0
set P1X[i] = x1
set P1Y[i] = y1
set P1Z[i] = z1
set P2X[i] = x2
set P2Y[i] = y2
set P2Z[i] = z2
endfunction
//c is the BCurve, ii is the input
function BCalculate takes integer c, real ii returns nothing
local real g = 1 - ii
set BX = P0X[c]*g*g + 2*ii*P1X[c]*g + P2X[c]*ii*ii
set BY = P0Y[c]*g*g + 2*ii*P1Y[c]*g + P2Y[c]*ii*ii
set BZ = P0Z[c]*g*g + 2*ii*P1Z[c]*g + P2Z[c]*ii*ii
endfunction
//c is the BCurve, i is the input
function Diff takes integer c, real i returns nothing
set dBX = 2 * (P0X[c]*i - P0X[c] + P1X[c] - 2*P1X[c]*i + P2X[c]*i)
set dBY = 2 * (P0Y[c]*i - P0Y[c] + P1Y[c] - 2*P1Y[c]*i + P2Y[c]*i)
set dBZ = 2 * (P0Z[c]*i - P0Z[c] + P1Z[c] - 2*P1Z[c]*i + P2Z[c]*i)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope CREDITS //initializer CredInit
globals
private integer CredI = 0
private texttag A
private texttag B
private texttag C
private texttag D
endglobals
private function TagBuild takes texttag tag, string text,real size,real height,real x returns nothing
call SetTextTagText(tag,text,size * 0.023 / 10)
call SetTextTagColor(tag,255,255,255,255)
call SetTextTagPos(tag,x,0,height)
endfunction
function CreditLoop takes nothing returns nothing
set CredI = CredI + 1
if CredI == 1 then
call CinematicFadeBJ(bj_CINEFADETYPE_FADEIN,2,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
call SetTerrainFogEx(0,490,500,0,0,0,0)
call TagBuild(A,"Credits",30,520,-16)
elseif CredI == 4 then
call CinematicFadeBJ(bj_CINEFADETYPE_FADEOUTIN,4,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
elseif CredI == 6 then
call TagBuild(A,"N-a-z-g-u-l",30,520,-23)
call TagBuild(C,"creator of",20,490,-15)
call TagBuild(B,"cameramap",20,480,-18)
elseif CredI == 9 then
call CinematicFadeBJ(bj_CINEFADETYPE_FADEOUTIN,4,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
elseif CredI == 11 then
call TagBuild(A,"Vexorian",30,520,-20)
call TagBuild(C,"creator of",20,490,-15)
call TagBuild(B,"TimerUtils",20,480,-15.5)
elseif CredI == 14 then
call CinematicFadeBJ(bj_CINEFADETYPE_FADEOUTIN,4,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
elseif CredI == 16 then
call TagBuild(A,"WILL_THE_",30,520,-41)
call TagBuild(D,"ALMIGHTY",30,520,3)
call TagBuild(C,"creator of",20,490,-15)
call TagBuild(B,"Explosion Models",12,480,-16)
elseif CredI == 19 then
call CinematicFadeBJ(bj_CINEFADETYPE_FADEOUTIN,4,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
elseif CredI == 21 then
call TagBuild(A,"Music",30,520,-14)
call TagBuild(D,"",30,520,3)
call TagBuild(C,"",20,490,-15)
call TagBuild(B,"",12,480,-16)
elseif CredI == 24 then
call CinematicFadeBJ(bj_CINEFADETYPE_FADEOUTIN,4,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
elseif CredI == 26 then
call TagBuild(A,"The Sacred War",20,520,-20)
call TagBuild(C,"By",20,490,-4)
call TagBuild(B,"Alexander Alexandrov",12,480,-16)
elseif CredI == 29 then
call CinematicFadeBJ(bj_CINEFADETYPE_FADEOUTIN,4,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
elseif CredI == 31 then
call TagBuild(A,"Entering the Stronghold",12,520,-17.5)
call TagBuild(C,"By",20,490,-4)
call TagBuild(B,"Danman 87",20,480,-14)
call TagBuild(D,"From Newgrounds",12,475,-13.85)
elseif CredI == 34 then
call CinematicFadeBJ(bj_CINEFADETYPE_FADEOUTIN,4,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
elseif CredI == 36 then
call TagBuild(A,"Cinematography inspired by",10,502,-17)
call TagBuild(B,"Sergei Bondarchuk",12,497,-14)
call TagBuild(C,"",20,490,-4)
call TagBuild(D,"",12,475,-13.85)
elseif CredI == 39 then
call CinematicFadeBJ(bj_CINEFADETYPE_FADEOUT,3,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
elseif CredI == 44 then
call CustomVictoryBJ(GetLocalPlayer(),false,false)
endif
endfunction
function CredInit takes nothing returns nothing
call TimerStart(NewTimer(),1,true,function CreditLoop)
call SetCameraCoord(0,-150,500,90,0,0)
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,70,0)
set A = CreateTextTag()
set B = CreateTextTag()
set C = CreateTextTag()
set D = CreateTextTag()
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope S3P1 //initializer S3P1Init
globals
private integer S3I = 0
private real SLIDEREAL = 8
private integer NUMBERLIVE = 52
endglobals
private function S38 takes nothing returns nothing
local integer LoopI = 0
set S3I = S3I + 1
if S3I == 10900 or S3I == 11700 then
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,20,0)
call SetCameraCoord(2200,340,90,180,-5,0)
elseif S3I == 11300 or S3I == 12200 then
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,70,0)
call SetCameraCoord(2150,570,70,0,0,0)
elseif S3I >= 12400 and S3I < 14113 then
if S3I == 12400 then
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,20,0)
elseif S3I >= 13000 then
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,45-25*Cos(bj_PI*(S3I-13000)/1113),0)
endif
call BCalculate(BC,Input)
call SetCameraCoord(BX,BY,BZ,180,5-10*Cos(bj_PI*(S3I-12400)/1713),0)
call BIncriment()
endif
if S3I == 11800 then
call SetCinematicScene(0,PLAYER_COLOR_RED,"Captain","Surrender!",3,0)
endif
if S3I == 12300 then
set LoopI = 0
loop
exitwhen LoopI == 14
call SetUnitAnimationByIndex(Actor[LoopI],7)
set LoopI = LoopI + 1
endloop
endif
if S3I == 12700 then
call SetUnitLookAt(Actor[61],"head",Actor[61],100,100,50)
endif
if S3I == 12800 then
call SetUnitFacing(Actor[61],45)
endif
if S3I == 13000 then
call SetUnitLookAt(Actor[61],"head",Actor[61],-300,0,200)
call SetUnitFacing(Actor[61],180)
endif
if S3I >= 13000 and S3I <= 13500 then
set LoopI = 100
loop
exitwhen LoopI == 105
call SetUnitFlyHeight(Actor[LoopI],200+100*Cos(bj_PI*(S3I-13000)/500),0)
set LoopI = LoopI + 1
endloop
endif
if S3I == 14400 then
call CinematicFadeBJ(bj_CINEFADETYPE_FADEOUT,2.5,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
endif
if S3I == 14700 then
call CredInit()
endif
endfunction
private function S37 takes nothing returns nothing
local integer LoopI = 0
set S3I = S3I + 1
if S3I < 8600 then
call SetCameraCoord(2200,570,60,0,0,0)
elseif S3I < 10200 then
call SetCameraCoord(600+.16*S3I,-200,90,90,-5,0)
elseif S3I < 10400 then
call SetCameraCoord(2232+.16*(S3I-10200)-.0004*(S3I-10200)*(S3I-10200),-200,90,90,-5,0)
endif
if S3I == 8600 then
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,80,0)
endif
if 201*((S3I)/201)==S3I then
set LoopI = 0
loop
exitwhen LoopI == 14
call SetUnitAnimationByIndex(Actor[LoopI],3)
set LoopI = LoopI + 1
endloop
elseif 201*((S3I-100)/201)==S3I-100 then
set LoopI = 14
loop
exitwhen LoopI == 27
call SetUnitAnimationByIndex(Actor[LoopI],3)
set LoopI = LoopI + 1
endloop
endif
set LoopI = 32
loop
exitwhen LoopI == NUMBERLIVE
call SetUnitX(Actor[LoopI],-950+.32*(S3I-1100))
set LoopI = LoopI + 1
endloop
set LoopI = 70
loop
exitwhen LoopI == 90
call SetUnitX(Actor[LoopI],-1050+.32*(S3I-1100))
set LoopI = LoopI + 1
endloop
call SetUnitX(Actor[61],-890+.32*(S3I-1100))
if 353*((S3I-30)/353)==(S3I-30) and S3I > 1100 then
call StartSound(gg_snd_A)
endif
if 353*((S3I-210)/353)==(S3I-210) and S3I > 1100 then
call StartSound(gg_snd_B)
endif
if S3I == 10400 then
call TimerStart(GetExpiredTimer(),.01,true,function S38)
set LoopI = 0
loop
exitwhen LoopI == 27
call SetUnitAnimationByIndex(Actor[LoopI],0)
set LoopI = LoopI + 1
endloop
set LoopI = 32
loop
exitwhen LoopI == NUMBERLIVE
call SetUnitAnimationByIndex(Actor[LoopI],7)
set LoopI = LoopI + 1
endloop
set LoopI = 70
loop
exitwhen LoopI == 90
call SetUnitAnimationByIndex(Actor[LoopI],7)
set LoopI = LoopI + 1
endloop
set LoopI = 100
loop
exitwhen LoopI == 105
call CreateActor(Player(1),'hgyr',1600,100+100*(LoopI-100),0,LoopI)
call SetUnitFlyHeight(Actor[LoopI],300,0)
set LoopI = LoopI + 1
endloop
call SetUnitAnimationByIndex(Actor[61],0)
call ResetBASystem()
set didt = .00175
set Incriment = 1
set currenth = 90
set BC = 0
call SetBCurve(0,2200,340,90,2200,340,90,2225,340,90)
call SetBCurve(1,2225,340,90,2250,340,90,2250,340,75)
call SetBCurve(2,2250,340,75,2250,340,60,2250,340,60)
endif
endfunction
private function S36 takes nothing returns nothing
local integer LoopI = 0
set S3I = S3I + 1
if S3I < 8000 then
call SetCameraCoord(2800,577.5,100+(S3I-4000)*.01,175+(S3I-4000)*.006,5-(S3I-4000)*.001,1-(S3I-4000)*.0045) //Horizontal .005, roll .006
elseif S3I >= 8000 and S3I <= 8050 then
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,70-(S3I-8000),0)
call SetCameraCoord(-740+.32*(S3I-1100),340,80,180,0,0) //350,80,180,0
elseif S3I > 8050 then
call SetCameraCoord(-740+.32*(S3I-1100),340,80,180,0,0)
endif
if S3I == 4001 then
call SetCameraField(CAMERA_FIELD_FARZ,10000,0)
call SetTerrainFogEx( 0, 0,10000, 0, 1, 1, .549 )
endif
if S3I < 7000 and S3I == 220*(S3I/220) then
call DestroyEffect(AddSpecialEffect("war3mapImported\\NewDirtEX.mdx",-700+.32*(S3I-1100)+120*Sin((S3I-3050)*2),580+700*Cos(8.6*((S3I-8000)/150))))
endif
if 201*((S3I)/201)==S3I then
set LoopI = 0
loop
exitwhen LoopI == 14
call SetUnitAnimationByIndex(Actor[LoopI],3)
set LoopI = LoopI + 1
endloop
elseif 201*((S3I-100)/201)==S3I-100 then
set LoopI = 14
loop
exitwhen LoopI == 27
call SetUnitAnimationByIndex(Actor[LoopI],3)
set LoopI = LoopI + 1
endloop
endif
set LoopI = 32
loop
exitwhen LoopI == NUMBERLIVE
call SetUnitX(Actor[LoopI],-950+.32*(S3I-1100))
set LoopI = LoopI + 1
endloop
set LoopI = 70
loop
exitwhen LoopI == 90
call SetUnitX(Actor[LoopI],-1050+.32*(S3I-1100))
set LoopI = LoopI + 1
endloop
call SetUnitX(Actor[61],-890+.32*(S3I-1100))
if 353*((S3I-30)/353)==(S3I-30) and S3I > 1100 then
call StartSound(gg_snd_A)
endif
if 353*((S3I-210)/353)==(S3I-210) and S3I > 1100 then
call StartSound(gg_snd_B)
endif
if S3I == 8400 then
call TimerStart(GetExpiredTimer(),.01,true,function S37)
endif
endfunction
private function S35 takes nothing returns nothing
local integer LoopI = 0
set S3I = S3I + 1
if S3I == 2815 then
call SetCameraCoord(2860,0,120,90,-.3,0)
elseif S3I > 3050 then
call SetCameraCoord(-800+.32*(S3I-1100),0,70,100,0,0)
endif
if S3I == 2850 then
call SetUnitAnimationByIndex(Actor[28],12)
elseif S3I == 2920 then
call SetUnitAnimationByIndex(Actor[31],12)
elseif S3I == 2940 then
call SetUnitAnimationByIndex(Actor[27],12)
elseif S3I == 2970 then
call SetUnitAnimationByIndex(Actor[30],12)
elseif S3I == 3020 then
call SetUnitAnimationByIndex(Actor[29],12)
elseif S3I == 3025 then
call SetUnitAnimationByIndex(Actor[28],12)
endif
if S3I >= 3050 and S3I == 75*(S3I/75) then
call DestroyEffect(AddSpecialEffect("war3mapImported\\NewDirtEX.mdx",-700+.32*(S3I-1100)+120*Sin((S3I-3050)*2),800+400*Cos((S3I-3050)*5)))
endif
if S3I == 3400 then
call DestroyEffect(AddSpecialEffect("war3mapImported\\NewDirtEX.mdx",-194,400))
set Actor[100]=Actor[36]
set Actor[36]=Actor[51]
call SetUnitAnimationByIndex(Actor[100],9)
set NUMBERLIVE = 51
endif
if S3I == 3500 then
call DestroyEffect(AddSpecialEffect("war3mapImported\\NewDirtEX.mdx",-162,1000))
set Actor[101]=Actor[47]
set Actor[47]=Actor[50]
call SetUnitAnimationByIndex(Actor[101],9)
set NUMBERLIVE = 50
endif
if S3I == 3620 then
call DestroyEffect(AddSpecialEffect("war3mapImported\\NewDirtEX.mdx",-120,920))
set Actor[102]=Actor[46]
set Actor[46]=Actor[49]
call SetUnitAnimationByIndex(Actor[102],9)
set NUMBERLIVE = 49
endif
if S3I == 3700 then
call DestroyEffect(AddSpecialEffect("war3mapImported\\NewDirtEX.mdx",-94,720))
set Actor[103]=Actor[41]
set Actor[41]=Actor[48]
call SetUnitAnimationByIndex(Actor[103],9)
set NUMBERLIVE = 48
endif
set LoopI = 32
loop
exitwhen LoopI == NUMBERLIVE
call SetUnitX(Actor[LoopI],-950+.32*(S3I-1100))
set LoopI = LoopI + 1
endloop
set LoopI = 70
loop
exitwhen LoopI == 90
call SetUnitX(Actor[LoopI],-1050+.32*(S3I-1100))
set LoopI = LoopI + 1
endloop
call SetUnitX(Actor[61],-890+.32*(S3I-1100))
if 356*((S3I-30)/356)==(S3I-30) and S3I > 1100 then
call StartSound(gg_snd_A)
endif
if 356*((S3I-210)/356)==(S3I-210) and S3I > 1100 then
call StartSound(gg_snd_B)
endif
if S3I == 4000 then
call TimerStart(GetExpiredTimer(),.01,true,function S36)
endif
endfunction
private function S34 takes nothing returns nothing
local integer LoopI = 0
set S3I = S3I + 1
if S3I == 400 then
call SetCameraCoord(1800,630,60,0,0,0)
elseif S3I == 800 then
call SetCameraCoord(200,550,230,180,-7.99,0)
elseif S3I >= 1100 and S3I <= 2813 then
call BCalculate(BC,Input)
call SetCameraCoord(BX,BY,BZ,180,GetVAngle(-.047*(BZ-60)),0)
call BIncriment()
endif
if S3I == 100 then
loop
exitwhen LoopI == 90
call SetUnitAnimationByIndex(Actor[LoopI],7)
call SetUnitTimeScale(Actor[LoopI],.3)
set LoopI = LoopI + 1
if LoopI == 52 then
set LoopI = 70
endif
endloop
call SetUnitAnimationByIndex(Actor[61],7)
call SetUnitTimeScale(Actor[61],.3)
call StartSound(gg_snd_SHIELD)
endif
if S3I >= 500 and S3I <= 565 then
set LoopI = 14
loop
exitwhen LoopI == 27
call SetUnitX(Actor[LoopI],2640-2*(S3I - 500))
set LoopI = LoopI + 1
endloop
endif
if S3I == 500 then
set LoopI = 14
loop
exitwhen LoopI == 27
call SetUnitAnimationByIndex(Actor[LoopI],6)
set LoopI = LoopI + 1
endloop
endif
if S3I == 565 then
set LoopI = 14
loop
exitwhen LoopI == 27
call SetUnitAnimationByIndex(Actor[LoopI],7)
set LoopI = LoopI + 1
endloop
endif
if S3I == 1100 then
set LoopI = 32
loop
exitwhen LoopI == 52
call SetUnitAnimationByIndex(Actor[LoopI],8)
set LoopI = LoopI + 1
endloop
set LoopI = 70
loop
exitwhen LoopI == 90
call SetUnitAnimationByIndex(Actor[LoopI],8)
set LoopI = LoopI + 1
endloop
call SetUnitAnimationByIndex(Actor[61],8)
endif
if S3I >= 1100 then
set LoopI = 32
loop
exitwhen LoopI == 52
call SetUnitX(Actor[LoopI],-950+.32*(S3I-1100))
set LoopI = LoopI + 1
endloop
set LoopI = 70
loop
exitwhen LoopI == 90
call SetUnitX(Actor[LoopI],-1050+.32*(S3I-1100))
set LoopI = LoopI + 1
endloop
call SetUnitX(Actor[61],-890+.32*(S3I-1100))
endif
if S3I == 1130 then
call StartSound(gg_snd_A)
endif
if 356*((S3I-30)/356)==(S3I-30) and S3I > 1100 then
call StartSound(gg_snd_A)
endif
if 356*((S3I-210)/356)==(S3I-210) and S3I > 1100 then
call StartSound(gg_snd_B)
endif
if S3I == 2814 then
call TimerStart(GetExpiredTimer(),.01,true,function S35)
endif
endfunction
private function S33 takes nothing returns nothing
set S3I = S3I + 1
if S3I < 500 then
call BCalculate(BC,Input)
call SetCameraCoord(BX,BY,BZ,90,0,0)
call BIncriment()
elseif S3I >= 500 and S3I <= 800 then
call BCalculate(BC,Input)
call SetCameraCoord(BX,BY,BZ,GetHAngle(180),GetVAngle(-30),0)
call BIncriment()
/*elseif S3I > 800 and S3I <= 1072 then
call BCalculate(BC,Input)
call SetCameraCoord(BX,BY,BZ,GetHAngle(180),GetVAngle(-20),0)
call BIncriment()
elseif S3I > 1072 and S3I < 1300 then
call SetCameraCoord(BX,BY,BZ,GetHAngle(currenth),GetVAngle(currentv),0)
endif*/
//==
elseif S3I > 800 and S3I <= 1072 then
call BCalculate(BC,Input)
call SetCameraCoord(BX,BY,BZ,GetHAngle(180),GetVAngle(-20),0)
call BIncriment()
elseif S3I > 1072 and S3I < 1142 then
call BCalculate(BC,Input)
call SetCameraCoord(BX,BY,BZ,GetHAngle(180),GetVAngle(-20),0)
call BIncriment()
endif
//==
if S3I == 1010 then
call StopSound(gg_snd_EtS,true,false)
endif
if S3I == 1300 then
set S3I = 0
call ResetBASystem()
set Incriment = 1
set didt = .00175
set BC = 0
set currenth = 180
set currentv = -7.99
call SetBCurve(0,200,550,230,200,550,230,200,550,145)
call SetBCurve(1,200,550,145,200,550,60,350,550,60)
call SetBCurve(2,350,550,60,500,550,60,500,550,60)
call TimerStart(GetExpiredTimer(),.01,true, function S34)
endif
endfunction
private function S32 takes nothing returns nothing
local real r
local integer LoopI = 0
set S3I = S3I + 1
set r = S3I*.4
if r <220 then
call SetCameraCoord(-2000+8*r,300,100-70*Sin(r*bj_DEGTORAD/2),135,-5*Sin(r*bj_DEGTORAD/2)+.2*Sin(120*r),0)
elseif S3I < 900 then
call SetCameraCoord(-1900+8*r,800,100-70*Sin(r*bj_DEGTORAD/2),180,-2-5*Sin(r*bj_DEGTORAD/2)+.2*Sin(120*r),0)
elseif S3I == 900 then
call SetCameraCoord(2400,0,70,90,0,0)
elseif S3I >= 1000 and S3I < 1150 then
call SetCameraCoord(2400,0,70,102.5-12.5*Cos(bj_PI*(S3I-1000)/150),0,0)
elseif S3I >= 1350 and S3I < 1500 then
call SetCameraCoord(2400,0,70,102.5+12.5*Cos(bj_PI*(S3I-1350)/150),0,0)
endif
if S3I == 1 then
call CinematicFadeBJ(bj_CINEFADETYPE_FADEIN,0,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
endif
if S3I == 960 then
loop
exitwhen LoopI == 14
call SetUnitAnimationByIndex(Actor[LoopI],7)
set LoopI = LoopI + 1
endloop
endif
if S3I == 1340 then
loop
exitwhen LoopI == 14
call SetUnitAnimationByIndex(Actor[LoopI],3)
set LoopI = LoopI + 1
endloop
call StartSound(gg_snd_BOOMA)
endif
if S3I == 1450 then
loop
exitwhen LoopI == 14
call SetUnitAnimationByIndex(Actor[LoopI],7)
set LoopI = LoopI + 1
endloop
endif
if S3I == 1500 then
loop
exitwhen LoopI == 14
call SetUnitAnimationByIndex(Actor[LoopI],0)
set LoopI = LoopI + 1
endloop
endif
if S3I < 1350 then
call SetUnitX(Actor[52],-2500+8*r)
call SetUnitX(Actor[53],-2600+8*r)
call SetUnitX(Actor[54],-2600+8*r)
call SetUnitX(Actor[55],-2580+8*r)
call SetUnitX(Actor[56],-2650+8*r)
call SetUnitX(Actor[57],-2520+8*r)
call SetUnitX(Actor[58],-2620+8*r)
call SetUnitX(Actor[59],-2630+8*r)
call SetUnitX(Actor[60],-2620+8*r)
endif
if S3I == 1350 then
call SetUnitAnimationByIndex(Actor[52],7)
elseif S3I == 1357 then
call SetUnitAnimationByIndex(Actor[53],7)
elseif S3I == 1360 then
call SetUnitAnimationByIndex(Actor[54],7)
call SetUnitAnimationByIndex(Actor[55],7)
elseif S3I == 1365 then
call SetUnitAnimationByIndex(Actor[56],7)
elseif S3I == 1366 then
call SetUnitAnimationByIndex(Actor[57],7)
call SetUnitAnimationByIndex(Actor[58],7)
elseif S3I == 1370 then
call SetUnitAnimationByIndex(Actor[59],7)
elseif S3I == 1373 then
call SetUnitAnimationByIndex(Actor[60],7)
endif
if S3I >= 1350 and S3I <= 1500 then
set SLIDEREAL = 3.2-.021333*(S3I-1350)
set LoopI = 0
loop
exitwhen LoopI == 9
call SetUnitX(Actor[LoopI+52],GetUnitX(Actor[LoopI+52])+SLIDEREAL)
set LoopI = LoopI + 1
endloop
endif
if S3I == 1600 then
call ResetBASystem()
set Incriment = 1
set BC = 0
set currenth = 90
set didt = .00175
call SetBCurve(0,2400,0,70,2400,0,70,1100,275,150)
call SetBCurve(1,1100,275,150,-200,550,230,-200,550,230)
set S3I = 0
set LoopI = 32
loop
exitwhen LoopI == 52
call SetUnitX(Actor[LoopI],-950)
call SetUnitY(Actor[LoopI],200+40*(LoopI-32))
call SetUnitFacing(Actor[LoopI],0)
set LoopI = LoopI + 1
endloop
set LoopI = 70
loop
exitwhen LoopI == 90
call CreateActor(Player(0),'hfoo',-1050,200+40*(LoopI-70),0,LoopI)
call SetUnitAnimationByIndex(Actor[LoopI],0)
set LoopI = LoopI + 1
endloop
call SetUnitX(Actor[61],-890)
call SetUnitY(Actor[61],350)
call SetUnitFacing(Actor[61],0)
call TimerStart(GetExpiredTimer(),.01,true,function S33)
endif
endfunction
private function S31 takes nothing returns nothing
local integer LoopI = 0
set S3I = S3I + 1
if S3I == 1 then
call SetTerrainFogEx( 0, 0, 4500, 0, 1, 1, .549 )
call CinematicFadeBJ(bj_CINEFADETYPE_FADEIN,2,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
endif
if S3I >= 200 and S3I <= 1340 then
call BCalculate(BC,Input)
call SetCameraCoord(BX,BY,BZ,90,0,0)
call BIncriment()
elseif S3I == 1400 then
set BC = 2
set Input = 0
call SetCameraCoord(10640,-20,110,180,0,0)
elseif S3I >= 1600 and S3I <= 3000 then
call BCalculate(BC,Input)
call SetCameraCoord(BX,BY,BZ,180,0,0)
call BIncriment()
elseif S3I > 3000 and S3I <= 3500 then
call BCalculate(BC,Input)
call SetCameraCoord(BX,BY,BZ,180,GetVAngle(-30),0)
call BIncriment()
elseif S3I >3500 and S3I <= 5000 then
call BCalculate(BC,Input)
call SetCameraCoord(BX,BY,BZ,GetHAngle(GetCoordTargetH(GetUnitX(Actor[54]),GetUnitY(Actor[54]))),GetVAngle(GetCoordTargetV(GetUnitX(Actor[54]),GetUnitY(Actor[54]),60)),0)
call BIncriment()
endif
if S3I == 1300 then
call CinematicFadeBJ(bj_CINEFADETYPE_FADEOUTIN,2,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
endif
if S3I == 3500 then
loop
exitwhen LoopI == 8
call SetUnitY(Actor[LoopI+52],830)
call SetUnitX(Actor[LoopI+52],8600-100*LoopI)
set LoopI = LoopI + 1
endloop
set LoopI = 0
endif
if S3I == 4500 then
loop
exitwhen LoopI == 8
call SetUnitFacingTimed(Actor[LoopI+52],90,5)
set LoopI = LoopI + 1
endloop
set LoopI = 0
endif
if S3I > 3500 and S3I < 4500 then
loop
exitwhen LoopI == 8
call SetUnitX(Actor[LoopI+52],8600-100*LoopI+2.2*(S3I-3500))
set LoopI = LoopI + 1
endloop
elseif S3I >= 4500 and S3I < 5000 then
loop
exitwhen LoopI == 8
call SetUnitX(Actor[LoopI+52],10800-100*LoopI+700*Cos(3*bj_PI/2 + bj_PI*(S3I-4500)/1000))
call SetUnitY(Actor[LoopI+52],1530+700*Sin(3*bj_PI/2 + bj_PI*(S3I-4500)/1000))
set LoopI = LoopI + 1
endloop
endif
if S3I == 4800 then
call CinematicFadeBJ(bj_CINEFADETYPE_FADEOUT,1,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
endif
if S3I == 5218 then
set S3I = 0
loop
exitwhen LoopI == 8
call ShowUnit(Actor[LoopI+52],false)
call KillUnit(Actor[LoopI+52])
set LoopI = LoopI + 1
endloop
call TimerStart(GetExpiredTimer(),.01,true,function S32)
call CreateActor(Player(0),'hkni',0,0,0,52)
call SetUnitAnimationByIndex(Actor[52],0)
call SetUnitTimeScale(Actor[52],1.25)
call SetUnitY(Actor[52],800)
call CreateActor(Player(0),'hkni',0,0,0,53)
call SetUnitAnimationByIndex(Actor[53],0)
call SetUnitTimeScale(Actor[53],1.15)
call SetUnitY(Actor[53],820)
call CreateActor(Player(0),'hkni',0,0,0,54)
call SetUnitAnimationByIndex(Actor[54],0)
call SetUnitTimeScale(Actor[54],1.1)
call SetUnitY(Actor[54],600)
call CreateActor(Player(0),'hkni',0,0,0,55)
call SetUnitAnimationByIndex(Actor[55],0)
call SetUnitTimeScale(Actor[55],1.22)
call SetUnitY(Actor[55],690)
call CreateActor(Player(0),'hkni',0,0,0,56)
call SetUnitAnimationByIndex(Actor[56],0)
call SetUnitTimeScale(Actor[56],1.05)
call SetUnitY(Actor[56],900)
call CreateActor(Player(0),'hkni',0,0,0,57)
call SetUnitAnimationByIndex(Actor[57],0)
call SetUnitTimeScale(Actor[57],1.02)
call SetUnitY(Actor[57],500)
call CreateActor(Player(0),'hkni',0,0,0,58)
call SetUnitAnimationByIndex(Actor[58],0)
call SetUnitTimeScale(Actor[58],.98)
call SetUnitY(Actor[58],1000)
call CreateActor(Player(0),'hkni',0,0,0,59)
call SetUnitAnimationByIndex(Actor[59],0)
call SetUnitTimeScale(Actor[59],1.2)
call SetUnitY(Actor[59],1100)
call CreateActor(Player(0),'hkni',0,0,0,60)
call SetUnitAnimationByIndex(Actor[60],0)
call SetUnitTimeScale(Actor[60],1.1)
call SetUnitY(Actor[60],1160)
endif
endfunction
function S3P1Init takes nothing returns nothing
local integer LoopI = 0
call ResetBASystem()
set Incriment = 1
set BC = 0
set currenth = 180
set didt = .00175
loop
exitwhen LoopI == 14
call CreateActor(Player(1),'hrif',2440,140+70*LoopI,180,LoopI)
call SetUnitAnimationByIndex(Actor[LoopI],0)
set LoopI = LoopI + 1
endloop
loop
exitwhen LoopI == 27
call CreateActor(Player(1),'hrif',2640,175+70*(LoopI-14),180,LoopI)
call SetUnitAnimationByIndex(Actor[LoopI],0)
set LoopI = LoopI + 1
endloop
loop
exitwhen LoopI == 32
call CreateActor(Player(1),'hmtt',2900,200+200*(LoopI-27),180,LoopI)
call SetUnitAnimationByIndex(Actor[LoopI],0)
set LoopI = LoopI + 1
endloop
loop
exitwhen LoopI == 37
call CreateActor(Player(0),'hfoo',10500-80*(LoopI-32),-20,90,LoopI)
call SetUnitAnimationByIndex(Actor[LoopI],0)
set LoopI = LoopI + 1
endloop
loop
exitwhen LoopI == 42
call CreateActor(Player(0),'hfoo',10500-80*(LoopI-37),50,90,LoopI)
call SetUnitAnimationByIndex(Actor[LoopI],0)
set LoopI = LoopI + 1
endloop
loop
exitwhen LoopI == 47
call CreateActor(Player(0),'hfoo',10500-80*(LoopI-42),120,90,LoopI)
call SetUnitAnimationByIndex(Actor[LoopI],0)
set LoopI = LoopI + 1
endloop
loop
exitwhen LoopI == 52
call CreateActor(Player(0),'hfoo',10500-80*(LoopI-47),190,90,LoopI)
call SetUnitAnimationByIndex(Actor[LoopI],0)
set LoopI = LoopI + 1
endloop
loop
exitwhen LoopI == 60
call CreateActor(Player(0),'hkni',-900,-8000,0,LoopI)
call SetUnitAnimationByIndex(Actor[LoopI],0)
call SetUnitTimeScale(Actor[LoopI],1+.1*Sin(LoopI*10))
set LoopI = LoopI + 1
endloop
call CreateActor(Player(0),'hcth',10500,260,90,61)
call SetUnitAnimationByIndex(Actor[61],0)
call SetCameraCoord(2840,0,70,90,0,0)
call SetBCurve(0,2840,0,70,2840,0,70,2620,0,70)
call SetBCurve(1,2620,0,70,2400,0,70,2400,0,70)
call SetBCurve(2,10640,-20,110,10640,-20,110,10640,120,110)
call SetBCurve(3,10640,120,110,10640,260,110,10640,260,110)
call SetBCurve(4,10640,260,110,10640,260,110,10640,260,200)
call SetBCurve(5,10640,260,200,10640,260,290,10640,530,290)
call SetBCurve(6,10640,530,290,10640,800,290,10640,800,290)
call SetBCurve(7,10640,800,290,10640,800,290,10640,800,290)
call SetBCurve(8,10640,800,290,10640,800,290,10640,800,290)
call CinematicFadeBJ(bj_CINEFADETYPE_FADEIN,2,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
call TimerStart(NewTimer(),.01,true,function S31)
endfunction
endscope
//============
//============
scope S2P1 //initializer S2P1Init
globals
private integer S2P1I = 0
endglobals
private function S2P12 takes nothing returns nothing
local integer LoopI = 0
if S2P1I >= 1450 and S2P1I <= 2500 then
call SetCameraCoord(12040+(S2P1I-1450),-10000,40,90,0,0)
endif
if S2P1I <1450 then
if 15*(S2P1I/15)==S2P1I then
set LoopI = ModuloInteger(S2P1I,450)/15
call SetUnitY(Actor[LoopI],-8950+250*Sin(S2P1I))
call SetUnitX(Actor[LoopI],7600)
endif
set LoopI = 0
loop
exitwhen LoopI == 30
call SetUnitX(Actor[LoopI],GetUnitX(Actor[LoopI])-2.222222)
set LoopI = LoopI + 1
endloop
elseif S2P1I == 1450 then
call SetTerrainFogEx( 0, 0, 500, 0, 1, 1, .549 )
loop
exitwhen LoopI == 30
call ShowUnit(Actor[LoopI],false)
call KillUnit(Actor[LoopI])
set LoopI = LoopI + 1
endloop
call CreateActor(Player(1),'hgyr',12200,0,270,0)
call SetUnitAnimationByIndex(Actor[0],0)
call SetUnitFlyHeight(Actor[0],80,0)
call CreateActor(Player(1),'hrif',12480,0,270,1)
call SetUnitTimeScale(Actor[1],1.1)
call SetUnitAnimationByIndex(Actor[1],6)
call CreateActor(Player(1),'hrif',12700,0,270,2)
call SetUnitTimeScale(Actor[2],.9)
call SetUnitAnimationByIndex(Actor[2],6)
call CreateActor(Player(1),'hmtt',12800,0,270,3)
call SetUnitTimeScale(Actor[3],.6)
call SetUnitAnimationByIndex(Actor[3],2)
call CinematicFadeBJ(bj_CINEFADETYPE_FADEIN,1,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
endif
if S2P1I == 450 then
call CinematicFadeBJ(bj_CINEFADETYPE_FADEOUT,9,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
endif
if S2P1I >= 1500 and S2P1I <= 1800 then
call SetUnitY(Actor[0],-9400-2*(S2P1I-1500))
endif
if S2P1I >= 1750 and S2P1I <= 2050 then
call SetUnitY(Actor[1],-9400-2*(S2P1I-1750))
endif
if S2P1I >= 2000 and S2P1I <= 2300 then
call SetUnitY(Actor[2],-9400-2*(S2P1I-2000))
endif
if S2P1I >= 1940 and S2P1I <= 2500 then
call SetUnitY(Actor[3],-9400-(S2P1I-1940))
endif
if S2P1I == 2300 then
call CinematicFadeBJ(bj_CINEFADETYPE_FADEOUT,2,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
endif
if S2P1I == 2500 then
call ShowUnit(Actor[0],false)
call KillUnit(Actor[0])
call ShowUnit(Actor[1],false)
call KillUnit(Actor[1])
call ShowUnit(Actor[2],false)
call KillUnit(Actor[2])
call ShowUnit(Actor[3],false)
call KillUnit(Actor[3])
call ReleaseTimer(GetExpiredTimer())
call S3P1Init()
endif
set S2P1I = S2P1I + 1
endfunction
private function S2P11 takes nothing returns nothing
set S2P1I = S2P1I + 1
if S2P1I == 1 then
call SetTerrainFogEx( 0, 0, 2050, 0, .6, .6, .6 )
call CinematicFadeBJ(bj_CINEFADETYPE_FADEIN,1,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
call SetCameraCoord(5130,-10360,130,90,0,0)
elseif (S2P1I >= 300 and S2P1I <= 4290) or (S2P1I > 5300 and S2P1I <= 5870) then
call BCalculate(BC,Input)
call SetCameraCoord(BX,BY,BZ,GetHAngle(GetFollowH()),GetVAngle(GetFollowV()),GetRollAngle(GetFollowRoll(),-100))
call BIncriment()
elseif S2P1I >= 4400 and S2P1I <= 4450 then
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,70-(S2P1I-4400),0)
elseif S2P1I >= 5150 and S2P1I <= 5200 then
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,20+(S2P1I-5150),0)
elseif S2P1I >= 5871 and S2P1I <= 7010 then
call BCalculate(BC,Input)
call SetCameraCoord(BX,BY,BZ,GetHAngle(270),GetVAngle(12),GetRollAngle(0,-100))
call BIncriment()
endif
if S2P1I == 299 then
set AngularA = .0001
endif
if AngularA < .005 then
set AngularA = AngularA + .000025
endif
if S2P1I == 2200 then
call SetUnitX(Actor[0],7117)
call SetUnitY(Actor[0],-8190)
endif
if S2P1I == 3300 then
call SetUnitAnimationByIndex(Actor[0],6)
call StartSound(gg_snd_EtS)
endif
if S2P1I >= 3300 and S2P1I <= 3900 then
call SetUnitY(Actor[0],-8190 + 2*(S2P1I-3300))
endif
if S2P1I == 3900 then
call SetUnitLookAt(Actor[0],"head",Actor[1],0,0,150)
call SetUnitAnimationByIndex(Actor[0],0)
endif
if S2P1I == 4000 then
call SetCinematicScene(0,PLAYER_COLOR_RED,"A Captain","The dwarves have destroyed the raid party!",4,0)
call SetUnitAnimationByIndex(Actor[1],3)
endif
if S2P1I == 4450 then
call SetCinematicScene(0,PLAYER_COLOR_RED,"The King","We shall launch an attack! Ready the troops!",7,0)
endif
if S2P1I == 5150 then
call SetUnitAnimationByIndex(Actor[1],0)
endif
if S2P1I == 5250 then
call SetUnitLookAt(Actor[0],"head",Actor[0],1000,0,50)
call StartSound(gg_snd_THoC)
endif
if S2P1I == 5300 then
call SetUnitFacing(Actor[0],0)
set BC = 7
set Input = 0
endif
if S2P1I == 7010 then
set S2P1I = 0
call ResetBASystem()
set didt = .00175
set Incriment = 1
set BC = 0
call ShowUnit(Actor[0],false)
call KillUnit(Actor[0])
call ShowUnit(Actor[1],false)
call KillUnit(Actor[1])
loop
exitwhen S2P1I == 30
if S2P1I <= 27 then
call CreateActor(Player(0),'hfoo',0,0,180,S2P1I)
call SetUnitAnimationByIndex(Actor[S2P1I],6)
call SetUnitTimeScale(Actor[S2P1I],1+.15*Sin(100*S2P1I))
else
call CreateActor(Player(0),'hkni',0,0,180,S2P1I)
call SetUnitTimeScale(Actor[S2P1I],.7+.1*Sin(100*S2P1I))
call SetUnitAnimationByIndex(Actor[S2P1I],0)
endif
set S2P1I = S2P1I + 1
endloop
set S2P1I = 0
call TimerStart(GetExpiredTimer(),.01,true,function S2P12)
endif
endfunction
function S2P1Init takes nothing returns nothing
call ResetBASystem()
set didt = .00175
set Incriment = 1
set currenth = 90
set BC = 0
call CreateActor(Player(0),'hcth',0,0,90,0)
call SetUnitAnimationByIndex(Actor[0],0)
call CreateActor(Player(0),'H005',7169.25,-6685.75,268,1)
call SetUnitAnimationByIndex(Actor[1],0)
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,70,0)
call SetBCurve(0,5130,-10360,130,5130,-10360,130,5060,-9630,130)
call SetBCurve(1,5060,-9630,130,4990,-8900,130,5600,-9000,130)
call SetBCurve(2,5600,-9000,130,6210,-9100,130,6510,-9400,100)
call SetBCurve(3,6510,-9400,100,6810,-9700,70,6989,-9700,70)
call SetBCurve(4,6989,-9700,70,7168,-9700,70,7168,-9030,125)
call SetBCurve(5,7168,-9030,125,7168,-8360,180,7168,-7760,175)
call SetBCurve(6,7168,-7760,175,7168,-7160,170,7168,-7160,170)
call SetBCurve(7,7168,-7160,170,7168,-7160,170,7168,-7760,150)
call SetBCurve(8,7168,-7760,150,7168,-8360,130,7168,-8430,-80)//with this curve, approach h=270 and v=0
call SetBCurve(9,7168,-8430,-80,7168,-8500,-290,7168,-8500,-290)
call TimerStart(NewTimer(),.01,true,function S2P11)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope S1P1 initializer Init
globals
private integer S1P1I = 0
private real r = 0
endglobals
private function S1P13 takes nothing returns nothing
set S1P1I = S1P1I + 1
if S1P1I == 1 then
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,70,0)
call SetTerrainFogEx( 0, 0, 2200, 0, 1, 1, .549 )
endif
if S1P1I <= 880 then
set r = S1P1I*.4-180
call SetCameraCoord(-2200+800*Cos(bj_DEGTORAD*r),-5000+1300*Sin(bj_DEGTORAD*r),520 - 330*Cos(bj_DEGTORAD*(r-20)),bj_RADTODEG*Atan2(1300*Cos(bj_DEGTORAD*r),-800*Sin(bj_DEGTORAD*r)),(bj_RADTODEG*Atan2(330*Sin(bj_DEGTORAD*(r-20)),SquareRoot((-800*Sin(bj_DEGTORAD*r))*(-800*Sin(bj_DEGTORAD*r)) + (1300*Cos(bj_DEGTORAD*r))*(1300*Cos(bj_DEGTORAD*r))))),-45+20*Cos(2*bj_DEGTORAD*r))
elseif S1P1I == 881 then
call SetCameraCoord(-1410,-4280,66,90,0,0)
call SetUnitLookAt(Actor[0],"head",Actor[0],0,-4500,50)
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,20,0)
elseif S1P1I == 1400 then
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,70,0)
call SetCameraCoordTarget(-1410,-4500,66,-1490,-6200,0,0)
elseif S1P1I == 1590 then
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,30,0)
call SetCameraCoord(-1610,-6000,100,-45,-10,0)
elseif S1P1I == 1820 then
call SetCameraCoord(-1410,-4280,66,90,0,0)
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,20,0)
/*elseif S1P1I >= 2000 and S1P1I <= 2060 then
call SetCameraCoord(-1410,-4280-12*(S1P1I-2000),66,90,0,0)
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,S1P1I-1980,0)*/
elseif S1P1I >= 2000 and S1P1I <= 2040 then
call SetCameraCoord(-1410,-4280-18*(S1P1I-2000),66,90,0,0)
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,20+2.5*(S1P1I-2000),0)
elseif S1P1I == 2700 then
call SetCameraCoord(0,0,0,0,0,0)
endif
if S1P1I == 370 then
call StartSound(gg_snd_GyrocopterImpactHit1)
endif
if S1P1I >= 380 and S1P1I <= 420 and 2*(S1P1I/2) == S1P1I then
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl",-1420+200*Cos(S1P1I*5),-4430+150*Sin(S1P1I*9)))
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\GyroCopter\\GyroCopterImpact.mdl",-1420+200*Cos(S1P1I*7),-4430+150*Sin(S1P1I*4)))
endif
if S1P1I == 400 then
call SetUnitAnimationByIndex(Actor[3],4)
endif
if S1P1I == 410 then
call SetUnitAnimationByIndex(Actor[4],4)
endif
if S1P1I == 1100 then
call SetUnitLookAt(Actor[0],"head",Actor[0],600,-4500,140)
call SetUnitX(Actor[13],-1410)
call SetUnitY(Actor[13],-6200)
endif
if S1P1I == 1760 then
call SetUnitAnimationByIndex(Actor[13],4)
endif
if S1P1I == 2200 then
call CreateActor(Player(1),'hgry',-1440,-4300,90,14)
call UnitApplyTimedLife(Actor[14],'BTLF',5)
endif
if S1P1I == 2205 then
call SetUnitAnimationByIndex(Actor[0],9)
call SetUnitAnimationByIndex(Actor[2],9)
call SetUnitAnimationByIndex(Actor[5],4)
endif
if S1P1I == 2400 then
call CinematicFadeBJ(bj_CINEFADETYPE_FADEOUT,3,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
endif
if S1P1I == 3280 then
call StopSound(gg_snd_SW,false,true)
call ShowUnit(Actor[0],false)
call KillUnit(Actor[0])
call ShowUnit(Actor[1],false)
call KillUnit(Actor[1])
call ShowUnit(Actor[2],false)
call KillUnit(Actor[2])
call ShowUnit(Actor[3],false)
call KillUnit(Actor[3])
call ShowUnit(Actor[4],false)
call KillUnit(Actor[4])
call ShowUnit(Actor[5],false)
call KillUnit(Actor[5])
call ShowUnit(Actor[13],false)
call KillUnit(Actor[13])
call ReleaseTimer(GetExpiredTimer())
call S2P1Init()
endif
endfunction
private function S1P12 takes nothing returns nothing
set S1P1I = S1P1I + 1
if S1P1I < 300 then
call SetCameraCoord(-1800+.3*S1P1I,-4600,400,45,-48,0)
elseif S1P1I == 300 or S1P1I == 1050 then
call SetCameraCoord(-1410,-4320,60,90,0,0)
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,20,0)
elseif S1P1I > 750 and S1P1I < 1050 then
call SetUnitY(Actor[6],-7700+2*S1P1I)
call SetUnitY(Actor[7],-7800+2*S1P1I)
call SetUnitFlyHeight(Actor[6],200-GetPointZ(-960,-7700+2*S1P1I),0)
call SetUnitFlyHeight(Actor[7],200-GetPointZ(-900,-7800+2*S1P1I),0)
call SetCameraCoordTarget(-1410,-4320,60,-960,-7700+2*S1P1I,150,0)
elseif S1P1I == 1350 then
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,70,0)
call SetCameraCoord(-1700,-5070,50,10,0,0)
call SetUnitTimeScale(Actor[1],.8)
call SetUnitAnimationByIndex(Actor[1],6)
elseif S1P1I == 1900 then
call SetCameraCoord(-1290,-4500,75,260,80,0)
call CreateActor(Player(0),'hmpr',-1260,-4510,0,8)
call UnitApplyTimedLife(Actor[8],'BTLF',10)
elseif S1P1I >= 2350 and S1P1I < 3850 then
call BCalculate(BC,Input)
call SetCameraCoord(BX,BY,BZ,GetHAngle(GetCoordTargetH(-1100,-4500-2*(S1P1I-2150))),GetVAngle(GetCoordTargetV(-1100,-4500-2*(S1P1I-2150),100)),0)
call BIncriment()
elseif S1P1I == 3850 then
call SetUnitTimeScale(Actor[0],.2)
call SetCameraCoord(-1410,-4280,66,90,0,0)
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,20,0)
endif
if S1P1I == 250 then
call CinematicFadeBJ(bj_CINEFADETYPE_FADEOUTIN,1,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
endif
if S1P1I == 550 then
call SetUnitX(Actor[1],-1020)
call SetUnitY(Actor[1],-4800)
call SetUnitLookAt(Actor[0],"head",Actor[0],100,-1000,200)
endif
if S1P1I == 750 then
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,100,0)
call SetUnitTimeScale(Actor[0],1)
endif
if S1P1I > 800 and S1P1I < 840 then
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW,100-2*(S1P1I-800),0)
endif
if S1P1I == 800 then
call StartSound(gg_snd_SW)
call SetUnitFacing(Actor[1],270)
endif
if S1P1I >= 1350 and S1P1I < 1800 then
call SetUnitY(Actor[6],-6000+10*(S1P1I-1350))
call SetUnitFlyHeight(Actor[6],200-GetPointZ(-1020,-6000+10*(S1P1I-1350)),0)
call SetUnitX(Actor[6],-1020)
if S1P1I < 1600 then
call SetUnitY(Actor[1],-4730-(S1P1I-1350))
endif
endif
if S1P1I >= 1550 and S1P1I <= 1600 and 5*(S1P1I/5)==S1P1I then
call DestroyEffect(AddSpecialEffect("war3mapImported\\NewDirtEX.mdx",-1020,10*S1P1I - 20705))
endif
if S1P1I == 1575 then
call SetUnitAnimationByIndex(Actor[1],9)
endif
if S1P1I == 1950 then
call SetUnitFacing(Actor[7],180)
call SetUnitY(Actor[7],-4540)
call SetUnitX(Actor[6],-1290)
call CreateActor(Player(1),'h000',-1290,0,90,9)
endif
if S1P1I >= 1970 and S1P1I <= 2070 then
call SetUnitX(Actor[7],-1000-10*(S1P1I-1970))
call SetUnitFlyHeight(Actor[7],200-GetPointZ(-1000-10*(S1P1I-1970),-4570),0)
endif
if S1P1I >= 2100 and S1P1I <= 2170 then
call SetUnitY(Actor[9],-4700+10*(S1P1I-2100))
call SetUnitFlyHeight(Actor[9],200-GetPointZ(-1290,-4700+10*(S1P1I-2100)),0)
endif
if S1P1I >= 2250 and S1P1I <= 2350 then
call SetUnitY(Actor[6],-4700+10*(S1P1I-2250))
call SetUnitFlyHeight(Actor[6],250-GetPointZ(-1290,-4700+10*(S1P1I-2250)),0)
endif
if S1P1I >= 1900 and S1P1I <= 2600 and 50*(S1P1I/50)==S1P1I then
set bj_lastCreatedUnit = CreateUnit(Player(0),'h001',-1290+200*Cos(S1P1I*7),-4600+150*Sin(S1P1I*7),0)
call SetUnitFlyHeight(bj_lastCreatedUnit,3000,750)
call UnitApplyTimedLife(bj_lastCreatedUnit,'BTLF',4)
endif
if S1P1I == 2800 then
call CreateActor(Player(0),'h002',-1400,-4300,288,10)
call UnitApplyTimedLife(Actor[10],'BTLF',4.6)
call SetUnitX(Actor[6],-1550)
call SetUnitX(Actor[7],-1900)
call SetUnitFacing(Actor[6],270)
call SetUnitFacing(Actor[7],300)
endif
if S1P1I >= 2950 and S1P1I <= 3500 then
call SetUnitY(Actor[6],-4200 - 5*(S1P1I-2950))
call SetUnitY(Actor[7],-4100 - 5*(S1P1I-2950))
call SetUnitX(Actor[7],-1900 + 2.89*(S1P1I-2950))
call SetUnitFlyHeight(Actor[6],200-GetPointZ(-1550,-4100 - 5*(S1P1I-2950)),0)
call SetUnitFlyHeight(Actor[7],200-GetPointZ(-1900 + 2.89*(S1P1I-2950),-4100 - 5*(S1P1I-2950)),0)
endif
if S1P1I >= 3110 and S1P1I <= 3260 then
call SetUnitX(Actor[10],-1400+2.6666*(S1P1I-3110))
call SetUnitY(Actor[10],-4300-9*(S1P1I-3110))
call SetUnitFlyHeight(Actor[10],1.333*(S1P1I-3110)-GetPointZ(-1400+2.6666*(S1P1I-3110),-4300-9*(S1P1I-3110)),0)
endif
if S1P1I == 3260 then
call SetUnitAnimationByIndex(Actor[7],8)
set bj_lastCreatedUnit = CreateUnit(Player(0),'hdhw',-1000,-5650,0)
call UnitApplyTimedLife(bj_lastCreatedUnit,'BTLF',10)
endif
if S1P1I == 3900 then
call SetUnitLookAt(Actor[0],"head",Actor[0],-200,-1000,270)
endif
if S1P1I == 4025 then
call SetUnitLookAt(Actor[0],"head",Actor[0],400,-1000,300)
endif
if S1P1I == 4300 then
call SetUnitLookAt(Actor[0],"head",Actor[0],0,-1000,140)
endif
if S1P1I == 4560 then
set S1P1I = 0
call ShowUnit(Actor[9],false)
call KillUnit(Actor[9])
call ShowUnit(Actor[6],false)
call KillUnit(Actor[6])
call ShowUnit(Actor[7],false)
call KillUnit(Actor[7])
call TimerStart(GetExpiredTimer(),.01,true,function S1P13)
endif
endfunction
private function S1P11 takes nothing returns nothing
if 4*(S1P1I/4)==S1P1I then
call StartSound(gg_snd_KodoDrum1)
endif
if S1P1I == 1 then
call SetCinematicScene(0,PLAYER_COLOR_RED,"","One day, there were two lands. A human kingdom and an autonomous dwarven commune.",9,0)
endif
if S1P1I == 11 then
call SetCinematicScene(0,PLAYER_COLOR_RED,"","The human king wanted to ensure that there would never be communist expansion, so he sent a raid party into the dwarven lands.",8,0)
endif
if S1P1I == 20 then
call SetCinematicScene(0,PLAYER_COLOR_RED,"","The dwarves responded angrily.",4,0)
endif
if S1P1I == 26 then
set S1P1I = 0
call SetCameraCoord(-1800,-4600,400,45,-30,0)
call TimerStart(GetExpiredTimer(),.01,true,function S1P12)
call CinematicFadeBJ(bj_CINEFADETYPE_FADEIN,0.50,"ReplaceableTextures\\CameraMasks\\White_mask.blp",0,0,0,0)
endif
set S1P1I = S1P1I + 1
endfunction
private function Init takes nothing returns nothing
call ResetBASystem()
call CreateActor(Player(0),'hcth',-1400,-4150,270,0)
call SetUnitAnimationByIndex(Actor[0],0)
call SetUnitTimeScale(Actor[0],.3)
call SetUnitLookAt(Actor[0],"head",Actor[0],-10,-100,50)
call CreateActor(Player(0),'hfoo',-1660,-4160,315,1)
call SetUnitAnimationByIndex(Actor[1],0)
call CreateActor(Player(0),'hfoo',-1800,-430,220,2)
call SetUnitAnimationByIndex(Actor[2],0)
call CreateActor(Player(0),'nhea',-1500,-4600,340,3)
call SetUnitAnimationByIndex(Actor[3],0)
call CreateActor(Player(0),'nhea',-1275,-4630,210,4)
call SetUnitAnimationByIndex(Actor[4],0)
call CreateActor(Player(0),'nhea',-1750,-4400,45,5)
call SetUnitAnimationByIndex(Actor[5],0)
call CreateActor(Player(1),'hgyr',-960,0,90,6)
call CreateActor(Player(1),'hgyr',-900,0,90,7)
call CreateActor(Player(1),'hmtt',0,0,90,13)
call SetBCurve(0,-1290,-4500,75,-1290,-4500,75,-1350,-4400,125)
call SetBCurve(1,-1350,-4400,125,-1410,-4300,175,-1410,-4500,200)
call SetBCurve(2,-1410,-4500,200,-1410,-4700,225,-1410,-4700,225)
set didt = .002
set Incriment = 1
set currenth = 260
set currentv = 80
set AngularA = .002
call TimerStart(NewTimer(),1,true,function S1P11)
endfunction
endscope