function w3x takes nothing returns nothing
endfunction
Name | Type | is_array | initial_value |
/*
~ Panel System by Quilnez ~
The system allows you to display stuffs on your screen.
Useful for creating and designing your very own custom UI.
Note:
All methods are completely desync free. Except:
- static method create : creating UI elements
- method operator texture= : changing elements textures
- method operator modelPath= : changing elements models
- method destroy : destroying elements
Means you can use the other methods locally without resulting in desync.
I. How to install:
1. Copy the panel system pack to your map:
- PanelCore
- LinkedListModule
- (Optional) PanelCamera
2. Save your map, then close and re-open it
3. Delete & comment out this line: */
//! external ObjectMerger w3a Agra APTR anam "(PanelSystem) TextureReplacer" aani "" gra1 1 0 gra2 1 0 gra3 1 3 gra4 1 3 gra5 1 0 aran 1 99999 acdn 1 0 arac "other" atar 1 "debris,decoration,structure,tree" atp1 1 "" aub1 1 ""
/* 4. Install desired plugins into your map (read each one's importing instructions)
5. Done.
II. Requirements:
1. LinkedListModule: hiveworkshop.com/threads/snippet-linkedlistmodule.206552/
III. Credits:
- Dirac: LinkedListModule
- Vexorian: dummy.mdx (modified)
*/
library PanelCore requires LinkedListModule, optional PanelCamera
/*
~ Panel Core ~
Provides parenting, events, coordinate conversions & calculations,
and all necessary functions for panel contents and plugins.
I. API
struct Panel
Members:
readonly unit dummy
- Panel's dummy unit object
readonly boolean visible
- Get panel's visibility state
readonly real zDepth
- Panel's depth
readonly Panel base
- List containing all panels
readonly static real ScreenCenterX
readonly static real ScreenCenterY
readonly static real ScreenCenterZ
- Get current camera center position
readonly static real ReturnValX
readonly static real ReturnValY
readonly static real ReturnValZ
- Returned value from getRelativePos & Win2World method
Event related members:
readonly static integer EventType
- Type of triggered event
readonly static thistype TriggeringPanel
- Get which panel is triggering the event
static constant integer EVENT_PANEL_REFRESHED
- Fired when a panel is done refreshing
static constant integer EVENT_PANEL_CLEARED
- Fired when a panel is done clearing its contents
static constant integer EVENT_PANEL_VISIBILITY_MODIFIED
- Fired when a panel's visibility is changed (shown/hidden)
static constant integer EVENT_PANEL_OPACITY_MODIFIED
- Fired when a panel's opacity/transparency is changed
static constant integer EVENT_PANEL_DESTROYED
- Fired right before a panel is destroyed
Methods:
static method create takes integer dummyId, integer background, real xOffset, real yOffset, real zDepth returns Panel
- Instantiate new panel
- x/yOffset indicates the distance from center of the screen
- zDepth indicates how far from screen position the panel will be
static method Win2World takes real xOffset, real yOffset, real zDepth returns nothing
- Converts screen coordinates into world coordinates
- Returned values are stored in: ReturnValX/Y/Z
static method RegisterAnyPanelEvent takes code func returns triggercondition
static method UnregisterAnyPanelEvent takes triggercondition tc returns nothing
- (Un)register a function to be executed on panel events
- Passed function must returns boolean
method operator background= takes integer texture returns nothing
- Modify panel's background texture
method operator scale= takes real r returns nothing
method operator scale takes nothing returns real
- Set/get panel's scale
method operator xOffset takes nothing returns real
method operator yOffset takes nothing returns real
- Get panel position coordinate
method operator opacity= takes integer i returns nothing
method operator opacity takes nothing returns integer
- Set/get panel's opacity/transparency
method refresh takes nothing returns nothing
- Refresh panel and its contents properties
method destroy takes nothing returns nothing
- Destroy the panel
method clear takes nothing returns nothing
- Remove all contents from the panel
method move takes real xOffset, real yOffset, real zDepth returns nothing
- Move the panel
method show takes boolean b returns nothing
- Show/hide the panel from screen
method getRelativePos takes real xOffset, real yOffset, real zDepth returns nothing
- Get screen position relative to panels position
- Returned values are stored in: ReturnValX/Y/Z
III. Credits
Dirac | LinkedListModule | https://www.hiveworkshop.com/threads/snippet-linkedlistmodule.206552/
*/
////////////////////
// Configurations //
////////////////////
globals
// Rawcode of texture replacer ability
public constant integer TEXTURE_REPLACER_ID = 'APTR'
public constant integer REPLACER_ORDER_ID = 852511
// Maximum number of rendering level at zero Z Offset
public constant integer MAX_LEVEL = 50
// Only used if not using the camera regulator system
public constant real REFRESH_RATE = 0.03
endglobals
//////////////////
// System codes //
//////////////////
globals
private location L = Location(0, 0)
public real DeltaZ = 0
public real WorldMaxX = 0
public real WorldMaxY = 0
public real WorldMinX = 0
public real WorldMinY = 0
public constant real HP = bj_PI/2
public constant real TAU = bj_PI*2
public constant real R270 = bj_PI+HP
public constant real LEVEL_GAP = 0.00275
public constant real CAMERA_GAP = 99.975+LEVEL_GAP*MAX_LEVEL
public constant real GENERAL_SIZE = 0.0905
public constant real PIXEL_CORRECTION_X = GENERAL_SIZE*0.8899125
public constant real PIXEL_CORRECTION_Y = PIXEL_CORRECTION_X*1.3186813
public constant player PASSIVE = Player(PLAYER_NEUTRAL_PASSIVE)
endglobals
public function AngularDifference takes real a, real b returns real
return Atan2(Sin(a-b), Cos(a-b))
endfunction
public function GetTerrainZ takes real x, real y returns real
call MoveLocation(L, x, y)
return GetLocationZ(L)
endfunction
public function GetUnitZ takes unit u returns real
return GetTerrainZ(GetUnitX(u), GetUnitY(u))+GetUnitFlyHeight(u)
endfunction
public function SetUnitZ takes unit u, real z returns nothing
call SetUnitFlyHeight(u, z-GetTerrainZ(GetUnitX(u), GetUnitY(u)), 0)
endfunction
public function ChangeTexture takes unit whichUnit, integer whichTexture returns nothing
local destructable d = null
local real x
local real y
if whichTexture != 0 then
set d = CreateDestructable(whichTexture, 0, 0, 0, 0, 1)
if d != null then
set x = GetUnitX(whichUnit)
set y = GetUnitY(whichUnit)
call SetUnitX(whichUnit, 0)
call SetUnitY(whichUnit, 0)
call IssueTargetOrderById(whichUnit, REPLACER_ORDER_ID, d)
call RemoveDestructable(d)
call SetUnitX(whichUnit, x)
call SetUnitY(whichUnit, y)
set d = null
endif
endif
endfunction
struct Panel extends array
implement LinkedList
readonly real size
readonly real zDepth
readonly real xOffset
readonly real yOffset
private integer skin
private integer op
readonly boolean visible
readonly unit dummy
readonly static real ReturnValX = 0
readonly static real ReturnValY = 0
readonly static real ReturnValZ = 0
readonly static real ScreenCenterX = 0
readonly static real ScreenCenterY = 0
readonly static real ScreenCenterZ = 0
private static real YawC = 0
private static real YawS = 0
private static real YawC2 = 0
private static real YawS2 = 0
private static real PitchC = 0
private static real PitchS = 0
private static real Pitch2C = 0
private static real Pitch2S = 0
readonly static integer EventType = 0
readonly static thistype TriggeringPanel = 0
private static trigger EventTrigger = CreateTrigger()
static if not LIBRARY_PanelCamera then
private static timer Timer = CreateTimer()
endif
static constant integer EVENT_PANEL_REFRESHED = 1
static constant integer EVENT_PANEL_CLEARED = 2
static constant integer EVENT_PANEL_VISIBILITY_MODIFIED = 3
static constant integer EVENT_PANEL_DESTROYED = 4
static constant integer EVENT_PANEL_OPACITY_MODIFIED = 5
private method fireEvent takes integer whichEvent returns nothing
set TriggeringPanel = this
set EventType = whichEvent
call TriggerEvaluate(EventTrigger)
endmethod
static method Win2World takes real xOffset, real yOffset, real zDepth returns nothing
local real yzOffset = yOffset*Pitch2S*PIXEL_CORRECTION_Y-zDepth*PitchC
set ReturnValX = ScreenCenterX+xOffset*PIXEL_CORRECTION_X*YawC2+yzOffset*YawC
set ReturnValY = ScreenCenterY+xOffset*PIXEL_CORRECTION_X*YawS2+yzOffset*YawS
set ReturnValZ = ScreenCenterZ+yOffset*PIXEL_CORRECTION_Y*Pitch2C+zDepth*PitchS
endmethod
static method RegisterAnyPanelEvent takes code func returns triggercondition
return TriggerAddCondition(EventTrigger, Condition(func))
endmethod
static method UnregisterAnyPanelEvent takes triggercondition tc returns nothing
call TriggerRemoveCondition(EventTrigger, tc)
endmethod
method operator background= takes integer texture returns nothing
if texture != .skin then
call ChangeTexture(.dummy, texture)
set .skin = texture
endif
endmethod
method operator opacity= takes integer i returns nothing
set .op = i
call SetUnitVertexColor(.dummy, 255, 255, 255, i)
call fireEvent(EVENT_PANEL_OPACITY_MODIFIED)
endmethod
method operator scale= takes real r returns nothing
set .size = r*GENERAL_SIZE
if .visible then
call SetUnitScale(.dummy, .size, 1, 1)
endif
endmethod
method operator background takes nothing returns integer
return .skin
endmethod
method operator opacity takes nothing returns integer
return .op
endmethod
method operator scale takes nothing returns real
return .size/GENERAL_SIZE
endmethod
method getRelativePos takes real xOffset, real yOffset, real zDepth returns nothing
call Win2World(.xOffset+xOffset, .yOffset+yOffset, .zDepth+zDepth)
endmethod
method refresh takes nothing returns nothing
if .visible then
call Win2World(.xOffset, .yOffset, .zDepth)
if ReturnValX > WorldMinX and ReturnValX < WorldMaxX and ReturnValY > WorldMinY and ReturnValY < WorldMaxY then
call SetUnitX(.dummy, ReturnValX)
call SetUnitY(.dummy, ReturnValY)
call SetUnitZ(.dummy, ReturnValZ)
call SetUnitScale(.dummy, .size, 1, 1)
else
call SetUnitScale(.dummy, 0, 0, 0)
endif
call fireEvent(EVENT_PANEL_REFRESHED)
endif
endmethod
method clear takes nothing returns nothing
call fireEvent(EVENT_PANEL_CLEARED)
endmethod
method destroy takes nothing returns nothing
call fireEvent(EVENT_PANEL_DESTROYED)
call RemoveUnit(.dummy)
call removeNode()
call deallocate()
set .dummy = null
endmethod
method show takes boolean b returns nothing
if b != .visible then
set .visible = b
if b then
call SetUnitScale(.dummy, .size, 1, 1)
else
call SetUnitScale(.dummy, 0, 0, 0)
call SetUnitX(.dummy, WorldMaxX)
call SetUnitY(.dummy, WorldMaxY)
endif
call fireEvent(EVENT_PANEL_VISIBILITY_MODIFIED)
endif
endmethod
method move takes real xOffset, real yOffset, real zDepth returns nothing
set .xOffset = xOffset
set .yOffset = yOffset
set .zDepth = -zDepth
endmethod
static method create takes integer id, integer background, real xOffset, real yOffset, real zDepth returns Panel
local thistype this = allocate()
set .scale = 1
set .opacity = 255
set .visible = true
set .dummy = CreateUnit(PASSIVE, id, 0, 0, 0)
set .skin = background
static if not LIBRARY_AutoFly then
if UnitAddAbility(.dummy, 'Amrf') and UnitRemoveAbility(.dummy, 'Amrf') then
endif
endif
call UnitAddAbility(.dummy, TEXTURE_REPLACER_ID)
call UnitAddAbility(.dummy, 'Aeth')
call UnitRemoveAbility(.dummy, 'Amov')
call SetUnitPathing(.dummy, false)
call ChangeTexture(.dummy, background)
call move(xOffset, yOffset, zDepth)
call base.insertNode(this)
call refresh()
return this
endmethod
private static method GetScreenCenterPos takes nothing returns nothing
local real d
local real x
local real y
local real z
local real x2
local real y2
local real cd
local real cz
local real yaw
local real pitch
static if LIBRARY_PanelCamera then
set x = PanelCamera_LocX
set y = PanelCamera_LocY
set cz = PanelCamera_ZOffset+DeltaZ
set cd = PanelCamera_TargetDistance-CAMERA_GAP
set yaw = PanelCamera_Rotation
set pitch = PanelCamera_AngleOfAttack
else
set x = GetCameraTargetPositionX()
set y = GetCameraTargetPositionY()
set cz = GetCameraTargetPositionZ()
set cd = GetCameraField(CAMERA_FIELD_TARGET_DISTANCE)-CAMERA_GAP
set yaw = GetCameraField(CAMERA_FIELD_ROTATION)
set pitch = GetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK)
endif
if pitch < R270 and pitch > HP then
set yaw = bj_PI+yaw
set pitch = bj_PI-pitch
endif
set pitch = (pitch-AngularDifference(pitch, R270)*2)-bj_PI
set YawC = Cos(yaw)
set YawS = Sin(yaw)
set YawC2 = Cos(yaw-HP)
set YawS2 = Sin(yaw-HP)
set PitchC = Cos(pitch)
set PitchS = Sin(pitch)
set pitch = AngularDifference(pitch-HP, R270)
set Pitch2C = Cos(pitch)
set Pitch2S = Sin(pitch)
set d = cd*PitchC
set ScreenCenterX = x-d*YawC
set ScreenCenterY = y-d*YawS
set ScreenCenterZ = cz+cd*PitchS
endmethod
private static method refreshPanels takes nothing returns boolean
local thistype node = base.next
call GetScreenCenterPos()
loop
exitwhen node.head or node == 0
if node.visible then
call node.refresh()
endif
set node = node.next
endloop
return false
endmethod
private static method onInit takes nothing returns nothing
set WorldMaxX = GetRectMaxX(bj_mapInitialPlayableArea)
set WorldMaxY = GetRectMaxY(bj_mapInitialPlayableArea)
set WorldMinX = GetRectMinX(bj_mapInitialPlayableArea)
set WorldMinY = GetRectMinX(bj_mapInitialPlayableArea)
call SetCameraPosition(0, 0)
set DeltaZ = GetCameraTargetPositionZ()
static if LIBRARY_PanelCamera then
call RegisterOnCameraRefreshEvent(function thistype.refreshPanels)
else
call TimerStart(Timer, REFRESH_RATE, true, function thistype.refreshPanels)
endif
endmethod
endstruct
endlibrary
library LinkedListModule /* v2.3.1
Easy implementation of linked lists into structs.
***********************************************************************
*
* module LinkedList
*
* - Implement at the top of your struct, must extend array
*
* thistype next
* thistype prev
* boolean head
*
* readonly static thistype base
* - Precreated head, useful for non-dynamic lists.
*
* static method allocate takes nothing returns thistype
* method deallocate takes nothing returns nothing
*
* static method createNode takes nothing returns thistype
* - Allocates a new node pointing towards itself.
* - These nodes are considered "heads" therefore it's head
* - boolean member is set to true.
* method insertNode takes thistype toInsert returns thistype
* - Inserts the instance before the node.
* method removeNode takes nothing returns nothing
* - Removes the node from the list.
* method clearNode takes nothing returns nothing
* - Deallocates all the instances within the node's range.
* method flushNode takes nothing returns nothing
* - Clears and deallocates the node.
*
* module LinkedListLite
* - Only has the members and the allocation methods.
* - To be used with the provided textmacros.
*
* textmacro LINKED_LIST_HEAD takes node
* - Turns the node into a head.
* textmacro LINKED_LIST_INSERT takes node, toInsert
* - Inserts the instance before the node.
* textmacro LINKED_LIST_REMOVE takes node
* - Removes the node from the list.
* textmacro LINKED_LIST_CLEAR takes node
* - Deallocates all the instances within the node's range.
* textmacro LINKED_LIST_FLUSH takes node
* - Clears and deallocates the node.
* textmacro LINKED_LIST_MERGE takes nodeA, nodeB
* - Merges two lists together (Don't merge loose nodes!)
*
**********************************************************************/
module LinkedListLite
private static integer instanceCount = 0
thistype next
thistype prev
boolean head
static method allocate takes nothing returns thistype
local thistype this = thistype(0).prev
if this==0 then
debug if instanceCount==8190 then
debug call BJDebugMsg("[LinkedList] Error: attempted to allocate too many instances.")
debug return 0
debug endif
set instanceCount = instanceCount+1
return instanceCount
endif
set thistype(0).prev = prev
return this
endmethod
method deallocate takes nothing returns nothing
set this.prev=thistype(0).prev
set thistype(0).prev=this
set this.head=false
endmethod
endmodule
module LinkedList
implement LinkedListLite
static method operator base takes nothing returns thistype
return 8190
endmethod
static method createNode takes nothing returns thistype
local thistype this=allocate()
//! runtextmacro LINKED_LIST_HEAD("this")
return this
endmethod
method clearNode takes nothing returns nothing
//! runtextmacro LINKED_LIST_CLEAR("this")
endmethod
method flushNode takes nothing returns nothing
//! runtextmacro LINKED_LIST_FLUSH("this")
endmethod
method insertNode takes thistype toInsert returns nothing
//! runtextmacro LINKED_LIST_INSERT("this","toInsert")
endmethod
method removeNode takes nothing returns nothing
//! runtextmacro LINKED_LIST_REMOVE("this")
endmethod
private static method onInit takes nothing returns nothing
set thistype(8190).next = 8190
set thistype(8190).prev = 8190
set thistype(8190).head = true
endmethod
static if DEBUG_MODE then
method print takes nothing returns nothing
local string s=""
local thistype exit=this
loop
set s=s+I2S(this)
set this = next
exitwhen this==exit
set s = s+" - "
endloop
call BJDebugMsg("[ "+s+" ]")
endmethod
endif
endmodule
//! textmacro LINKED_LIST_HEAD takes node
set $node$.next = this
set $node$.prev = this
set $node$.head = true
//! endtextmacro
//! textmacro LINKED_LIST_CLEAR takes node
if $node$!=$node$.next then
set $node$.next.prev = thistype(0).prev
set thistype(0).prev = $node$.prev
set $node$.next = $node$
set $node$.prev = $node$
endif
//! endtextmacro
//! textmacro LINKED_LIST_FLUSH takes node
set $node$.next.prev = thistype(0).prev
set thistype(0).prev = $node$
set $node$.head = false
//! endtextmacro
//! textmacro LINKED_LIST_INSERT takes node, toInsert
set $node$.prev.next = $toInsert$
set $toInsert$.prev = $node$.prev
set $node$.prev = $toInsert$
set $toInsert$.next = $node$
//! endtextmacro
//! textmacro LINKED_LIST_REMOVE takes node
set $node$.prev.next = $node$.next
set $node$.next.prev = $node$.prev
//! endtextmacro
//! textmacro LINKED_LIST_MERGE takes nodeA, nodeB
set $nodeA$.next.prev = $nodeB$.prev
set $nodeB$.prev.next = $nodeA$.next
set $nodeA$.next = $nodeB$
set $nodeB$.prev = $nodeA$
//! endtextmacro
endlibrary
library PanelCamera
/*
~ Panel Camera Regulator ~
A complementary system for the panel system. Required in
order to let it reposition itself accurately. It works just
like the native camera, with some hotfixes of course.
By using this, default camera scrolling (mouse & keyboard) will be
disabled. Camera field roll and field of view isn't allowed to be
modified as well. And you are only allowed to use some specific
camera related functions which will be specified below. Deal with it.
I. API
function RefreshCamera takes nothing returns nothing
- Call this everytime you update the camera
function SetCameraFieldEx takes camerafield whichField, real value, real duration returns nothing
- This is a replacement of native SetCameraField
- You can still use the native ones but you can use this instead if you need some extra speed
function RegisterOnCameraRefreshEvent takes code func return triggercondition
function UnregisterOnCameraRefreshEvent takes triggercondition cond return nothing
- (Un)register a function to be executed everytime camera is done refreshing
II. Extra notes
So far you may only use these native and BJ functions:
- SetCameraField
- SetCameraFieldForPlayer [GUI]
- SetCameraPosition
- PanCameraTo
- PanCameraToTimed
- PanCameraToTimedLocForPlayer [GUI]
- CameraSetSmoothingFactor
- CameraSetupApply
- CameraSetupApplyForceDuration
- CameraSetupApplyForPlayer [GUI]
- SetCameraTargetController
- SetCameraTargetControllerNoZForPlayer[GUI]
Just let me know if you need more functions to be supported.
Function call replacements:
(Variable name) = (Replaced function)
LocX = GetCameraTargetPositionX()
LocY = GetCameraTargetPositionY()
ZOffset = CAMERA_FIELD_ZOFFSET / GetCameraTargetPositionZ()
AngleOfAttack = CAMERA_FIELD_ANGLE_OF_ATTACK
CameraFarZ = CAMERA_FIELD_FARZ
Rotation = CAMERA_FIELD_ROTATION
TargetDistance = CAMERA_FIELD_TARGET_DISTANCE
*/
////////////////////
// Configurations //
////////////////////
globals
// Minimum value difference that will be processed by the system
// Must be a positive value
private constant real TOLERANCE = 0.1
// Lower value makes the camera looks smoother but will cause the system
// to work significantly harder
private constant real INTERVAL = 0.03125
endglobals
//////////////////
// System codes //
//////////////////
globals
public real LocX = 0
public real LocY = 0
public real ZOffset = 0
public real TargetDistance = bj_CAMERA_DEFAULT_DISTANCE
public real Rotation = bj_CAMERA_DEFAULT_ROTATION*bj_DEGTORAD
public real AngleOfAttack = bj_CAMERA_DEFAULT_AOA*bj_DEGTORAD
private real LocXTarget = LocX
private real LocYTarget = LocY
private real TargetDistanceTarget = TargetDistance
private real RotationTarget = Rotation
private real AngleOfAttackTarget = AngleOfAttack
private real ZOffsetTarget = ZOffset
private real LocXRate = 0.0
private real LocYRate = 0.0
private real ZOffsetRate = 0.0
private real TargetDistanceRate = 0.0
private real RotationRate = 0.0
private real AngleOfAttackRate = 0.0
private unit CameraMan
private player Locale
private boolean Boole = false
private boolean Notify = true
private timer CamTimer = CreateTimer()
private timer StopTimer = CreateTimer()
private trigger Trigg = CreateTrigger()
private constant real HP = bj_PI/2
private constant real TAU = bj_PI*2
endglobals
private function AngularDifference takes real a, real b returns real
return RAbsBJ(Atan2(Sin(a-b), Cos(a-b)))
endfunction
function RefreshCamera takes nothing returns nothing
set Boole = true
call SetCameraField(CAMERA_FIELD_ROLL, 0, 0)
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW, bj_CAMERA_DEFAULT_FOV, 0)
call SetCameraField(CAMERA_FIELD_ROTATION, Rotation*bj_RADTODEG, 0)
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, AngleOfAttack*bj_RADTODEG, 0)
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, TargetDistance, 0)
call SetCameraField(CAMERA_FIELD_ZOFFSET, ZOffset, 0)
call SetCameraTargetController(CameraMan, LocX, LocY, false)
set Boole = false
endfunction
private function FireEvent takes nothing returns nothing
if Notify then
call RefreshCamera()
call TriggerEvaluate(Trigg)
endif
endfunction
private function onTick takes nothing returns nothing
set Notify = false
if Rotation != RotationTarget then
if Cos(Rotation-RotationTarget) <= Cos(RotationRate) then
if Sin(RotationTarget-Rotation) >= 0 then
set Rotation = Rotation + RotationRate
else
set Rotation = Rotation - RotationRate
endif
else
set Rotation = RotationTarget
endif
set Notify = true
endif
if AngleOfAttack != AngleOfAttackTarget then
if Cos(AngleOfAttack-AngleOfAttackTarget) <= Cos(AngleOfAttackRate) then
if Sin(AngleOfAttackTarget-AngleOfAttack) >= 0 then
set AngleOfAttack = AngleOfAttack + AngleOfAttackRate
else
set AngleOfAttack = AngleOfAttack - AngleOfAttackRate
endif
else
set AngleOfAttack = AngleOfAttackTarget
endif
set Notify = true
endif
if TargetDistance != TargetDistanceTarget then
if RAbsBJ(TargetDistance-TargetDistanceTarget) <= RAbsBJ(TargetDistanceRate) then
set TargetDistance = TargetDistanceTarget
else
set TargetDistance = TargetDistance + TargetDistanceRate
endif
set Notify = true
endif
if ZOffset != ZOffsetTarget then
if RAbsBJ(ZOffset-ZOffsetTarget) <= RAbsBJ(ZOffsetRate) then
set ZOffset = ZOffsetTarget
else
set ZOffset = ZOffset + ZOffsetRate
endif
set Notify = true
endif
if LocX != LocXTarget then
if RAbsBJ(LocX-LocXTarget) <= RAbsBJ(LocXRate) then
set LocX = LocXTarget
else
set LocX = LocX + LocXRate
endif
set Notify = true
endif
if LocY != LocYTarget then
if RAbsBJ(LocY-LocYTarget) <= RAbsBJ(LocYRate) then
set LocY = LocYTarget
else
set LocY = LocY + LocYRate
endif
set Notify = true
endif
call FireEvent()
set Notify = true
endfunction
function SetCameraFieldEx takes camerafield whichField, real value, real duration returns nothing
if whichField == CAMERA_FIELD_ROTATION then
if AngularDifference(Rotation, value*bj_DEGTORAD) > TOLERANCE*bj_DEGTORAD then
set RotationTarget = value*bj_DEGTORAD
if duration <= 0 then
set Rotation = RotationTarget
call FireEvent()
else
set RotationRate = AngularDifference(Rotation, RotationTarget)/duration*INTERVAL
endif
endif
elseif whichField == CAMERA_FIELD_ANGLE_OF_ATTACK then
if AngularDifference(AngleOfAttack, value*bj_DEGTORAD) > TOLERANCE*bj_DEGTORAD then
set AngleOfAttackTarget = value*bj_DEGTORAD
if duration <= 0 then
set AngleOfAttack = AngleOfAttackTarget
call FireEvent()
else
set AngleOfAttackRate = AngularDifference(AngleOfAttack, AngleOfAttackTarget)/duration*INTERVAL
endif
endif
elseif whichField == CAMERA_FIELD_TARGET_DISTANCE then
if RAbsBJ(TargetDistance-value) > TOLERANCE then
set TargetDistanceTarget = value
if duration <= 0 then
set TargetDistance = value
call FireEvent()
else
set TargetDistanceRate = (value-TargetDistance)/duration*INTERVAL
endif
endif
elseif whichField == CAMERA_FIELD_ZOFFSET then
if RAbsBJ(ZOffset-value) > TOLERANCE then
set ZOffsetTarget = value
if duration <= 0 then
set ZOffset = value
call FireEvent()
else
set ZOffsetRate = (value-ZOffset)/duration*INTERVAL
endif
endif
endif
endfunction
private function SetCameraFieldCatcher takes camerafield whichField, real value, real duration returns nothing
if not Boole then
call SetCameraFieldEx(whichField, value, duration)
endif
endfunction
private function SetCameraFieldForPlayerEx takes player whichPlayer, camerafield whichField, real value, real duration returns nothing
if Locale == whichPlayer then
call SetCameraFieldEx(whichField, value, duration)
endif
endfunction
private function SetCameraPositionEx takes real x, real y returns nothing
set LocX = x
set LocY = y
set LocXTarget = x
set LocYTarget = y
call FireEvent()
endfunction
private function PanCameraToTimedEx takes real x, real y, real duration returns nothing
local boolean updateX = RAbsBJ(LocX-x) > TOLERANCE
local boolean updateY = RAbsBJ(LocY-y) > TOLERANCE
if updateX or updateY then
if duration <= 0 then
call SetCameraPositionEx(x, y)
else
if updateX then
set LocXTarget = x
set LocXRate = (x-LocX)/duration*INTERVAL
endif
if updateY then
set LocYTarget = y
set LocYRate = (y-LocY)/duration*INTERVAL
endif
endif
endif
endfunction
private function PanCameraToTimedLocForPlayerEx takes player whichPlayer, location loc, real duration returns nothing
if Locale == whichPlayer then
call PanCameraToTimedEx(GetLocationX(loc), GetLocationY(loc), duration)
endif
endfunction
private function CameraSetupApplyForceDurationEx takes camerasetup whichSetup, boolean doPan, real forceDuration returns nothing
call SetCameraFieldEx(CAMERA_FIELD_ANGLE_OF_ATTACK, CameraSetupGetField(whichSetup, CAMERA_FIELD_ANGLE_OF_ATTACK), forceDuration)
call SetCameraFieldEx(CAMERA_FIELD_FARZ, CameraSetupGetField(whichSetup, CAMERA_FIELD_FARZ), forceDuration)
call SetCameraFieldEx(CAMERA_FIELD_FIELD_OF_VIEW, CameraSetupGetField(whichSetup, CAMERA_FIELD_FIELD_OF_VIEW), forceDuration)
call SetCameraFieldEx(CAMERA_FIELD_ROLL, CameraSetupGetField(whichSetup, CAMERA_FIELD_ROLL), forceDuration)
call SetCameraFieldEx(CAMERA_FIELD_ROTATION, CameraSetupGetField(whichSetup, CAMERA_FIELD_ROTATION), forceDuration)
call SetCameraFieldEx(CAMERA_FIELD_TARGET_DISTANCE, CameraSetupGetField(whichSetup, CAMERA_FIELD_TARGET_DISTANCE), forceDuration)
call SetCameraFieldEx(CAMERA_FIELD_ZOFFSET, CameraSetupGetField(whichSetup, CAMERA_FIELD_ZOFFSET), forceDuration)
if doPan then
call SetCameraPositionEx(CameraSetupGetDestPositionX(whichSetup), CameraSetupGetDestPositionY(whichSetup))
endif
endfunction
private function CameraSetupApplyEx takes camerasetup whichSetup, boolean doPan, boolean panTimed returns nothing
call CameraSetupApplyForceDurationEx(whichSetup, doPan, 0)
endfunction
private function CameraSetupApplyForPlayerEx takes boolean doPan, camerasetup whichSetup, player whichPlayer, real duration returns nothing
if Locale == whichPlayer then
call CameraSetupApplyForceDurationEx(whichSetup, doPan, duration)
endif
endfunction
private function CameraSetSmoothingFactorEx takes real factor returns nothing
if not Boole then
set Boole = true
call CameraSetSmoothingFactor(0)
set Boole = false
endif
endfunction
private function SetCameraTargetControllerEx takes unit whichUnit, real xoffset, real yoffset, boolean inheritOrientation returns nothing
if not Boole then
set Boole = true
call SetCameraTargetController(CameraMan, LocX, LocY, false)
set Boole = false
endif
endfunction
private function SetCameraTargetControllerNoZForPlayerEx takes player whichPlayer, unit whichUnit, real xoffset, real yoffset, boolean inheritOrientation returns nothing
if Locale == whichPlayer then
call SetCameraTargetControllerEx(CameraMan, LocX, LocY, false)
endif
endfunction
hook SetCameraField SetCameraFieldCatcher
hook SetCameraFieldForPlayer SetCameraFieldForPlayerEx
hook SetCameraPosition SetCameraPositionEx
hook PanCameraTo SetCameraPositionEx
hook PanCameraToTimed PanCameraToTimedEx
hook PanCameraToTimedLocForPlayer PanCameraToTimedLocForPlayerEx
hook CameraSetSmoothingFactor CameraSetSmoothingFactorEx
hook CameraSetupApply CameraSetupApplyEx
hook CameraSetupApplyForceDuration CameraSetupApplyForceDurationEx
hook CameraSetupApplyForPlayer CameraSetupApplyForPlayerEx
hook SetCameraTargetController SetCameraTargetControllerEx
hook SetCameraTargetControllerNoZForPlayer SetCameraTargetControllerNoZForPlayerEx
function RegisterOnCameraRefreshEvent takes code func returns triggercondition
return TriggerAddCondition(Trigg, Condition(func))
endfunction
function UnregisterOnCameraRefreshEvent takes triggercondition cond returns nothing
call TriggerRemoveCondition(Trigg, cond)
endfunction
private module InitModule
private static method onInit takes nothing returns nothing
call init()
endmethod
endmodule
private struct Initializer
private static method init takes nothing returns nothing
set Locale = GetLocalPlayer()
set CameraMan = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'hpea', 0, 0, 0)
call SetUnitPathing(CameraMan, false)
call PauseUnit(CameraMan, true)
call ShowUnit(CameraMan, false)
call SetUnitX(CameraMan, 0)
call SetUnitY(CameraMan, 0)
call SetCameraTargetController(CameraMan, LocX, LocY, false)
call TimerStart(CamTimer, INTERVAL, true, function onTick)
call FireEvent()
endmethod
implement InitModule
endstruct
endlibrary
library PanelModel requires PanelCore
/*
~ Panel Model Plugin ~
Allows to add model files into panels.
I. How to import:
1. Copy "PanelModel" trigger to your map.
2. Export "PanelModelDummy.mdx" in import manager to your map.
3. Save your map, then close and reopen it.
4. Delete/comment out this line: */
//! external ObjectMerger w3u hfoo hPSD unsf "PanelModelDummy" unam "" umdl "war3mapImported\PanelModelDummy.mdl" ubdg 1 uabi "Aloc" uble 0 uico "" umxp 0 umxr 0 ussc 0 ushu "" uaen "" udea "" umvt "float" ucol 0 usnd "" ufle 0 ufoo 0 uspe 1 uhom 1 urac "unknown" usid 0 usin 0 upgr "" uhot "" utip "" utub ""
/* 5. Done.
II. API
struct PanelModel
Members:
boolean transformAxis
- If true, the model's coordinate will be rescaled based on it's parent size
readonly unit dummy
- Model's dummy unit object
readonly real xOffset
readonly real yOffset
- x/y offset of the model
readonly boolean visible
- Model's current visibility state
readonly Panel parent
- Panel that's containing the model
readonly static thistype array List
- A list containing models in a specific Panel
- Takes the desired Panel (parent) instance as index
Methods:
static method create takes Panel parent, string path, real xOffset, real yOffset, integer level returns thistype
- Add a model into a Panel
method operator modelPath= takes string path returns nothing
- Change the model file
method operator level takes nothing returns integer
- Get model's rendering level
method operator scale= takes real r returns nothing
method operator scale takes nothing returns real
- Set/get model size
method refresh takes nothing returns nothing
- Refresh model screen position
method destroy takes nothing returns nothing
- Delete and remove the model from its parents collection
method move takes real xOffset, real yOffset, integer level returns nothing
- Move the model to new screen coordinate
method show takes boolean b returns nothing
- Modify text tag's visibility
*/
////////////////////
// Configurations //
////////////////////
globals
// Billboarded dummy unit dummy ID
private constant integer DUMMY_ID = 'hPSD'
// No need to modify
private constant string ATTACH_POINT = "origin"
endglobals
//////////////////
// System codes //
//////////////////
struct PanelModel extends array
implement LinkedList
boolean transformAxis
private effect model
readonly unit dummy
readonly real xOffset
readonly real yOffset
private real zOffset
private real size
private boolean pvisible
readonly boolean visible
readonly Panel parent
readonly static thistype array List
method operator modelPath= takes string path returns nothing
call DestroyEffect(.model)
set .model = AddSpecialEffectTarget(path, .dummy, ATTACH_POINT)
endmethod
method operator scale= takes real r returns nothing
set .size = r*PanelCore_GENERAL_SIZE
if .visible then
call SetUnitScale(.dummy, .size*.parent.scale, 1, 1)
endif
endmethod
method operator level takes nothing returns integer
return R2I(.zOffset/PanelCore_LEVEL_GAP)
endmethod
method operator scale takes nothing returns real
return .size/PanelCore_GENERAL_SIZE
endmethod
method destroy takes nothing returns nothing
call DestroyEffect(.model)
call RemoveUnit(.dummy)
call removeNode()
call deallocate()
set .dummy = null
set .model = null
endmethod
method refresh takes nothing returns nothing
if .visible and .parent.visible then
if .transformAxis then
call .parent.getRelativePos(.xOffset*.parent.scale, .yOffset*.parent.scale, .zOffset)
else
call .parent.getRelativePos(.xOffset, .yOffset, .zOffset)
endif
if Panel.ReturnValX > PanelCore_WorldMinX and Panel.ReturnValX < PanelCore_WorldMaxX and Panel.ReturnValY > PanelCore_WorldMinY and Panel.ReturnValY < PanelCore_WorldMaxY then
call SetUnitX(.dummy, Panel.ReturnValX)
call SetUnitY(.dummy, Panel.ReturnValY)
call PanelCore_SetUnitZ(.dummy, Panel.ReturnValZ)
call SetUnitScale(.dummy, .size*.parent.scale, 1, 1)
else
call SetUnitScale(.dummy, 0, 0, 0)
endif
endif
endmethod
method move takes real xOffset, real yOffset, integer level returns nothing
set .xOffset = xOffset
set .yOffset = yOffset
set .zOffset = PanelCore_LEVEL_GAP*level
endmethod
method show takes boolean b returns nothing
if b != .visible then
set .visible = b
if b then
call SetUnitScale(.dummy, .size*.parent.scale, 1, 1)
else
call SetUnitScale(.dummy, 0, 0, 0)
call SetUnitX(.dummy, PanelCore_WorldMaxX)
call SetUnitY(.dummy, PanelCore_WorldMaxY)
endif
endif
endmethod
static method create takes Panel parent, string path, real xOffset, real yOffset, integer level returns thistype
local thistype this = allocate()
set .parent = parent
set .scale = 1
set .visible = true
set .dummy = CreateUnit(PanelCore_PASSIVE, DUMMY_ID, 0, 0, 0)
set .model = AddSpecialEffectTarget(path, .dummy, ATTACH_POINT)
set .transformAxis = true
static if not LIBRARY_AutoFly then
if UnitAddAbility(.dummy, 'Amrf') and UnitRemoveAbility(.dummy, 'Amrf') then
endif
endif
call UnitAddAbility(.dummy, 'Aeth')
call UnitRemoveAbility(.dummy, 'Amov')
call SetUnitScale(.dummy, .size, 1, 1)
call move(xOffset, yOffset, level)
call refresh()
if List[parent] == 0 then
set List[parent] = createNode()
endif
call List[parent].insertNode(this)
return this
endmethod
private static method onPanelEvent takes nothing returns boolean
local thistype node
if List[Panel.TriggeringPanel] != 0 then
set node = List[Panel.TriggeringPanel].next
loop
exitwhen node.head or node == 0
if Panel.EventType == Panel.EVENT_PANEL_REFRESHED then
call node.refresh()
elseif Panel.EventType == Panel.EVENT_PANEL_CLEARED or Panel.EventType == Panel.EVENT_PANEL_DESTROYED then
call node.destroy()
elseif Panel.EventType == Panel.EVENT_PANEL_VISIBILITY_MODIFIED then
if not node.parent.visible then
call SetUnitX(node.dummy, PanelCore_WorldMaxX)
call SetUnitY(node.dummy, PanelCore_WorldMaxY)
endif
endif
set node = node.next
endloop
if Panel.EventType == Panel.EVENT_PANEL_DESTROYED then
call List[Panel.TriggeringPanel].flushNode()
set List[Panel.TriggeringPanel] = 0
endif
endif
return false
endmethod
private static method onInit takes nothing returns nothing
call Panel.RegisterAnyPanelEvent(function thistype.onPanelEvent)
endmethod
endstruct
endlibrary
library PanelPlatform requires PanelCore
/*
~ Panel Platform Plugin ~
Allows to add platform objects into panels.
I. How to import:
1. Copy "PanelPlatform" trigger to your map.
2. Done.
II. API
struct PanelPlatform
Members:
boolean transformAxis
- If true, the platform's coordinate will be rescaled based on it's parent size
readonly unit dummy
- Platform's dummy unit object
readonly real xOffset
readonly real yOffset
- x/y offset of the platform
readonly integer red
readonly integer green
readonly integer blue
readonly integer alpha
- Platform's color channels
readonly boolean visible
- Platform's visibility state
readonly Panel parent
- Panel that's containing the platform
readonly static thistype array List
- A list containing platforms in a specific Panel
- Takes the desired Panel (parent) instance as index
Methods:
static method create takes Panel parent, integer id, integer texture, real xOffset, real yOffset, integer level returns thistype
- Add a platform into a Panel
method operator texture= takes integer i returns nothing
- Change the platform texture
method operator level takes nothing returns integer
- Get platform's rendering level
method operator scale= takes real r returns nothing
method operator scale takes nothing returns real
- Get/set platform's size
method refresh takes nothing returns nothing
- Refresh platform screen position
method destroy takes nothing returns nothing
- Delete and remove the model from its parents collection
method move takes real xOffset, real yOffset returns nothing
- Move the platform to a new screen coordinate
method show takes boolean b returns nothing
- Modify platform's visibility state
method setColor takes integer r, integer g, integer b, integer a returns nothing
- Modify platform's vertex colors
*/
//////////////////
// System codes //
//////////////////
struct PanelPlatform extends array
implement LinkedList
boolean transformAxis
readonly unit dummy
readonly real xOffset
readonly real yOffset
private real zOffset
private real size
readonly integer red
readonly integer green
readonly integer blue
readonly integer alpha
private integer skin
readonly boolean visible
private boolean pvisible
readonly Panel parent
readonly static thistype array List
method operator texture= takes integer i returns nothing
if i != .skin then
set .skin = i
call PanelCore_ChangeTexture(.dummy, i)
endif
endmethod
method operator scale= takes real r returns nothing
set .size = r*PanelCore_GENERAL_SIZE
if .visible then
call SetUnitScale(.dummy, .size*.parent.scale, 1, 1)
endif
endmethod
method operator texture takes nothing returns integer
return .skin
endmethod
method operator level takes nothing returns integer
return R2I(.zOffset/PanelCore_LEVEL_GAP)
endmethod
method operator scale takes nothing returns real
return .size/PanelCore_GENERAL_SIZE
endmethod
method destroy takes nothing returns nothing
call RemoveUnit(.dummy)
call removeNode()
call deallocate()
set .dummy = null
endmethod
method refresh takes nothing returns nothing
if .visible and .parent.visible then
if .transformAxis then
call .parent.getRelativePos(.xOffset*.parent.scale, .yOffset*.parent.scale, .zOffset)
else
call .parent.getRelativePos(.xOffset, .yOffset, .zOffset)
endif
if Panel.ReturnValX > PanelCore_WorldMinX and Panel.ReturnValX < PanelCore_WorldMaxX and Panel.ReturnValY > PanelCore_WorldMinY and Panel.ReturnValY < PanelCore_WorldMaxY then
call SetUnitX(.dummy, Panel.ReturnValX)
call SetUnitY(.dummy, Panel.ReturnValY)
call PanelCore_SetUnitZ(.dummy, Panel.ReturnValZ)
call SetUnitScale(.dummy, .size*.parent.scale, 1, 1)
else
call SetUnitScale(.dummy, 0, 0, 0)
endif
endif
endmethod
method move takes real xOffset, real yOffset, integer level returns nothing
set .xOffset = xOffset
set .yOffset = yOffset
set .zOffset = PanelCore_LEVEL_GAP*level
endmethod
method setColor takes integer r, integer g, integer b, integer a returns nothing
set .red = r
set .green = g
set .blue = b
set .alpha = a
call SetUnitVertexColor(.dummy, .red, .green, .blue, R2I(.alpha*.parent.opacity/255.))
endmethod
method show takes boolean b returns nothing
if b != .visible then
set .visible = b
if b then
call SetUnitScale(.dummy, .size*.parent.scale, 1, 1)
else
call SetUnitScale(.dummy, 0, 0, 0)
call SetUnitX(.dummy, PanelCore_WorldMaxX)
call SetUnitY(.dummy, PanelCore_WorldMaxY)
endif
endif
endmethod
static method create takes Panel parent, integer id, integer texture, real xOffset, real yOffset, integer level returns thistype
local thistype this = allocate()
set .parent = parent
set .scale = 1
set .visible = true
set .dummy = CreateUnit(PanelCore_PASSIVE, id, 0, 0, 0)
set .skin = texture
set .transformAxis = true
static if not LIBRARY_AutoFly then
if UnitAddAbility(.dummy, 'Amrf') and UnitRemoveAbility(.dummy, 'Amrf') then
endif
endif
call UnitRemoveAbility(.dummy, 'Amov')
call UnitAddAbility(.dummy, 'Aeth')
call UnitAddAbility(.dummy, PanelCore_TEXTURE_REPLACER_ID)
call SetUnitPathing(.dummy, false)
call SetUnitScale(.dummy, .size, 1, 1)
call setColor(255, 255, 255, 255)
call PanelCore_ChangeTexture(.dummy, texture)
call move(xOffset, yOffset, level)
if parent.visible then
call refresh()
else
call SetUnitX(.dummy, PanelCore_WorldMaxX)
call SetUnitY(.dummy, PanelCore_WorldMaxY)
endif
if List[parent] == 0 then
set List[parent] = createNode()
endif
call List[parent].insertNode(this)
return this
endmethod
private static method onPanelEvent takes nothing returns boolean
local thistype node
if List[Panel.TriggeringPanel] != 0 then
set node = List[Panel.TriggeringPanel].next
loop
exitwhen node.head or node == 0
if Panel.EventType == Panel.EVENT_PANEL_REFRESHED then
call node.refresh()
elseif Panel.EventType == Panel.EVENT_PANEL_CLEARED or Panel.EventType == Panel.EVENT_PANEL_DESTROYED then
call node.destroy()
elseif Panel.EventType == Panel.EVENT_PANEL_VISIBILITY_MODIFIED then
if not node.parent.visible then
call SetUnitX(node.dummy, PanelCore_WorldMaxX)
call SetUnitY(node.dummy, PanelCore_WorldMaxY)
endif
elseif Panel.EventType == Panel.EVENT_PANEL_OPACITY_MODIFIED then
call SetUnitVertexColor(node.dummy, node.red, node.green, node.blue, R2I(node.alpha*node.parent.opacity/255.))
endif
set node = node.next
endloop
if Panel.EventType == Panel.EVENT_PANEL_DESTROYED then
call List[Panel.TriggeringPanel].flushNode()
set List[Panel.TriggeringPanel] = 0
endif
endif
return false
endmethod
private static method onInit takes nothing returns nothing
call Panel.RegisterAnyPanelEvent(function thistype.onPanelEvent)
endmethod
endstruct
endlibrary
library PanelTextTag requires PanelCore, optional ZLibrary
/*
~ Panel Text Tag Plugin ~
Allows to add text tags into panels.
I. How to import:
1. Copy "PanelTextTag" trigger to your map.
2. Export "PanelTextTagDummy.mdx" in import manager to your map.
3. Save your map, then close and reopen it.
4. Delete/comment out this line: */
//! external ObjectMerger w3u hfoo hPTD unsf "PanelTextTagDummy" unam "" umdl "war3mapImported\PanelTextTagDummy.mdl" ubdg 1 uabi "Aloc" uble 0 uico "" umxp 0 umxr 0 ussc 0 ushu "" uaen "" udea "" umvt "float" ucol 0 usnd "" ufle 0 ufoo 0 uspe 1 uhom 1 urac "unknown" usid 0 usin 0 upgr "" uhot "" utip "" utub ""
/* 5. Done.
II. API
struct PanelTextTag
Members:
boolean transformAxis
- If true, the text tag's coordinate will be rescaled based on it's parent size
readonly real xOffset
readonly real yOffset
- x/y offset of the text tag
readonly integer red
readonly integer green
readonly integer blue
readonly integer alpha
- Text tag's color channels
readonly string text
readonly real size
- Text tag's current text & size
readonly boolean visible
- Text tag's current visibility state
readonly Panel parent
- Panel that's containing the text tag
readonly static thistype array List
- A list containing text tags in a specific Panel
- Takes the desired Panel (parent) instance as index
Methods:
static method create takes Panel parent, string s, real size, real xOffset, real yOffset returns thistype
- Add a text tag into a panel
method refresh takes nothing returns nothing
- Refresh text tag screen position
method destroy takes nothing returns nothing
- Delete and remove the text tag from its parents collection
method move takes real xOffset, real yOffset returns nothing
- Move the text tag to a new screen coordinate
method show takes boolean b returns nothing
- Modify text tag's visibility
method setText takes string s, real size returns nothing
- Change the text tag's text and size
method setColor takes integer red, integer green, integer blue, integer alpha returns nothing
- Change the text tag's color
*/
////////////////////
// Configurations //
////////////////////
globals
private constant integer DUMMY_ID = 'hPTD'
private constant real ZOFFSET = -14.8
endglobals
//////////////////
// System codes //
//////////////////
struct PanelTextTag extends array
implement LinkedList
boolean transformAxis
private texttag tag
readonly real xOffset
readonly real yOffset
readonly integer red
readonly integer green
readonly integer blue
readonly integer alpha
readonly string text
readonly real size
private boolean pvisible
readonly boolean visible
readonly Panel parent
readonly static thistype array List
private static unit ZPlacer
private static player LocalPlayer
method destroy takes nothing returns nothing
call DestroyTextTag(.tag)
call removeNode()
call deallocate()
set .tag = null
endmethod
method refresh takes nothing returns nothing
if .visible and .parent.visible then
if .transformAxis then
call .parent.getRelativePos(.xOffset*.parent.scale, .yOffset*.parent.scale, 0)
else
call .parent.getRelativePos(.xOffset, .yOffset, 0)
endif
if Panel.ReturnValX > PanelCore_WorldMinX and Panel.ReturnValX < PanelCore_WorldMaxX and Panel.ReturnValY > PanelCore_WorldMinY and Panel.ReturnValY < PanelCore_WorldMaxY then
call SetUnitX(ZPlacer, Panel.ReturnValX)
call SetUnitY(ZPlacer, Panel.ReturnValY)
call PanelCore_SetUnitZ(ZPlacer, Panel.ReturnValZ)
call SetTextTagPosUnit(.tag, ZPlacer, ZOFFSET)
call SetTextTagText(.tag, .text, .size*.parent.scale)
call SetTextTagVisibility(.tag, true)
else
call SetTextTagVisibility(.tag, false)
endif
endif
endmethod
method show takes boolean b returns nothing
if b != .visible then
set .visible = b
if not b then
call SetTextTagVisibility(.tag, false)
endif
endif
endmethod
method move takes real xOffset, real yOffset returns nothing
set .xOffset = xOffset
set .yOffset = yOffset
endmethod
method setText takes string s, real size returns nothing
set .text = s
set .size = size
endmethod
method setColor takes integer red, integer green, integer blue, integer alpha returns nothing
set .red = red
set .green = green
set .blue = blue
set .alpha = alpha
call SetTextTagColor(.tag, .red, .green, .blue, R2I(.alpha*.parent.opacity/255.))
endmethod
static method create takes Panel parent, player p, string s, real size, real xOffset, real yOffset returns thistype
local thistype this = allocate()
set .parent = parent
set .visible = true
if GetLocalPlayer() == p then
set .tag = CreateTextTag()
else
set .tag = null
endif
set .transformAxis = true
call SetTextTagVisibility(.tag, true)
call SetTextTagPermanent(.tag, true)
call setText(s, size)
call setColor(255, 255, 255, 255)
call move(xOffset, yOffset)
call refresh()
if List[parent] == 0 then
set List[parent] = createNode()
endif
call List[parent].insertNode(this)
return this
endmethod
private static method onPanelEvent takes nothing returns boolean
local thistype node
if List[Panel.TriggeringPanel] != 0 then
set node = List[Panel.TriggeringPanel].next
loop
exitwhen node.head or node == 0
if Panel.EventType == Panel.EVENT_PANEL_REFRESHED then
call node.refresh()
elseif Panel.EventType == Panel.EVENT_PANEL_CLEARED or Panel.EventType == Panel.EVENT_PANEL_DESTROYED then
call node.destroy()
elseif Panel.EventType == Panel.EVENT_PANEL_VISIBILITY_MODIFIED then
if not node.parent.visible then
call SetTextTagVisibility(node.tag, false)
endif
elseif Panel.EventType == Panel.EVENT_PANEL_OPACITY_MODIFIED then
call SetTextTagColor(node.tag, node.red, node.green, node.blue, R2I(node.alpha*node.parent.opacity/255.))
endif
set node = node.next
endloop
if Panel.EventType == Panel.EVENT_PANEL_DESTROYED then
call List[Panel.TriggeringPanel].flushNode()
set List[Panel.TriggeringPanel] = 0
endif
endif
return false
endmethod
private static method onInit takes nothing returns nothing
set ZPlacer = CreateUnit(PanelCore_PASSIVE, DUMMY_ID, 0, 0, 0)
static if not LIBRARY_AutoFly then
if UnitAddAbility(ZPlacer, 'Amrf') and UnitRemoveAbility(ZPlacer, 'Amrf') then
endif
endif
call UnitAddAbility(ZPlacer, 'Aeth')
call PauseUnit(ZPlacer, true)
call ShowUnit(ZPlacer, false)
call Panel.RegisterAnyPanelEvent(function thistype.onPanelEvent)
endmethod
endstruct
endlibrary
library PanelText requires PanelCore, PanelPlatform, Ascii
/*
~ Panel Text Plugin ~
Allows to add texts with custom font font into panels.
Text is more powerful that TextTag, it allows you to have
many font fonts with "indefinite" length and amount limit.
Also it appears much smoother than TextTag. However, it's
a lot heavier both in terms of storage and computation.
It's highly recommended not to use too much of it.
I. Requirements:
- PanelCore | -
- (plugin) PanelPlatform | -
- (required) Ascii | https://www.hiveworkshop.com/threads/snippet-ascii.190746/
II. How to import:
1. Copy "PanelText" trigger to your map.
2. Export "PanelTextDummy.mdx" in import manager to your map.
3. Save your map, then close and reopen it.
4. Delete/comment out this line: */
//! external ObjectMerger w3u hfoo hTED unsf "PanelTextDummy" unam "" umdl "war3mapImported\PanelTextDummy.mdl" ubdg 1 uabi "Aloc" uble 0 uico "" umxp 0 umxr 0 ussc 0 ushu "" uaen "" udea "" umvt "float" ucol 0 usnd "" ufle 0 ufoo 0 uspe 1 uhom 1 urac "unknown" usid 0 usin 0 upgr "" uhot "" utip "" utub ""
/* 5. Done.
III. API
struct PanelText
Members:
readonly real width
- Total width of the whole text in pixel
readonly real xOffset
readonly real yOffset
- Position of the text
readonly string font
- Text's font font
readonly integer length
- Number of characters in the text
readonly integer level
- Rendering level of the text
readonly Panel parent
- Panel that's containing the text
readonly static thistype array List
- A list containing Text's in a specific Panel
- Takes the desired Panel (parent) instance as index
Methods:
static method create takes Panel parent, string text, string font, real xOffset, real yOffset, integer level returns thistype
- Add new Text to a panel
method operator visible takes nothing returns boolean
- Get text's current visibility state
method operator red takes nothing returns integer
method operator green takes nothing returns integer
method operator blue takes nothing returns integer
method operator alpha takes nothing returns integer
- Get text's color channels
method operator scale takes nothing returns real
method operator scale= takes real r returns nothing
- Get/set text size
method operator transformAxis= takes boolean b returns nothing
- If true, the text's coordinate will be rescaled based on it's parent size
method setText takes string text, string font returns nothing
- Change the text and its font font
method refresh takes nothing returns nothing
- Refresh text screen position
method destroy takes nothing returns nothing
- Remove the text from its container
method move takes real xOffset, real yOffset, integer level returns nothing
- Move the text to different coordinate and level
method setColor takes integer r, integer g, integer b, integer a returns nothing
- Modify text's color and transparency
method show takes boolean b returns nothing
- Show/hide the text
*/
////////////////////
// Configurations //
////////////////////
globals
// Platform object for display characters
private constant integer DUMMY_ID = 'hTED'
// Space character width in pixel
private constant real SPACE_WIDTH = 8.0 // px
// Default spacing between characters
private constant real CHAR_GAP = 1.0
endglobals
//////////////////
// System codes //
//////////////////
private module InitModule
private static method onInit takes nothing returns nothing
call init()
endmethod
endmodule
struct PanelTextChar extends array
implement LinkedList
string char
real width
real height
real depth
PanelPlatform plat
method operator xOffset takes nothing returns real
return .plat.xOffset
endmethod
method operator yOffset takes nothing returns real
return .plat.yOffset
endmethod
method operator visible takes nothing returns boolean
return .plat.visible
endmethod
method show takes boolean b returns nothing
call .plat.show(b)
endmethod
endstruct
struct PanelText extends array
implement LinkedList
private real size
readonly real width
readonly real height
readonly real depth
readonly real xOffset
readonly real yOffset
readonly string text
readonly integer font
readonly integer length
readonly integer level
readonly Panel parent
readonly PanelTextChar chars
readonly static thistype array List
readonly static hashtable FontData = InitHashtable()
private method getCharTexture takes string s returns integer
return LoadInteger(FontData, font + 0, Char2Ascii(s))
endmethod
private method getCharWidth takes string s returns real
return LoadReal(FontData, font + 1, Char2Ascii(s))
endmethod
private method getCharHeight takes string s returns real
return LoadReal(FontData, font + 2, Char2Ascii(s))
endmethod
private method getCharDepth takes string s returns real
return LoadReal(FontData, font + 3, Char2Ascii(s))
endmethod
method operator visible takes nothing returns boolean
return .chars.next.plat.visible
endmethod
method operator red takes nothing returns integer
return .chars.next.plat.red
endmethod
method operator green takes nothing returns integer
return .chars.next.plat.green
endmethod
method operator blue takes nothing returns integer
return .chars.next.plat.blue
endmethod
method operator alpha takes nothing returns integer
return .chars.next.plat.alpha
endmethod
method operator scale takes nothing returns real
return .size
endmethod
method operator scale= takes real r returns nothing
set .size = r
call refresh()
endmethod
method operator transformAxis= takes boolean b returns nothing
local PanelTextChar c = .chars.next
loop
exitwhen c.head
if c.plat != 0 then
set c.plat.transformAxis = b
endif
set c = c.next
endloop
endmethod
method refresh takes nothing returns nothing
local PanelTextChar c = .chars.next
local real xOffset = .xOffset
local real offset
set .width = 0
set .height = 0
set .depth = 0
loop
exitwhen c.head
set offset = c.width*.size
if c.plat != 0 then
set c.plat.scale = .size
call c.plat.move(xOffset+offset/2, .yOffset, .level)
call c.plat.refresh()
endif
set xOffset = xOffset+offset+CHAR_GAP
set .width = .width+offset+CHAR_GAP
if c.height > .height then
set .height = c.height*.size
endif
if c.depth > .depth then
set .depth = c.depth*.size
endif
set c = c.next
endloop
set .width = .width-CHAR_GAP
endmethod
private method clear takes nothing returns nothing
local PanelTextChar c = .chars.next
loop
exitwhen c.head
if c.plat != 0 then
call c.plat.destroy()
endif
set c = c.next
endloop
call chars.clearNode()
endmethod
method destroy takes nothing returns nothing
call clear()
call chars.flushNode()
call removeNode()
call deallocate()
endmethod
method move takes real xOffset, real yOffset, integer level returns nothing
set .xOffset = xOffset
set .yOffset = yOffset
set .level = level
call refresh()
endmethod
method setColor takes integer r, integer g, integer b, integer a returns nothing
local PanelTextChar c = .chars.next
loop
exitwhen c.head
if c.plat != 0 then
call c.plat.setColor(r, g, b, a)
endif
set c = c.next
endloop
endmethod
method show takes boolean b returns nothing
local PanelTextChar c = .chars.next
loop
exitwhen c.head
if c.plat != 0 then
call c.plat.show(b)
endif
set c = c.next
endloop
endmethod
private method initText takes nothing returns nothing
local integer i = 0
local string s
local real xOffset = .xOffset
local real yOffset
local real offset
local PanelTextChar c
set .width = 0
set .height = 0
set .depth = 0
loop
exitwhen i == .length
set s = SubString(.text, i, i+1)
set c = PanelTextChar.allocate()
if s == " " then
set c.char = " "
set c.width = SPACE_WIDTH
set c.height = 0.0
set c.depth = 0.0
set offset = c.width*.size
set c.plat = 0
else
set c.char = s
set c.width = getCharWidth(s)
set c.height = getCharHeight(s)
set c.depth = getCharDepth(s)
set offset = c.width*.size
set c.plat = PanelPlatform.create(.parent, DUMMY_ID, getCharTexture(s), xOffset+offset/2, .yOffset, level)
endif
set xOffset = xOffset+offset+CHAR_GAP
set .width = .width+offset+CHAR_GAP
if c.height > .height then
set .height = c.height*.size
endif
if c.depth > .depth then
set .depth = c.depth*.size
endif
call .chars.insertNode(c)
set i = i + 1
endloop
set .width = .width-CHAR_GAP
endmethod
method setText takes string text, integer font returns nothing
if .text != text then
call clear()
set .text = text
set .font = font
set .length = StringLength(text)
call initText()
endif
endmethod
static method create takes Panel parent, string text, integer font, real xOffset, real yOffset, integer level returns thistype
local thistype this = allocate()
set .parent = parent
set .size = 1
set .xOffset = xOffset
set .yOffset = yOffset
set .level = level
set .text = text
set .font = font
set .length = StringLength(text)
set .chars = PanelTextChar.createNode()
call initText()
if List[parent] == 0 then
set List[parent] = createNode()
endif
call List[parent].insertNode(this)
return this
endmethod
private static method onPanelEvent takes nothing returns boolean
local thistype node
if List[Panel.TriggeringPanel] != 0 then
set node = List[Panel.TriggeringPanel].next
loop
exitwhen node.head
if Panel.EventType == Panel.EVENT_PANEL_CLEARED or Panel.EventType == Panel.EVENT_PANEL_DESTROYED then
call node.destroy()
endif
set node = node.next
endloop
if Panel.EventType == Panel.EVENT_PANEL_DESTROYED then
call List[Panel.TriggeringPanel].flushNode()
set List[Panel.TriggeringPanel] = 0
endif
endif
return false
endmethod
private static method init takes nothing returns nothing
local string s
local integer asc
call Panel.RegisterAnyPanelEvent(function PanelText.onPanelEvent)
implement PanelTextFontData
endmethod
implement InitModule
endstruct
// Font data stuffs
globals
public integer FontIndex = 0
endglobals
//! textmacro DefineFontStyle takes FONT
globals
integer FONTSTYLE_$FONT$ = -1
endglobals
//! endtextmacro
//! textmacro InitFontObject takes FONT, CHAR, INDEX, CODE, WIDTH, HEIGHT, DEPTH
if FONTSTYLE_$FONT$ == -1 then
set FONTSTYLE_$FONT$ = PanelText_FontIndex
set PanelText_FontIndex = PanelText_FontIndex + 4
endif
if "$CHAR$" == "''" then // symbol " breaks textmacro
set asc = Char2Ascii("\"")
else
set asc = Char2Ascii("$CHAR$")
endif
call SaveInteger(FontData, FONTSTYLE_$FONT$ + 0, asc, '$CODE$$INDEX$')
call SaveReal (FontData, FONTSTYLE_$FONT$ + 1, asc, $WIDTH$)
call SaveReal (FontData, FONTSTYLE_$FONT$ + 2, asc, $HEIGHT$)
call SaveReal (FontData, FONTSTYLE_$FONT$ + 3, asc, $DEPTH$)
//! endtextmacro
//! textmacro CreateFontObject takes FONT, INDEX, CODE, FILEPATH, EXTENSION
//! external ObjectMerger w3b YTlb $CODE$$INDEX$ bnam "($FONT$) Char $INDEX$" bfxr -1 bfil ".mdl" boch 0 btxf "$FILEPATH$$INDEX$$EXTENSION$" btxi 33 bsel 0 bgsc 0 bshd "" barm "Ethereal" btar "tree" bcpr 0 bcpd 0 buch 0 bptx "" bsuf "" bcat "D"
//! endtextmacro
endlibrary
//! runtextmacro DefineFontStyle("FrizQT")
//! runtextmacro DefineFontStyle("Immortal")
module PanelTextFontData
//! runtextmacro InitFontObject ("FrizQT", "A", "0", "FQ0", "37.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "B", "1", "FQ0", "27.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "C", "2", "FQ0", "31.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "D", "3", "FQ0", "32.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "E", "4", "FQ0", "24.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "F", "5", "FQ0", "20.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "G", "6", "FQ0", "33.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "H", "7", "FQ0", "34.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "I", "8", "FQ0", "10.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "J", "9", "FQ0", "14.0", "15.0", "31.0")
//! runtextmacro InitFontObject ("FrizQT", "K", "10", "FQ", "31.0", "15.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "L", "11", "FQ", "24.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "M", "12", "FQ", "46.0", "15.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "N", "13", "FQ", "34.0", "15.0", "21.0")
//! runtextmacro InitFontObject ("FrizQT", "O", "14", "FQ", "39.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "P", "15", "FQ", "25.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "Q", "16", "FQ", "46.0", "16.0", "29.0")
//! runtextmacro InitFontObject ("FrizQT", "R", "17", "FQ", "31.0", "15.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "S", "18", "FQ", "25.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "T", "19", "FQ", "28.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "U", "20", "FQ", "32.0", "15.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "V", "21", "FQ", "32.0", "15.0", "21.0")
//! runtextmacro InitFontObject ("FrizQT", "W", "22", "FQ", "48.0", "15.0", "21.0")
//! runtextmacro InitFontObject ("FrizQT", "X", "23", "FQ", "35.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "Y", "24", "FQ", "31.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "Z", "25", "FQ", "30.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "a", "26", "FQ", "25.0", "6.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "b", "27", "FQ", "25.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "c", "28", "FQ", "24.0", "6.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "d", "29", "FQ", "27.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "e", "30", "FQ", "25.0", "6.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "f", "31", "FQ", "18.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "g", "32", "FQ", "30.0", "6.0", "32.0")
//! runtextmacro InitFontObject ("FrizQT", "h", "33", "FQ", "25.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "i", "34", "FQ", "9.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "j", "35", "FQ", "11.0", "15.0", "31.0")
//! runtextmacro InitFontObject ("FrizQT", "k", "36", "FQ", "24.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "l", "37", "FQ", "8.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "m", "38", "FQ", "41.0", "6.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "n", "39", "FQ", "25.0", "6.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "o", "40", "FQ", "27.0", "6.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "p", "41", "FQ", "27.0", "6.0", "30.0")
//! runtextmacro InitFontObject ("FrizQT", "q", "42", "FQ", "27.0", "5.0", "30.0")
//! runtextmacro InitFontObject ("FrizQT", "r", "43", "FQ", "15.0", "6.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "s", "44", "FQ", "21.0", "6.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "t", "45", "FQ", "16.0", "13.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "u", "46", "FQ", "25.0", "6.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "v", "47", "FQ", "28.0", "6.0", "21.0")
//! runtextmacro InitFontObject ("FrizQT", "w", "48", "FQ", "41.0", "6.0", "21.0")
//! runtextmacro InitFontObject ("FrizQT", "x", "49", "FQ", "28.0", "5.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "y", "50", "FQ", "28.0", "5.0", "30.0")
//! runtextmacro InitFontObject ("FrizQT", "z", "51", "FQ", "25.0", "5.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "1", "52", "FQ", "15.0", "17.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "2", "53", "FQ", "27.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "3", "54", "FQ", "25.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "4", "55", "FQ", "30.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "5", "56", "FQ", "25.0", "15.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "6", "57", "FQ", "27.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "7", "58", "FQ", "25.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "8", "59", "FQ", "28.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "9", "60", "FQ", "27.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "0", "61", "FQ", "27.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "!", "62", "FQ", "8.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "@", "63", "FQ", "35.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "#", "64", "FQ", "30.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("FrizQT", "$", "65", "FQ", "23.0", "19.0", "24.0")
//! runtextmacro InitFontObject ("FrizQT", "%", "66", "FQ", "33.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "^", "67", "FQ", "24.0", "15.0", "0.0")
//! runtextmacro InitFontObject ("FrizQT", "&", "68", "FQ", "39.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "*", "69", "FQ", "18.0", "15.0", "2.0")
//! runtextmacro InitFontObject ("FrizQT", ")", "70", "FQ", "11.0", "15.0", "27.0")
//! runtextmacro InitFontObject ("FrizQT", "(", "71", "FQ", "12.0", "15.0", "27.0")
//! runtextmacro InitFontObject ("FrizQT", "-", "72", "FQ", "17.0", "1.0", "9.0")
//! runtextmacro InitFontObject ("FrizQT", "=", "73", "FQ", "23.0", "4.0", "8.0")
//! runtextmacro InitFontObject ("FrizQT", "_", "74", "FQ", "26.0", "0.0", "26.0")
//! runtextmacro InitFontObject ("FrizQT", "+", "75", "FQ", "23.0", "10.0", "14.0")
//! runtextmacro InitFontObject ("FrizQT", "]", "76", "FQ", "12.0", "15.0", "27.0")
//! runtextmacro InitFontObject ("FrizQT", "[", "77", "FQ", "12.0", "15.0", "27.0")
//! runtextmacro InitFontObject ("FrizQT", "}", "78", "FQ", "12.0", "15.0", "27.0")
//! runtextmacro InitFontObject ("FrizQT", "{", "79", "FQ", "12.0", "15.0", "27.0")
//! runtextmacro InitFontObject ("FrizQT", ";", "80", "FQ", "8.0", "4.0", "25.0")
//! runtextmacro InitFontObject ("FrizQT", ":", "81", "FQ", "7.0", "4.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "'", "82", "FQ", "6.0", "15.0", "0.0")
//! runtextmacro InitFontObject ("FrizQT", "''","83", "FQ", "13.0", "15.0", "0.0")
//! runtextmacro InitFontObject ("FrizQT", ",", "84", "FQ", "8.0", "0.0", "25.0")
//! runtextmacro InitFontObject ("FrizQT", ".", "85", "FQ", "7.0", "0.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "/", "86", "FQ", "21.0", "15.0", "26.0")
//! runtextmacro InitFontObject ("FrizQT", "\\","87", "FQ", "21.0", "15.0", "26.0")
//! runtextmacro InitFontObject ("FrizQT", ">", "88", "FQ", "23.0", "11.0", "15.0")
//! runtextmacro InitFontObject ("FrizQT", "<", "89", "FQ", "23.0", "11.0", "15.0")
//! runtextmacro InitFontObject ("FrizQT", "?", "90", "FQ", "20.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("FrizQT", "|", "91", "FQ", "5.0", "15.0", "28.0")
//! runtextmacro InitFontObject ("FrizQT", "`", "92", "FQ", "13.0", "17.0", "0.0")
//! runtextmacro InitFontObject ("FrizQT", "~", "93", "FQ", "25.0", "19.0", "0.0")
//! runtextmacro InitFontObject ("Immortal", "A", "0", "IM0", "39.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "B", "1", "IM0", "31.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "C", "2", "IM0", "36.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "D", "3", "IM0", "42.0", "15.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "E", "4", "IM0", "34.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "F", "5", "IM0", "30.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "G", "6", "IM0", "41.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "H", "7", "IM0", "47.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "I", "8", "IM0", "19.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "J", "9", "IM0", "28.0", "15.0", "32.0")
//! runtextmacro InitFontObject ("Immortal", "K", "10", "IM", "39.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "L", "11", "IM", "34.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "M", "12", "IM", "54.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "N", "13", "IM", "41.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "O", "14", "IM", "43.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "P", "15", "IM", "32.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "Q", "16", "IM", "43.0", "16.0", "27.0")
//! runtextmacro InitFontObject ("Immortal", "R", "17", "IM", "35.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "S", "18", "IM", "29.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "T", "19", "IM", "41.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "U", "20", "IM", "43.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "V", "21", "IM", "45.0", "16.0", "23.0")
//! runtextmacro InitFontObject ("Immortal", "W", "22", "IM", "45.0", "15.0", "21.0")
//! runtextmacro InitFontObject ("Immortal", "X", "23", "IM", "43.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "Y", "24", "IM", "41.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "Z", "25", "IM", "40.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "a", "26", "IM", "29.0", "4.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "b", "27", "IM", "28.0", "12.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "c", "28", "IM", "21.0", "3.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "d", "29", "IM", "26.0", "12.0", "21.0")
//! runtextmacro InitFontObject ("Immortal", "e", "30", "IM", "21.0", "2.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "f", "31", "IM", "25.0", "17.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "g", "32", "IM", "26.0", "2.0", "33.0")
//! runtextmacro InitFontObject ("Immortal", "h", "33", "IM", "31.0", "12.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "i", "34", "IM", "13.0", "17.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "j", "35", "IM", "18.0", "17.0", "33.0")
//! runtextmacro InitFontObject ("Immortal", "k", "36", "IM", "29.0", "12.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "l", "37", "IM", "14.0", "12.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "m", "38", "IM", "43.0", "2.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "n", "39", "IM", "29.0", "2.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "o", "40", "IM", "26.0", "2.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "p", "41", "IM", "29.0", "4.0", "33.0")
//! runtextmacro InitFontObject ("Immortal", "q", "42", "IM", "27.0", "2.0", "33.0")
//! runtextmacro InitFontObject ("Immortal", "r", "43", "IM", "20.0", "4.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "s", "44", "IM", "20.0", "3.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "t", "45", "IM", "17.0", "11.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "u", "46", "IM", "27.0", "3.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "v", "47", "IM", "25.0", "2.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "w", "48", "IM", "38.0", "2.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "x", "49", "IM", "25.0", "2.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "y", "50", "IM", "26.0", "3.0", "32.0")
//! runtextmacro InitFontObject ("Immortal", "z", "51", "IM", "26.0", "3.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "1", "52", "IM", "18.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "2", "53", "IM", "28.0", "15.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "3", "54", "IM", "26.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "4", "55", "IM", "29.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "5", "56", "IM", "26.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "6", "57", "IM", "26.0", "16.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "7", "58", "IM", "29.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "8", "59", "IM", "26.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "9", "60", "IM", "26.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "0", "61", "IM", "29.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "!", "62", "IM", "11.0", "12.0", "22.0")
//! runtextmacro InitFontObject ("Immortal", "@", "63", "IM", "59.0", "21.0", "30.0")
//! runtextmacro InitFontObject ("Immortal", "#", "64", "IM", "23.0", "10.0", "11.0")
//! runtextmacro InitFontObject ("Immortal", "$", "65", "IM", "27.0", "17.0", "23.0")
//! runtextmacro InitFontObject ("Immortal", "%", "66", "IM", "45.0", "16.0", "20.0")
//! runtextmacro InitFontObject ("Immortal", "^", "67", "IM", "20.0", "16.0", "0.0")
//! runtextmacro InitFontObject ("Immortal", "&", "68", "IM", "34.0", "15.0", "19.0")
//! runtextmacro InitFontObject ("Immortal", "*", "69", "IM", "17.0", "14.0", "3.0")
//! runtextmacro InitFontObject ("Immortal", ")", "70", "IM", "19.0", "18.0", "34.0")
//! runtextmacro InitFontObject ("Immortal", "(", "71", "IM", "19.0", "18.0", "34.0")
//! runtextmacro InitFontObject ("Immortal", "-", "72", "IM", "18.0", "0.0", "8.0")
//! runtextmacro InitFontObject ("Immortal", "=", "73", "IM", "26.0", "8.0", "7.0")
//! runtextmacro InitFontObject ("Immortal", "_", "74", "IM", "33.0", "0.0", "25.0")
//! runtextmacro InitFontObject ("Immortal", "+", "75", "IM", "29.0", "15.0", "15.0")
//! runtextmacro InitFontObject ("Immortal", "]", "76", "IM", "10.0", "18.0", "33.0")
//! runtextmacro InitFontObject ("Immortal", "[", "77", "IM", "10.0", "18.0", "33.0")
//! runtextmacro InitFontObject ("Immortal", "}", "78", "IM", "17.0", "15.0", "33.0")
//! runtextmacro InitFontObject ("Immortal", "{", "79", "IM", "17.0", "15.0", "33.0")
//! runtextmacro InitFontObject ("Immortal", ";", "80", "IM", "11.0", "5.0", "25.0")
//! runtextmacro InitFontObject ("Immortal", ":", "81", "IM", "11.0", "5.0", "22.0")
//! runtextmacro InitFontObject ("Immortal", "'", "82", "IM", "7.0", "15.0", "3.0")
//! runtextmacro InitFontObject ("Immortal", "''","83", "IM", "15.0", "15.0", "3.0")
//! runtextmacro InitFontObject ("Immortal", ",", "84", "IM", "9.0", "0.0", "25.0")
//! runtextmacro InitFontObject ("Immortal", ".", "85", "IM", "11.0", "0.0", "22.0")
//! runtextmacro InitFontObject ("Immortal", "/", "86", "IM", "32.0", "21.0", "26.0")
//! runtextmacro InitFontObject ("Immortal", "\\","87", "IM", "32.0", "21.0", "26.0")
//! runtextmacro InitFontObject ("Immortal", ">", "88", "IM", "22.0", "14.0", "15.0")
//! runtextmacro InitFontObject ("Immortal", "<", "89", "IM", "22.0", "14.0", "15.0")
//! runtextmacro InitFontObject ("Immortal", "?", "90", "IM", "18.0", "15.0", "22.0")
//! runtextmacro InitFontObject ("Immortal", "|", "91", "IM", "5.0", "21.0", "26.0")
//! runtextmacro InitFontObject ("Immortal", "`", "92", "IM", "10.0", "14.0", "0.0")
//! runtextmacro InitFontObject ("Immortal", "~", "93", "IM", "22.0", "13.0", "0.0")
endmodule
library Ascii /* v1.1.0.0 Nestharus/Bribe
************************************************************************************
*
* function Char2Ascii takes string s returns integer
* integer ascii = Char2Ascii("F")
*
* function Ascii2Char takes integer a returns string
* string char = Ascii2Char('F')
*
* function A2S takes integer a returns string
* string rawcode = A2S('CODE')
*
* function S2A takes string s returns integer
* integer rawcode = S2A("CODE")
*
************************************************************************************/
globals
private integer array i //hash
private integer array h //hash2
private integer array y //hash3
private string array c //char
endglobals
function Char2Ascii takes string p returns integer
local integer z = i[StringHash(p)/0x1F0748+0x40D]
if (c[z] != p) then
if (c[z - 32] != p) then
if (c[h[z]] != p) then
if (c[y[z]] != p) then
if (c[83] != p) then
debug call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"ASCII ERROR: INVALID CHARACTER: " + p)
return 0
endif
return 83
endif
return y[z]
endif
return h[z]
endif
return z - 32
endif
return z
endfunction
function Ascii2Char takes integer a returns string
return c[a]
endfunction
function A2S takes integer a returns string
local string s=""
loop
set s=c[a-a/256*256]+s
set a=a/256
exitwhen 0==a
endloop
return s
endfunction
function S2A takes string s returns integer
local integer a=0
local integer l=StringLength(s)
local integer j=0
local string m
local integer h
loop
exitwhen j==l
set a = a*256 + Char2Ascii(SubString(s,j,j+1))
set j=j+1
endloop
return a
endfunction
private module Init
private static method onInit takes nothing returns nothing
set i[966] = 8
set i[1110] = 9
set i[1621] = 10
set i[1375] = 12
set i[447] = 13
set i[233] = 32
set i[2014] = 33
set i[1348] = 34
set i[1038] = 35
set i[1299] = 36
set i[1018] = 37
set i[1312] = 38
set i[341] = 39
set i[939] = 40
set i[969] = 41
set i[952] = 42
set i[2007] = 43
set i[1415] = 44
set i[2020] = 45
set i[904] = 46
set i[1941] = 47
set i[918] = 48
set i[1593] = 49
set i[719] = 50
set i[617] = 51
set i[703] = 52
set i[573] = 53
set i[707] = 54
set i[1208] = 55
set i[106] = 56
set i[312] = 57
set i[124] = 58
set i[1176] = 59
set i[74] = 60
set i[1206] = 61
set i[86] = 62
set i[340] = 63
set i[35] = 64
set i[257] = 65
set i[213] = 66
set i[271] = 67
set i[219] = 68
set i[1330] = 69
set i[1425] = 70
set i[1311] = 71
set i[238] = 72
set i[1349] = 73
set i[244] = 74
set i[1350] = 75
set i[205] = 76
set i[1392] = 77
set i[1378] = 78
set i[1432] = 79
set i[1455] = 80
set i[1454] = 81
set i[1431] = 82
set i[1409] = 83
set i[1442] = 84
set i[534] = 85
set i[1500] = 86
set i[771] = 87
set i[324] = 88
set i[1021] = 89
set i[73] = 90
set i[1265] = 91
set i[1941] = 92
set i[1671] = 93
set i[1451] = 94
set i[1952] = 95
set i[252] = 96
set i[257] = 97
set i[213] = 98
set i[271] = 99
set i[219] = 100
set i[1330] = 101
set i[1425] = 102
set i[1311] = 103
set i[238] = 104
set i[1349] = 105
set i[244] = 106
set i[1350] = 107
set i[205] = 108
set i[1392] = 109
set i[1378] = 110
set i[1432] = 111
set i[1455] = 112
set i[1454] = 113
set i[1431] = 114
set i[1409] = 115
set i[1442] = 116
set i[534] = 117
set i[1500] = 118
set i[771] = 119
set i[324] = 120
set i[1021] = 121
set i[73] = 122
set i[868] = 123
set i[1254] = 124
set i[588] = 125
set i[93] = 126
set i[316] = 161
set i[779] = 162
set i[725] = 163
set i[287] = 164
set i[212] = 165
set i[7] = 166
set i[29] = 167
set i[1958] = 168
set i[1009] = 169
set i[1580] = 170
set i[1778] = 171
set i[103] = 172
set i[400] = 174
set i[1904] = 175
set i[135] = 176
set i[1283] = 177
set i[469] = 178
set i[363] = 179
set i[550] = 180
set i[1831] = 181
set i[1308] = 182
set i[1234] = 183
set i[1017] = 184
set i[1093] = 185
set i[1577] = 186
set i[606] = 187
set i[1585] = 188
set i[1318] = 189
set i[980] = 190
set i[1699] = 191
set i[1292] = 192
set i[477] = 193
set i[709] = 194
set i[1600] = 195
set i[2092] = 196
set i[50] = 197
set i[546] = 198
set i[408] = 199
set i[853] = 200
set i[205] = 201
set i[411] = 202
set i[1311] = 203
set i[1422] = 204
set i[1808] = 205
set i[457] = 206
set i[1280] = 207
set i[614] = 208
set i[1037] = 209
set i[237] = 210
set i[1409] = 211
set i[1023] = 212
set i[1361] = 213
set i[695] = 214
set i[161] = 215
set i[1645] = 216
set i[1822] = 217
set i[644] = 218
set i[1395] = 219
set i[677] = 220
set i[1677] = 221
set i[881] = 222
set i[861] = 223
set i[1408] = 224
set i[1864] = 225
set i[1467] = 226
set i[1819] = 227
set i[1971] = 228
set i[949] = 229
set i[774] = 230
set i[1828] = 231
set i[865] = 232
set i[699] = 233
set i[786] = 234
set i[1806] = 235
set i[1286] = 236
set i[1128] = 237
set i[1490] = 238
set i[1720] = 239
set i[1817] = 240
set i[729] = 241
set i[1191] = 242
set i[1164] = 243
set i[413] = 244
set i[349] = 245
set i[1409] = 246
set i[660] = 247
set i[2016] = 248
set i[1087] = 249
set i[1497] = 250
set i[753] = 251
set i[1579] = 252
set i[1456] = 253
set i[606] = 254
set i[1625] = 255
set h[92] = 47
set h[201] = 108
set h[201] = 76
set h[203] = 103
set h[203] = 71
set h[246] = 115
set h[246] = 83
set h[246] = 211
set h[254] = 187
set y[201] = 108
set y[203] = 103
set y[246] = 115
set c[8]="\b"
set c[9]="\t"
set c[10]="\n"
set c[12]="\f"
set c[13]="\r"
set c[32]=" "
set c[33]="!"
set c[34]="\""
set c[35]="#"
set c[36]="$"
set c[37]="%"
set c[38]="&"
set c[39]="'"
set c[40]="("
set c[41]=")"
set c[42]="*"
set c[43]="+"
set c[44]=","
set c[45]="-"
set c[46]="."
set c[47]="/"
set c[48]="0"
set c[49]="1"
set c[50]="2"
set c[51]="3"
set c[52]="4"
set c[53]="5"
set c[54]="6"
set c[55]="7"
set c[56]="8"
set c[57]="9"
set c[58]=":"
set c[59]=";"
set c[60]="<"
set c[61]="="
set c[62]=">"
set c[63]="?"
set c[64]="@"
set c[65]="A"
set c[66]="B"
set c[67]="C"
set c[68]="D"
set c[69]="E"
set c[70]="F"
set c[71]="G"
set c[72]="H"
set c[73]="I"
set c[74]="J"
set c[75]="K"
set c[76]="L"
set c[77]="M"
set c[78]="N"
set c[79]="O"
set c[80]="P"
set c[81]="Q"
set c[82]="R"
set c[83]="S"
set c[84]="T"
set c[85]="U"
set c[86]="V"
set c[87]="W"
set c[88]="X"
set c[89]="Y"
set c[90]="Z"
set c[91]="["
set c[92]="\\"
set c[93]="]"
set c[94]="^"
set c[95]="_"
set c[96]="`"
set c[97]="a"
set c[98]="b"
set c[99]="c"
set c[100]="d"
set c[101]="e"
set c[102]="f"
set c[103]="g"
set c[104]="h"
set c[105]="i"
set c[106]="j"
set c[107]="k"
set c[108]="l"
set c[109]="m"
set c[110]="n"
set c[111]="o"
set c[112]="p"
set c[113]="q"
set c[114]="r"
set c[115]="s"
set c[116]="t"
set c[117]="u"
set c[118]="v"
set c[119]="w"
set c[120]="x"
set c[121]="y"
set c[122]="z"
set c[123]="{"
set c[124]="|"
set c[125]="}"
set c[126]="~"
set c[128] = "€"
set c[130] = "‚"
set c[131] = "ƒ"
set c[132] = "„"
set c[133] = "…"
set c[134] = "†"
set c[135] = "‡"
set c[136] = "ˆ"
set c[137] = "‰"
set c[138] = "Š"
set c[139] = "‹"
set c[140] = "Œ"
set c[142] = "Ž"
set c[145] = "‘"
set c[146] = "’"
set c[147] = "“"
set c[148] = "”"
set c[149] = "•"
set c[150] = "–"
set c[151] = "—"
set c[152] = "˜"
set c[153] = "™"
set c[154] = "š"
set c[155] = "›"
set c[156] = "œ"
set c[158] = "ž"
set c[159] = "Ÿ"
set c[160] = " "
set c[161] = "¡"
set c[162] = "¢"
set c[163] = "£"
set c[164] = "¤"
set c[165] = "¥"
set c[166] = "¦"
set c[167] = "§"
set c[168] = "¨"
set c[169] = "©"
set c[170] = "ª"
set c[171] = "«"
set c[172] = "¬"
set c[174] = "®"
set c[175] = "¯"
set c[176] = "°"
set c[177] = "±"
set c[178] = "²"
set c[179] = "³"
set c[180] = "´"
set c[181] = "µ"
set c[182] = "¶"
set c[183] = "·"
set c[184] = "¸"
set c[185] = "¹"
set c[186] = "º"
set c[187] = "»"
set c[188] = "¼"
set c[189] = "½"
set c[190] = "¾"
set c[191] = "¿"
set c[192] = "À"
set c[193] = "Á"
set c[194] = "Â"
set c[195] = "Ã"
set c[196] = "Ä"
set c[197] = "Å"
set c[198] = "Æ"
set c[199] = "Ç"
set c[200] = "È"
set c[201] = "É"
set c[202] = "Ê"
set c[203] = "Ë"
set c[204] = "Ì"
set c[205] = "Í"
set c[206] = "Î"
set c[207] = "Ï"
set c[208] = "Ð"
set c[209] = "Ñ"
set c[210] = "Ò"
set c[211] = "Ó"
set c[212] = "Ô"
set c[213] = "Õ"
set c[214] = "Ö"
set c[215] = "×"
set c[216] = "Ø"
set c[217] = "Ù"
set c[218] = "Ú"
set c[219] = "Û"
set c[220] = "Ü"
set c[221] = "Ý"
set c[222] = "Þ"
set c[223] = "ß"
set c[224] = "à"
set c[225] = "á"
set c[226] = "â"
set c[227] = "ã"
set c[228] = "ä"
set c[229] = "å"
set c[230] = "æ"
set c[231] = "ç"
set c[232] = "è"
set c[233] = "é"
set c[234] = "ê"
set c[235] = "ë"
set c[236] = "ì"
set c[237] = "í"
set c[238] = "î"
set c[239] = "ï"
set c[240] = "ð"
set c[241] = "ñ"
set c[242] = "ò"
set c[243] = "ó"
set c[244] = "ô"
set c[245] = "õ"
set c[246] = "ö"
set c[247] = "÷"
set c[248] = "ø"
set c[249] = "ù"
set c[250] = "ú"
set c[251] = "û"
set c[252] = "ü"
set c[253] = "ý"
set c[254] = "þ"
set c[255] = "ÿ"
endmethod
endmodule
private struct Inits extends array
implement Init
endstruct
endlibrary
//! runtextmacro CreateFontObject ("FrizQT", "0", "FQ0", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "1", "FQ0", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "2", "FQ0", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "3", "FQ0", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "4", "FQ0", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "5", "FQ0", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "6", "FQ0", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "7", "FQ0", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "8", "FQ0", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "9", "FQ0", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "10", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "11", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "12", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "13", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "14", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "15", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "16", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "17", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "18", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "19", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "20", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "21", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "22", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "23", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "24", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "25", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "26", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "27", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "28", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "29", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "30", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "31", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "32", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "33", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "34", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "35", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "36", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "37", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "38", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "39", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "40", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "41", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "42", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "43", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "44", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "45", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "46", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "47", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "48", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "49", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "50", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "51", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "52", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "53", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "54", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "55", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "56", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "57", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "58", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "59", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "60", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "61", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "62", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "63", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "64", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "65", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "66", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "67", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "68", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "69", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "70", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "71", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "72", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "73", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "74", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "75", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "76", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "77", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "78", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "79", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "80", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "81", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "82", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "83", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "84", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "85", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "86", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "87", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "88", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "89", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "90", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "91", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "92", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("FrizQT", "93", "FQ", "war3mapImported\FrizQTFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "0", "IM0", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "1", "IM0", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "2", "IM0", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "3", "IM0", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "4", "IM0", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "5", "IM0", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "6", "IM0", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "7", "IM0", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "8", "IM0", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "9", "IM0", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "10", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "11", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "12", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "13", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "14", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "15", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "16", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "17", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "18", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "19", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "20", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "21", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "22", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "23", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "24", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "25", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "26", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "27", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "28", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "29", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "30", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "31", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "32", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "33", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "34", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "35", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "36", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "37", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "38", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "39", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "40", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "41", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "42", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "43", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "44", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "45", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "46", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "47", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "48", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "49", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "50", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "51", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "52", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "53", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "54", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "55", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "56", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "57", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "58", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "59", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "60", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "61", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "62", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "63", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "64", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "65", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "66", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "67", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "68", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "69", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "70", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "71", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "72", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "73", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "74", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "75", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "76", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "77", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "78", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "79", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "80", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "81", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "82", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "83", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "84", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "85", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "86", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "87", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "88", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "89", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "90", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "91", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "92", "IM", "war3mapImported\ImmortalFontChar", ".blp")
//! runtextmacro CreateFontObject ("Immortal", "93", "IM", "war3mapImported\ImmortalFontChar", ".blp")
scope Examples initializer init
globals
Panel HPPanel
Panel InventoryPanel
Panel ModelPanel
PanelPlatform array InventoryIcon
PanelText FrizQTText
PanelText ImmortalText
hashtable Hash
endglobals
private function onChat takes nothing returns boolean
call FrizQTText.setText("FrizQT Font: " + GetEventPlayerChatString(), FONTSTYLE_FrizQT)
call FrizQTText.setColor(255, 255, 0, 255)
call FrizQTText.move(-FrizQTText.width/2, -200, 0) // Make it centered
call FrizQTText.refresh()
call ImmortalText.setText("Immortal Font: " + GetEventPlayerChatString(), FONTSTYLE_Immortal)
call ImmortalText.setColor(255, 255, 0, 255)
call ImmortalText.move(-ImmortalText.width/2, -225, 0) // Make it centered
call ImmortalText.refresh()
return false
endfunction
private function onDrop takes nothing returns boolean
local integer skin
local integer index = GetUnitItemSlot(GetTriggerUnit(), GetManipulatedItem())
local item itm
if Locale == GetTriggerPlayer() then
set skin = 'B000'
else
set itm = UnitItemInSlot(MainUnit[PNumb], index)
if itm == null then
set skin = 'B000'
else
set skin = LoadInteger(Hash, GetItemTypeId(itm), 0)
endif
endif
set InventoryIcon[index].texture = skin
return false
endfunction
private function onAcquire takes nothing returns boolean
local integer index = GetUnitItemSlot(GetTriggerUnit(), GetManipulatedItem())
local item itm = UnitItemInSlot(MainUnit[PNumb], index)
local integer skin
if itm == null then
set skin = 'B000'
else
set skin = LoadInteger(Hash, GetItemTypeId(itm), 0)
endif
set InventoryIcon[index].texture = skin
return false
endfunction
private function onMove takes nothing returns boolean
local item itm
local integer skin1
local integer skin2
local integer index1 = GetEventInventorySlotTo()
local integer index2 = GetEventInventorySlotFrom()
if Locale == GetTriggerPlayer() then
set skin1 = LoadInteger(Hash, GetItemTypeId(GetEventInventoryItem()), 0)
set itm = GetEventInventorySwapped()
if itm == null then
set skin2 = 'B000'
else
set skin2 = LoadInteger(Hash, GetItemTypeId(itm), 0)
endif
else
set itm = UnitItemInSlot(MainUnit[PNumb], index1)
if itm == null then
set skin1 = 'B000'
else
set skin1 = LoadInteger(Hash, GetItemTypeId(itm), 0)
endif
set itm = UnitItemInSlot(MainUnit[PNumb], index2)
if itm == null then
set skin2 = 'B000'
else
set skin2 = LoadInteger(Hash, GetItemTypeId(itm), 0)
endif
endif
set InventoryIcon[index1].texture = skin1
set InventoryIcon[index2].texture = skin2
return false
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
local real x
local Panel p
// Instantiate the inventory panel
set InventoryPanel = Panel.create('h003', 'B005', 550, -175, 1.0)
// Initialize item icons for the custom inventory
loop
exitwhen i > 5
if ModuloInteger(i, 2) == 0 then
set x = -32
else
set x = 32
endif
// Add new icon to the inventory panel
set InventoryIcon[i] = PanelPlatform.create(InventoryPanel, 'h001', 'B000', x, 50.0-52.0*I2R(i/2), 1)
set i = i + 1
endloop
set HPPanel = Panel.create('h002', 'B004', -450.0, 225.0, 0.0)
set HPPanel.scale = 1.2698
// PanelModel test
set ModelPanel = Panel.create('h002', 'B000', 0, 0, 2.5)
call PanelModel.create(ModelPanel, "units\\orc\\Peon\\Peon.mdx", 300, 200, 0)
call PanelTextTag.create(ModelPanel, GetLocalPlayer(), "\"Hello, I'm the incredible peon!\"", 0.021, 350, 250)
call PanelTextTag.create(ModelPanel, GetLocalPlayer(), "\"Use arrow keys to rotate the camera around\"", 0.021, 350, 230)
// PanelTextTag test
call PanelTextTag.create(HPPanel, GetLocalPlayer(), GetPlayerName(GetLocalPlayer()), 0.018, -50, 27)
call PanelTextTag.create(InventoryPanel, GetLocalPlayer(), "Inventory", 0.021, -35, 70).setColor(254, 211, 18, 255)
// PanelText
set p = Panel.create('h001', 'B000', 0.0, 0.0, 0.0)
set FrizQTText = PanelText.create(p, "\"Say anything to change this text\"", FONTSTYLE_FrizQT, 0, -200, 0)
set FrizQTText.scale = 0.5
set FrizQTText.transformAxis = false
call FrizQTText.setColor(255, 255, 0, 255)
call FrizQTText.move(-FrizQTText.width/2, -200, 0) // Make it centered
call FrizQTText.refresh()
set ImmortalText = PanelText.create(p, "\"Say anything to change this text\"", FONTSTYLE_Immortal, 0, -225, 0)
set ImmortalText.scale = 0.5
set ImmortalText.transformAxis = false
call ImmortalText.setColor(255, 255, 0, 255)
call ImmortalText.move(-ImmortalText.width/2, -225, 0) // Make it centered
call ImmortalText.refresh()
// Custom inventory settings
set Hash = InitHashtable()
call SaveInteger(Hash, 'penr', 0, 'B001')
call SaveInteger(Hash, 'rde1', 0, 'B002')
call SaveInteger(Hash, 'pmna', 0, 'B003')
call RegisterInventoryEvent(function onMove, InventoryEvent.MOVED)
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_PICKUP_ITEM)
call TriggerAddCondition(t, Condition(function onAcquire))
set t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DROP_ITEM)
call TriggerAddCondition(t, Condition(function onDrop))
set t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(0), "", false)
call TriggerRegisterPlayerChatEvent(t, Player(1), "", false)
call TriggerRegisterPlayerChatEvent(t, Player(2), "", false)
call TriggerAddCondition(t, Condition(function onChat))
endfunction
endscope
scope TestCode initializer init
globals
real Smooth = 0.5
unit array MainUnit
timer Tim = CreateTimer()
player Locale
integer PNumb
endglobals
private function def takes nothing returns nothing
local real x
local real y
local real uz
local real z2
local real rot
local real d
local real cd
local real mhx
local real mh
local real z
local real cz
local integer i = 0
loop
exitwhen i > 3
set x = GetUnitX(MainUnit[i])
set y = GetUnitY(MainUnit[i])
set uz = PanelCore_GetUnitZ(MainUnit[i])
static if LIBRARY_ZLibrary then
set z2 = GetSurfaceZ(x, y)
else
set z2 = PanelCore_GetTerrainZ(x, y)
endif
set rot = CamRot*bj_DEGTORAD
set d = 64
if IsUnitType(MainUnit[i], UNIT_TYPE_FLYING) then
set cd = 800
else
set cd = 450
endif
set mhx = -45
loop
exitwhen d >= 1200
set x = x-64*Cos(rot)
set y = y-64*Sin(rot)
static if LIBRARY_ZLibrary then
set z = GetSurfaceZ(x, y)
else
set z = PanelCore_GetTerrainZ(x, y)
endif
if cd == 450 and d < 450 then
if RAbsBJ(z) > RAbsBJ(z2) then
set z2 = z
endif
if not IsUnitType(MainUnit[i], UNIT_TYPE_FLYING) and not IsTerrainWalkable(x, y) then
set cd = d
endif
endif
set mh = Atan((z-uz)/d)*bj_RADTODEG
if mh > mhx then
set mhx = mh
endif
set d = d + 64
endloop
if cd < 100 then
set cd = 100
endif
if Locale == Player(i) then
if CamAng > 360-mhx then
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, 360-mhx, Smooth)
else
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, CamAng, Smooth)
endif
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, cd, Smooth)
call SetCameraField(CAMERA_FIELD_FARZ, 5000.0, Smooth)
call SetCameraField(CAMERA_FIELD_ROTATION, rot*bj_RADTODEG, Smooth)
set cz = GetCameraField(CAMERA_FIELD_ZOFFSET)+uz+100.0-GetCameraTargetPositionZ()
call SetCameraField(CAMERA_FIELD_ZOFFSET, cz, Smooth)
call PanCameraToTimed(GetUnitX(MainUnit[i]), GetUnitY(MainUnit[i]), Smooth*(0.2/0.5))
endif
set i = i + 1
endloop
static if LIBRARY_PanelCamera then
call RefreshCamera()
endif
endfunction
private function onCast takes nothing returns boolean
local integer spell = GetSpellAbilityId()
if Locale == GetTriggerPlayer() then
if spell == 'A001' then
call InventoryPanel.show(not InventoryPanel.visible)
call InventoryPanel.refresh()
elseif spell == 'A002' then
set CamRot = GetUnitFacing(MainUnit[PNumb])
elseif spell == 'A003' then
if Smooth == 0.5 then
set Smooth = 0
call BJDebugMsg("Camera Smoothing: |cffff0000Disabled|r")
else
set Smooth = 0.5
call BJDebugMsg("Camera Smoothing: |cff00ff00Enabled|r")
endif
endif
endif
return false
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function onCast))
set Locale = GetLocalPlayer()
set PNumb = GetPlayerId(Locale)
set MainUnit[0] = gg_unit_hfoo_0004
set MainUnit[1] = gg_unit_hfoo_0002
set MainUnit[2] = gg_unit_hfoo_0005
call TimerStart(CreateTimer(), 0.03, true, function def)
call FogEnable(false)
call FogMaskEnable(false)
call EnableDragSelect(true, false)
call SelectUnit(MainUnit[PNumb], true)
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, 450, 0)
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, 350, 0)
call SetCameraField(CAMERA_FIELD_ROTATION, GetUnitFacing(MainUnit[PNumb]), 0)
call SetCameraPosition(GetUnitX(MainUnit[PNumb]), GetUnitY(MainUnit[PNumb]))
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Arrow initializer init
globals
real CamAng = 350
real CamRot = 90
endglobals
private function check takes nothing returns nothing
if IsArrowKeyPressed(Locale, ARROW_KEY_UP) then
set CamAng = CamAng+3
if CamAng > 405 then
set CamAng = 405
endif
elseif IsArrowKeyPressed(Locale, ARROW_KEY_DOWN) then
set CamAng = CamAng-3
if CamAng < 275 then
set CamAng = 275
endif
endif
if IsArrowKeyPressed(Locale, ARROW_KEY_LEFT) then
set CamRot = CamRot+3
if CamRot >= 360 then
set CamRot = CamRot - 360
endif
elseif IsArrowKeyPressed(Locale, ARROW_KEY_RIGHT) then
set CamRot = CamRot-3
if CamRot < 0 then
set CamRot = CamRot + 360
endif
endif
endfunction
private function init takes nothing returns nothing
call TimerStart(CreateTimer(), 0.03, true, function check)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
library ArrowKeyEvent /*
=========================================================================
ArrowKeyEvent version 1.1.0.0
=========================================================================
Credits:
-------------------------------------------------------------------------
- Written by Bribe.
- Earth-Fury for providing a lot of inspiration for the development of
this system (especially documentation) via his KeyAction resource.
- tooltiperror & Sgqvur for providing very helpful, constructive advice.
- SA Dashie for the functionality to enable/disable an individual module
event.
=========================================================================
Introduction:
-------------------------------------------------------------------------
Easy to use, efficient system for handling all arrow key events. It uses
arrays and GetHandleId lookups to avoid the trap of many cloned functions
that so many arrow key systems suffer from.
=========================================================================
API Guide:
-------------------------------------------------------------------------
To help centralize and make everything understandable, I originally used
the constants appointed by Blizzard (bj_KEYEVENTKEY_LEFT/RIGHT/etc). But
there was a lot of criticism over their ugliness so I made the following
constants to correspond accordingly. They have the same values as the BJ
constants, so you can use whichever is more appealing for you.
Their purpose is to be passed as arguments so you are able to query such
things as "is this key pressed" or simply to help make sense of what key
was pressed from an event response and interpret it as an integer.
constant integer ARROW_KEY_LEFT = 0
constant integer ARROW_KEY_RIGHT = 1
constant integer ARROW_KEY_DOWN = 2
constant integer ARROW_KEY_UP = 3
-------------------------------------------------------------------------
As I was developing this resource, is was mostly written in vanilla JASS.
I had since converted it to OOP syntax but it has been requested to bring
it back. I have made it available once again.
function IsArrowKeyPressed
takes player whichPlayer, integer arrowKey
returns boolean
To find out if the arrow key was pressed, you need to first ask which
player is holding down the key, and then pass an ARROW_KEY constant
to represent the key you are querying for.
function RegisterArrowKeyEvent
takes code onEvent
returns nothing
Instead of making up to 8 different functions for 8 different events,
you can use this instead. Just specify a function that you want to be
called whenever any key is pressed. For event responses, reference 1
of the following 3 functions:
function GetEventArrowKeyPlayerId
takes nothing
returns integer
This is more of an optimization benefit than not. GetTriggerPlayer()
will get you the player who pressed the key, but most of the time you
just need to know the player ID of that person.
function GetEventArrowKey
takes nothing
returns integer
Call this function to find out which key was pressed. It will return
one of the four ARROW_KEY constants, of course.
function IsEventArrowKeyPressed
takes nothing
returns boolean
This is also here more for optimization's benefit. You can certainly
use "IsArrowKeyPressed(GetEventArrowKey(GetEventArrowKeyPlayerId()))"
but this is much more convenient I must say.
-------------------------------------------------------------------------
"implement ArrowKey"
ArrowKey API is accessible as if it were part of the implementing struct
itself. As a bonus, you can create a method "onArrowKeyEvent" that gets
called automatically when any key is pressed. The method musn't be static,
because the member "this" is a player ID (to mirror the ArrowKey struct's
own API). It must take an integer as its first argument to represent the
pressed or released key. As a final argument, it must take a boolean to
determine if the key was pressed (true) or released (false).
The member "this" taken by the method is a player ID.
NEW: Each module has its own enabler of the event, either as a whole or
for an individual player(s). This is entirely due to the work done by SA Dashie.
*/
//=======================================================================
//
// System Code
//
//=======================================================================
globals
//-------------------------------------------------------------------
// Yo dawg, I herd you like constant variables so I gave you some new
// constant variables so you can have some constant variables to go
// with Blizzard's constant variables.
//
constant integer ARROW_KEY_LEFT = bj_KEYEVENTKEY_LEFT
constant integer ARROW_KEY_RIGHT = bj_KEYEVENTKEY_RIGHT
constant integer ARROW_KEY_DOWN = bj_KEYEVENTKEY_DOWN
constant integer ARROW_KEY_UP = bj_KEYEVENTKEY_UP
endglobals
//=======================================================================
// Ugly modules are needed to prevent initialization bugs.
//
private module Init
private static method onInit takes nothing returns nothing
local player p
local integer i = 12
local trigger t = .trig
loop
set i = i - 1
set p = Player(i)
if GetPlayerSlotState(p) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController(p) == MAP_CONTROL_USER then
//Register arrow key events for playing players
call TriggerRegisterPlayerEvent(t, p, EVENT_PLAYER_ARROW_LEFT_DOWN)
call TriggerRegisterPlayerEvent(t, p, EVENT_PLAYER_ARROW_LEFT_UP)
call TriggerRegisterPlayerEvent(t, p, EVENT_PLAYER_ARROW_RIGHT_DOWN)
call TriggerRegisterPlayerEvent(t, p, EVENT_PLAYER_ARROW_RIGHT_UP)
call TriggerRegisterPlayerEvent(t, p, EVENT_PLAYER_ARROW_DOWN_DOWN)
call TriggerRegisterPlayerEvent(t, p, EVENT_PLAYER_ARROW_DOWN_UP)
call TriggerRegisterPlayerEvent(t, p, EVENT_PLAYER_ARROW_UP_DOWN)
call TriggerRegisterPlayerEvent(t, p, EVENT_PLAYER_ARROW_UP_UP)
//Run if library ArrowKey is found in the map.
//! runtextmacro optional INIT_ARROW_KEY_AA()
endif
exitwhen i == 0
endloop
//Run if library ArrowKey is found in the map.
//! runtextmacro optional INIT_ARROW_KEY_CALL_LINK()
call .registerEvent(function ArrowKey.actions)
set p = null
set t = null
endmethod
endmodule
//=======================================================================
// A central struct to handle all ArrowKey mechanics. This has its uses,
// giving you slightly more control over the inner system functionality.
//
struct ArrowKey extends array
//-------------------------------------------------------------------
// Event responses
//
readonly static integer eventKey = 0 //Arrow key that triggered the event.
readonly static boolean eventKeyPressed = false //Was the arrow key pressed?
readonly static ArrowKey eventPlayerId = 0 //The id of the player who pressed the key.
//Run if library ArrowKey is found in the map.
//! runtextmacro optional ARROW_KEY_DECLARE_ARRAYS()
//-------------------------------------------------------------------
// System variables
//
private static trigger trig = CreateTrigger() //Handles all events.
private static boolean array press //Is key pressed?
//===================================================================
// User-friendly typecasting.
//
static method operator [] takes player who returns ArrowKey
return GetPlayerId(who)
endmethod
//===================================================================
// Great for simplifying arrow key events - this function runs when
// any player presses or releases an arrow key. The code passed is
// expected to "return false".
//
static method registerEvent takes code onEvent returns nothing
call TriggerAddCondition(.trig, Filter(onEvent))
return
endmethod
//===================================================================
// Returns true if the key is pressed, false if it is released.
//
method isPressed takes integer arrow returns boolean
return press[this + arrow * 12]
endmethod
//Run if library ArrowKey is found in the map.
//! runtextmacro optional ARROW_KEY_AXIS_METHODS()
//===================================================================
// If you are running debug tests, this might come in handy.
//
static if DEBUG_MODE then
static method getKeyName takes integer arrow returns string
if arrow == ARROW_KEY_LEFT then
return "LEFT"
elseif arrow == ARROW_KEY_RIGHT then
return "RIGHT"
elseif arrow == ARROW_KEY_DOWN then
return "DOWN"
elseif arrow == ARROW_KEY_UP then
return "UP"
endif
return "--"
endmethod
endif
//===================================================================
//
// Private Components
//
//===================================================================
//===================================================================
// Key event handler.
//
private static method actions takes nothing returns nothing
local integer id = GetHandleId(GetTriggerEventId()) - 261
set .eventPlayerId = GetPlayerId(GetTriggerPlayer())
//If id is an even number, the key was pressed.
set .eventKey = id / 2
set .eventKeyPressed = .eventKey * 2 == id
set .press[.eventPlayerId + .eventKey * 12] = .eventKeyPressed
//Run if library ArrowKey is found in the map.
//! runtextmacro optional ARROW_KEY_SETUP()
endmethod
//Run if library ArrowKey is found in the map.
//! runtextmacro optional INIT_ARROW_KEY_LINK()
//Initialize the system via module
implement Init
endstruct
//=======================================================================
//
// Event Responses
//
//=======================================================================
//=======================================================================
function IsArrowKeyPressed takes player whichPlayer, integer arrowKey returns boolean
return ArrowKey[whichPlayer].isPressed(arrowKey)
endfunction
//=======================================================================
function RegisterArrowKeyEvent takes code onEvent returns nothing
call ArrowKey.registerEvent(onEvent)
endfunction
//=======================================================================
function GetEventArrowKeyPlayerId takes nothing returns integer
return ArrowKey.eventPlayerId
endfunction
//=======================================================================
function GetEventArrowKey takes nothing returns integer
return ArrowKey.eventKey
endfunction
//=======================================================================
function IsEventArrowKeyPressed takes nothing returns boolean
return ArrowKey.eventKeyPressed
endfunction
//=======================================================================
// Implementation of this module allows you to make your struct "extend"
// the ArrowKey struct. As a bonus feature, you can create a method named
// "onArrowKeyEvent" that is called whenever a key is pressed or released.
// The method needs "takes integer arrow, boolean pressed", and must be
// positioned *above* the "implement ArrowKey" statement (this way it is
// detected by the static if and doesn't compile to a function interface).
//
module ArrowKey
//Delegates are fun, you should try them out.
private delegate ArrowKey AK
boolean enabledFor //this variable added in version 1.1.
//===================================================================
// This method added in version 1.1. It disables or enables the event
// in this module for all players.
//
static method operator enabled= takes boolean flag returns nothing
local integer i = 12
loop
set i = i - 1
set thistype(i).enabledFor = flag
exitwhen i == 0
endloop
endmethod
//===================================================================
// Please call this method from *below the module implement statement
// if you know what's good for you.
//
static method operator [] takes player who returns thistype
return GetPlayerId(who)
endmethod
static if thistype.onArrowKeyEvent.exists then
private static method eventProxy takes nothing returns nothing
local thistype this = .eventPlayerId
if .enabledFor then
call .onArrowKeyEvent(.eventKey, .eventKeyPressed)
endif
endmethod
endif
private static method onInit takes nothing returns nothing
local thistype i = 12
loop
set i = i - 1
set i.AK = i //Delegates require some delegation of course.
set thistype(i).enabledFor = true //Every player active at first
exitwhen i == 0
endloop
static if thistype.onArrowKeyEvent.exists then
call ArrowKey.registerEvent(function thistype.eventProxy)
endif
endmethod
endmodule
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library TerrainPathability initializer Init
//******************************************************************************
//* BY: Rising_Dusk
//*
//* This script can be used to detect the type of pathing at a specific point.
//* It is valuable to do it this way because the IsTerrainPathable is very
//* counterintuitive and returns in odd ways and aren't always as you would
//* expect. This library, however, facilitates detecting those things reliably
//* and easily.
//*
//******************************************************************************
//*
//* > function IsTerrainDeepWater takes real x, real y returns boolean
//* > function IsTerrainShallowWater takes real x, real y returns boolean
//* > function IsTerrainLand takes real x, real y returns boolean
//* > function IsTerrainPlatform takes real x, real y returns boolean
//* > function IsTerrainWalkable takes real x, real y returns boolean
//*
//* These functions return true if the given point is of the type specified
//* in the function's name and false if it is not. For the IsTerrainWalkable
//* function, the MAX_RANGE constant below is the maximum deviation range from
//* the supplied coordinates that will still return true.
//*
//* The IsTerrainPlatform works for any preplaced walkable destructable. It will
//* return true over bridges, destructable ramps, elevators, and invisible
//* platforms. Walkable destructables created at runtime do not create the same
//* pathing hole as preplaced ones do, so this will return false for them. All
//* other functions except IsTerrainWalkable return false for platforms, because
//* the platform itself erases their pathing when the map is saved.
//*
//* After calling IsTerrainWalkable(x, y), the following two global variables
//* gain meaning. They return the X and Y coordinates of the nearest walkable
//* point to the specified coordinates. These will only deviate from the
//* IsTerrainWalkable function arguments if the function returned false.
//*
//* Variables that can be used from the library:
//* [real] TerrainPathability_X
//* [real] TerrainPathability_Y
//*
globals
private constant real MAX_RANGE = 10.
private constant integer DUMMY_ITEM_ID = 'wolg'
endglobals
globals
private item Item = null
private rect Find = null
private item array Hid
private integer HidMax = 0
public real X = 0.
public real Y = 0.
endglobals
function IsTerrainDeepWater takes real x, real y returns boolean
return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY)
endfunction
function IsTerrainShallowWater takes real x, real y returns boolean
return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) and IsTerrainPathable(x, y, PATHING_TYPE_BUILDABILITY)
endfunction
function IsTerrainLand takes real x, real y returns boolean
return IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY)
endfunction
function IsTerrainPlatform takes real x, real y returns boolean
return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) and not IsTerrainPathable(x, y, PATHING_TYPE_BUILDABILITY)
endfunction
private function HideItem takes nothing returns nothing
if IsItemVisible(GetEnumItem()) then
set Hid[HidMax] = GetEnumItem()
call SetItemVisible(Hid[HidMax], false)
set HidMax = HidMax + 1
endif
endfunction
function IsTerrainWalkable takes real x, real y returns boolean
//Hide any items in the area to avoid conflicts with our item
call MoveRectTo(Find, x, y)
call EnumItemsInRect(Find ,null, function HideItem)
//Try to move the test item and get its coords
call SetItemPosition(Item, x, y) //Unhides the item
set X = GetItemX(Item)
set Y = GetItemY(Item)
static if LIBRARY_IsTerrainWalkable then
//This is for compatibility with the IsTerrainWalkable library
set IsTerrainWalkable_X = X
set IsTerrainWalkable_Y = Y
endif
call SetItemVisible(Item, false)//Hide it again
//Unhide any items hidden at the start
loop
exitwhen HidMax <= 0
set HidMax = HidMax - 1
call SetItemVisible(Hid[HidMax], true)
set Hid[HidMax] = null
endloop
//Return walkability
return (X-x)*(X-x)+(Y-y)*(Y-y) <= MAX_RANGE*MAX_RANGE and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY)
endfunction
private function Init takes nothing returns nothing
set Find = Rect(0., 0., 128., 128.)
set Item = CreateItem(DUMMY_ITEM_ID, 0, 0)
call SetItemVisible(Item, false)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
/*****************************************************************************
*
* InventoryEvent v1.0.0.0
* by Bannar aka Spinnaker
*
* For intuitive inventory event handling.
*
******************************************************************************
*
* Optional requirements:
*
* RegisterPlayerUnitEvent by Bannar
* hiveworkshop.com/forums/submissions-414/snippet-registerevent-pack-250266/
*
* OrderEvent by Bribe
* hiveworkshop.com/forums/jass-resources-412/snippet-order-event-190871/
*
******************************************************************************
*
* Functions:
*
* function GetEventInventoryUnit takes nothing returns unit
* returns unit which manipulated event item
*
* function GetEventInventoryItem takes nothing returns item
* returns manupilated event item
*
* function GetEventInventorySlotFrom takes nothing returns integer
* returns slot index of manipulated item from which it was moved or used
*
* function GetEventInventorySlotTo takes nothing returns integer
* returns slot index of manipulated item to which it was moved
*
* function GetEventInventorySwapped takes nothing returns item
* returns item which was swapped with manipulated item on MOVED event if any
*
* function GetUnitItemSlot takes unit u, item it returns integer
* retrieves item index slot if any for item owning unit u
*
* function RegisterInventoryEvent takes code cb, integer ev returns nothing
* registers new event handler cb for inventory event ev
*
* function TriggerRegisterInventoryEvent takes trigger t, integer ev returns nothing
* registers event ev for trigger t
*
* function GetInvnetoryEventTrigger takes integer whichEvent returns trigger
* retrieves trigger handle for event with id whichEvent
*
******************************************************************************
*
* Events that can be used:
*
* integer InventoryEvent.MOVED
* integer InventoryEvent.USED
*
*****************************************************************************/
library InventoryEvent requires /*
*/ optional RegisterPlayerUnitEvent /*
*/ optional OrderEvent
globals
private unit eventUnit = null
private item eventItem = null
private integer eventSlotFrom = -1
private integer eventSlotTo = -1
private trigger array triggers
private real caller = 0
endglobals
function GetEventInventoryUnit takes nothing returns unit
return eventUnit
endfunction
function GetEventInventoryItem takes nothing returns item
return eventItem
endfunction
function GetEventInventorySlotFrom takes nothing returns integer
return eventSlotFrom
endfunction
function GetEventInventorySlotTo takes nothing returns integer
return eventSlotTo
endfunction
function GetEventInventorySwapped takes nothing returns item
return UnitItemInSlot(eventUnit, eventSlotTo)
endfunction
function GetUnitItemSlot takes unit u, item it returns integer
local integer i = 0
local integer size = UnitInventorySize(u)
if ( UnitHasItem(u, it) ) then
loop
if ( UnitItemInSlot(u, i) == it ) then
return i
endif
set i = i+1
exitwhen i == size
endloop
endif
return -1 // NOT_FOUND
endfunction
private function RegisterAnyUnitEvent takes playerunitevent e, code c returns nothing
static if LIBRARY_RegisterPlayerUnitEvent then
static if RPUE_VERSION_NEW then
call RegisterAnyPlayerUnitEvent(e, c)
else
call RegisterPlayerUnitEvent(e, c)
endif
else
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, e)
call TriggerAddCondition(t, Condition(c))
set t = null
endif
endfunction
private module InventoryEventInit
private static method onInit takes nothing returns nothing
static if LIBRARY_OrderEvent then
local integer i = 852002 // range from 852002 to 852013
loop
call RegisterOrderEvent(i, function thistype.onItemOrder)
set i = i+1
exitwhen i > 852013
endloop
else // MOVED is order of type TARGET_ORDER yet USED can be anyone of them
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_ISSUED_ORDER, function thistype.onAnyOrder)
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER, function thistype.onAnyOrder)
call RegisterAnyUnitEvent(EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, function thistype.onAnyOrder)
endif
set triggers[MOVED] = CreateTrigger()
set triggers[USED] = CreateTrigger()
call TriggerRegisterVariableEvent(triggers[MOVED], SCOPE_PRIVATE + "caller", EQUAL, MOVED)
call TriggerRegisterVariableEvent(triggers[USED], SCOPE_PRIVATE + "caller", EQUAL, USED)
endmethod
endmodule
struct InventoryEvent extends array
readonly static integer MOVED = 1
readonly static integer USED = 2
private static method fire takes integer ev, unit u, item it, integer slotFrom, integer slotTo returns nothing
local unit prevUnit = eventUnit
local item prevItem = eventItem
local integer prevSlotFrom = eventSlotFrom
local integer prevSlotTo = eventSlotTo
set eventUnit = u
set eventItem = it
set eventSlotFrom = slotFrom
set eventSlotTo = slotTo
set caller = ev
set caller = 0
set eventUnit = prevUnit
set eventItem = prevItem
set eventSlotFrom = prevSlotFrom
set eventSlotTo = prevSlotTo
set prevUnit = null
set prevItem = null
endmethod
private static method onItemOrder takes nothing returns nothing
local integer order = GetIssuedOrderId()
local unit u = GetTriggerUnit()
local item it = GetOrderTargetItem()
local integer slot
local integer slot2
if ( order >= 852002 and order <= 852007 ) then
set it = GetOrderTargetItem()
set slot = GetUnitItemSlot(u, it)
set slot2 = order - 852002
call fire(MOVED, u, it, slot, slot2)
else
set slot = order - 852008
set it = UnitItemInSlot(u, slot)
call fire(USED, u, it, slot, -1)
endif
set u = null
set it = null
endmethod
static if not LIBRARY_OrderEvent then
private static method onAnyOrder takes nothing returns boolean
local integer order = GetIssuedOrderId()
if ( order >= 852002 and order <= 852013 ) then
call onItemOrder()
endif
return false
endmethod
endif
implement InventoryEventInit
endstruct
function RegisterInventoryEvent takes code c, integer ev returns nothing
call TriggerAddCondition(triggers[ev], Condition(c))
endfunction
function TriggerRegisterInventoryEvent takes trigger t, integer ev returns nothing
call TriggerRegisterVariableEvent(t, SCOPE_PRIVATE + "caller", EQUAL, ev)
endfunction
function GetInventoryEventTrigger takes integer whichEvent returns trigger
return triggers[whichEvent]
endfunction
endlibrary