|
楼主 |
发表于 2009-8-20 18:39:21
|
显示全部楼层
更新的
effect,weathereffect,texttag,fogmodifier,lightning
的代码:
[jass]
globals
Effect array All_Effects
integer All_Effects_Number = 0
endglobals
struct Effect
static integer MaxNumber = 500
real x
real y
widget target
string attach
string model
effect e
Effect before
Effect next
static Effect top = 0
method GetIndex takes World P returns integer
return P * Effect.MaxNumber + this
endmethod
method init takes nothing returns nothing
local World W = GetUser( GetLocalPlayer() ).Place
local Effect move = this.GetIndex( W - 1 )
if this.e != null then
call DestroyEffect( this.e )
endif
if this.target != null then
set this.e = AddSpecialEffectTarget( move.model, this.target, this.attach )
else
set this.e = AddSpecialEffect( move.model, this.x, this.y )
endif
endmethod
static method initAll takes nothing returns nothing
local Effect this = Effect.top
loop
exitwhen this == 0
call this.init()
set this = this.next
endloop
endmethod
method updateModel takes World W, string model returns nothing
local Effect move = this.GetIndex( W - 1 )
set move.model = model
if IsPlayerInForce( GetLocalPlayer(), W.Users ) then
call this.init()
endif
endmethod
//if update other member values, call the method: init()
static method create takes real x, real y, widget target, string attach returns Effect
local Effect new = Effect.allocate()
local Effect move = 0
local integer i = 0
set new.x = x
set new.y = y
set new.target = target
set new.attach = attach
if Effect.top != 0 then
set new.before = 0
set new.next = Effect.top
endif
set Effect.top = new
loop
exitwhen i >= Const_WorldNumber
set move = new.GetIndex( i )
set move.model = Register_EffectModels
set i = i + 1
endloop
return new
endmethod
method Delete takes nothing returns nothing
set this.x = 0.0
set this.y = 0.0
if this.before == 0 then
set Effect.top = this.next
else
set this.before.next = this.next
endif
if this.next != 0 then
set this.next.before = this.before
endif
set this.next = 0
set this.before = 0
call this.destroy()
endmethod
endstruct
struct TextTag
static integer MaxNumber = 500
boolean show
texttag t
TextTag before
TextTag next
static TextTag top = 0
method GetIndex takes World P returns integer
return P * TextTag.MaxNumber + this
endmethod
method change takes player p, World W returns nothing
local TextTag move = this.GetIndex( W - 1 )
if move.show then
if GetLocalPlayer() == p then
call SetTextTagVisibility( this.t, true )
endif
else
if GetLocalPlayer() == p then
call SetTextTagVisibility( this.t, false )
endif
endif
endmethod
static method changeAll takes player p, World W returns nothing
local TextTag this = TextTag.top
loop
exitwhen this == 0
call this.change( p, W )
set this = this.next
endloop
endmethod
method init takes nothing returns nothing
local World W = GetUser( GetLocalPlayer() ).Place
local TextTag move = this.GetIndex( W - 1 )
if this.t != null then
if move.show then
call SetTextTagVisibility( this.t, true )
else
call SetTextTagVisibility( this.t, false )
endif
endif
endmethod
method updateShow takes World W, boolean show returns nothing
local TextTag move = this.GetIndex( W - 1 )
set move.show = show
if IsPlayerInForce( GetLocalPlayer(), W.Users ) then
call this.init()
endif
endmethod
//if update other member values, call the method: init()
static method create takes texttag t returns TextTag
local TextTag new = TextTag.allocate()
local TextTag move = 0
local integer i = 0
set new.t = t
if TextTag.top != 0 then
set new.before = 0
set new.next = TextTag.top
endif
set TextTag.top = new
loop
exitwhen i >= Const_WorldNumber
set move = new.GetIndex( i )
set move.show = Register_TextTagShows
set i = i + 1
endloop
return new
endmethod
method Delete takes nothing returns nothing
set this.t = null
if this.before == 0 then
set TextTag.top = this.next
else
set this.before.next = this.next
endif
if this.next != 0 then
set this.next.before = this.before
endif
set this.next = 0
set this.before = 0
call this.destroy()
endmethod
endstruct
struct Weather
static integer MaxNumber = 500
boolean show
weathereffect t
Weather before
Weather next
static Weather top = 0
method GetIndex takes World P returns integer
return P * Weather.MaxNumber + this
endmethod
method change takes player p, World W returns nothing
local Weather move = this.GetIndex( W - 1 )
if move.show then
if GetLocalPlayer() == p then
call EnableWeatherEffect( this.t, true )
endif
else
if GetLocalPlayer() == p then
call EnableWeatherEffect( this.t, false )
endif
endif
endmethod
static method changeAll takes player p, World W returns nothing
local Weather this = Weather.top
loop
exitwhen this == 0
call this.change( p, W )
set this = this.next
endloop
endmethod
method init takes nothing returns nothing
local World W = GetUser( GetLocalPlayer() ).Place
local Weather move = this.GetIndex( W - 1 )
if move.show then
call EnableWeatherEffect( this.t, true )
else
call EnableWeatherEffect( this.t, false )
endif
endmethod
method updateShow takes World W, boolean show returns nothing
local Weather move = this.GetIndex( W - 1 )
set move.show = show
if IsPlayerInForce( GetLocalPlayer(), W.Users ) then
call this.init()
endif
endmethod
//if update other member values, call the method: init()
static method create takes weathereffect t returns Weather
local Weather new = Weather.allocate()
local Weather move = 0
local integer i = 0
set new.t = t
if Weather.top != 0 then
set new.before = 0
set new.next = Weather.top
endif
set Weather.top = new
loop
exitwhen i >= Const_WorldNumber
set move = new.GetIndex( i )
set move.show = Register_WeatherShows
set i = i + 1
endloop
return new
endmethod
method Delete takes nothing returns nothing
set this.t = null
if this.before == 0 then
set Weather.top = this.next
else
set this.before.next = this.next
endif
if this.next != 0 then
set this.next.before = this.before
endif
set this.next = 0
set this.before = 0
call this.destroy()
endmethod
endstruct
struct Lightning
static integer MaxNumber = 500
real alpha
lightning t
Lightning before
Lightning next
static Lightning top = 0
method GetIndex takes World P returns integer
return P * Lightning.MaxNumber + this
endmethod
static method SetLightningAlpha takes lightning l, real a returns boolean
return SetLightningColor( l, GetLightningColorR(l), GetLightningColorG(l), GetLightningColorB(l), a )
endmethod
method change takes player p, World W returns nothing
local Lightning move = this.GetIndex( W - 1 )
if GetLocalPlayer() == p then
call Lightning.SetLightningAlpha( this.t, move.alpha )
endif
endmethod
static method changeAll takes player p, World W returns nothing
local Lightning this = Lightning.top
loop
exitwhen this == 0
call this.change( p, W )
set this = this.next
endloop
endmethod
method init takes nothing returns nothing
local World W = GetUser( GetLocalPlayer() ).Place
local Lightning move = this.GetIndex( W - 1 )
call Lightning.SetLightningAlpha( this.t, move.alpha )
endmethod
method updateAlpha takes World W, real alpha returns nothing
local Lightning move = this.GetIndex( W - 1 )
set move.alpha = alpha
if IsPlayerInForce( GetLocalPlayer(), W.Users ) then
call this.init()
endif
endmethod
//if update other member values, call the method: init()
static method create takes lightning t returns Lightning
local Lightning new = Lightning.allocate()
local Lightning move = 0
local integer i = 0
set new.t = t
if Lightning.top != 0 then
set new.before = 0
set new.next = Lightning.top
endif
set Lightning.top = new
loop
exitwhen i >= Const_WorldNumber
set move = new.GetIndex( i )
set move.alpha = Register_LightningAlphas
set i = i + 1
endloop
return new
endmethod
method Delete takes nothing returns nothing
set this.t = null
if this.before == 0 then
set Lightning.top = this.next
else
set this.before.next = this.next
endif
if this.next != 0 then
set this.next.before = this.before
endif
set this.next = 0
set this.before = 0
call this.destroy()
endmethod
endstruct
struct FogModifier
static integer MaxNumber = 500
boolean show
fogmodifier t
FogModifier before
FogModifier next
static FogModifier top = 0
method GetIndex takes World P returns integer
return P * FogModifier.MaxNumber + this
endmethod
method change takes player p, World W returns nothing
local FogModifier move = this.GetIndex( W - 1 )
if move.show then
if GetLocalPlayer() == p then
call FogModifierStart( this.t )
endif
else
if GetLocalPlayer() == p then
call FogModifierStop( this.t )
endif
endif
endmethod
static method changeAll takes player p, World W returns nothing
local FogModifier this = FogModifier.top
loop
exitwhen this == 0
call this.change( p, W )
set this = this.next
endloop
endmethod
method init takes nothing returns nothing
local World W = GetUser( GetLocalPlayer() ).Place
local FogModifier move = this.GetIndex( W - 1 )
if move.show then
call FogModifierStart( this.t )
else
call FogModifierStop( this.t )
endif
endmethod
method updateShow takes World W, boolean show returns nothing
local FogModifier move = this.GetIndex( W - 1 )
set move.show = show
if IsPlayerInForce( GetLocalPlayer(), W.Users ) then
call this.init()
endif
endmethod
//if update other member values, call the method: init()
static method create takes fogmodifier t returns FogModifier
local FogModifier new = FogModifier.allocate()
local FogModifier move = 0
local integer i = 0
set new.t = t
if FogModifier.top != 0 then
set new.before = 0
set new.next = FogModifier.top
endif
set FogModifier.top = new
loop
exitwhen i >= Const_WorldNumber
set move = new.GetIndex( i )
set move.show = Register_FogModifierShows
set i = i + 1
endloop
return new
endmethod
method Delete takes nothing returns nothing
set this.t = null
if this.before == 0 then
set FogModifier.top = this.next
else
set this.before.next = this.next
endif
if this.next != 0 then
set this.next.before = this.before
endif
set this.next = 0
set this.before = 0
call this.destroy()
endmethod
endstruct
[/jass]
如果看不到请和我说。 |
|