Name | Type | is_array | initial_value |
//TESH.scrollpos=5
//TESH.alwaysfold=0
scope MFNInterface
public function MFNSettings takes nothing returns nothing
set MFN_creditLeftSide = false
endfunction
public function main takes nothing returns nothing
call NewSoundEnvironment( "Default" )
call SetMapMusic( "Music", true, 0 )
//call InitGlobals()
//call InitSounds( )
//call CreateRegions( )
//call InitUpgrades( )
//call CreateAllUnits( )
//call InitCustomTriggers( )
//call RunInitializationTriggers( )
endfunction
public function GUI takes nothing returns nothing
//call InitCustomTriggers( )
//call RunInitializationTriggers( )
endfunction
public function utilities takes nothing returns nothing
endfunction
public function systems takes nothing returns nothing
endfunction
public function mapSystems takes nothing returns nothing
endfunction
public function game takes nothing returns nothing
endfunction
public function inGame takes nothing returns nothing
endfunction
public function inGameSystems takes nothing returns nothing
endfunction
public function inGameContent takes nothing returns nothing
endfunction
endscope
//TESH.scrollpos=584
//TESH.alwaysfold=0
library MFN
public keyword displayText
globals
//Version Information
private constant string SYSTEM = "MFN"
private constant string VERSION = ".01j"
private constant integer CN = 19
//Ini trigger
private trigger ini = CreateTrigger()
//Map Properties
public scope Map
public real minX
public real minY
public real maxX
public real maxY
public rect map
endscope
public player array players[12]
public integer playerCount = 0
public force forceAll = CreateForce()
public boolean creditLeftSide
endglobals
public struct Grid
public real x
public real y
public real z
public integer gridX
public integer gridY
public integer gridZ
public real cellX
public real cellY
public real cellZ
public integer directionX
public integer directionY
public integer directionZ
endstruct
public struct Cell
public real minX
public real minY
public real minZ
public real maxX
public real maxY
public real maxZ
endstruct
public function getGridMinX takes integer g returns real
local Grid grid = g
local real r = grid.x+(grid.directionX*(grid.gridX*grid.cellX))
if (r < grid.x) then
return r
endif
return grid.x
endfunction
public function getGridMaxX takes integer g returns real
local Grid grid = g
local real r = grid.x+(grid.directionX*(grid.gridX*grid.cellX))
if (r > grid.x) then
return r
endif
return grid.x
endfunction
public function getGridMinY takes integer g returns real
local Grid grid = g
local real r = grid.y+(grid.directionY*(grid.gridY*grid.cellY))
if (r < grid.y) then
return r
endif
return grid.y
endfunction
public function getGridMaxY takes integer g returns real
local Grid grid = g
local real r = grid.y+(grid.directionY*(grid.gridY*grid.cellY))
if (r > grid.y) then
return r
endif
return grid.y
endfunction
public function getGridMinZ takes integer g returns real
local Grid grid = g
local real r = grid.z+(grid.directionZ*(grid.gridZ*grid.cellZ))
if (r < grid.z) then
return r
endif
return grid.z
endfunction
public function getGridMaxZ takes integer g returns real
local Grid grid = g
local real r = grid.z+(grid.directionZ*(grid.gridZ*grid.cellZ))
if (r > grid.z) then
return r
endif
return grid.z
endfunction
public function getCellMinX takes integer g, integer x returns real
local Grid grid = g
local real r = (x*(grid.cellX*grid.directionX))+grid.x-grid.cellX
local real r2 = (x*(grid.cellX*grid.directionX))+grid.x
if (r < r2) then
return r
endif
return r2
endfunction
public function getCellMinY takes integer g, integer y returns real
local Grid grid = g
local real r = (y*(grid.cellY*grid.directionY))+grid.y-grid.cellY
local real r2 = (y*(grid.cellY*grid.directionY))+grid.y
if (r < r2) then
return r
endif
return r2
endfunction
public function getCellMinZ takes integer g, integer z returns real
local Grid grid = g
local real r = (z*(grid.cellZ*grid.directionZ))+grid.z-grid.cellZ
local real r2 = (z*(grid.cellZ*grid.directionZ))+grid.z
if (r < r2) then
return r
endif
return r2
endfunction
public function getCellMaxX takes integer g, integer x returns real
local Grid grid = g
local real r = (x*(grid.cellX*grid.directionX))+grid.x-grid.cellX
local real r2 = (x*(grid.cellX*grid.directionX))+grid.x
if (r > r2) then
return r
endif
return r2
endfunction
public function getCellMaxY takes integer g, integer y returns real
local Grid grid = g
local real r = (y*(grid.cellY*grid.directionY))+grid.y-grid.cellY
local real r2 = (y*(grid.cellY*grid.directionY))+grid.y
if (r > r2) then
return r
endif
return r2
endfunction
public function getCellMaxZ takes integer g, integer z returns real
local Grid grid = g
local real r = (z*(grid.cellZ*grid.directionZ))+grid.z-grid.cellZ
local real r2 = (z*(grid.cellZ*grid.directionZ))+grid.z
if (r > r2) then
return r
endif
return r2
endfunction
public function getCell takes integer g, integer x, integer y, integer z returns integer
local Cell cell = Cell.create()
set cell.minX = getCellMinX(g, x)
set cell.minY = getCellMinY(g, y)
set cell.minZ = getCellMinZ(g, z)
set cell.maxX = getCellMaxX(g, x)
set cell.maxY = getCellMaxY(g, y)
set cell.maxZ = getCellMaxZ(g, z)
return cell
endfunction
public function createGrid takes real x, real y, real z, integer gridX, integer gridY, integer gridZ, real cellX, real cellY, real cellZ, integer directionX, integer directionY, integer directionZ returns Grid
local Grid grid = Grid.create()
set grid.x = x
set grid.y = y
set grid.z = z
set grid.gridX = gridX
set grid.gridY = gridY
set grid.gridZ = gridZ
set grid.cellX = cellX
set grid.cellY = cellY
set grid.cellZ = cellZ
set grid.directionX = directionX
set grid.directionY = directionY
set grid.directionZ = directionZ
return grid
endfunction
public function createGridInCoordsWithGrid takes real minX, real minY, real minZ, real maxX, real maxY, real maxZ, integer gridX, integer gridY, integer gridZ, real percentX, real percentY, real percentZ, integer directionX, integer directionY, integer directionZ returns Grid
local Grid grid = Grid.create()
set grid.gridX = gridX
set grid.gridY = gridY
set grid.gridZ = gridZ
set percentX = percentX * .01
set percentY = percentY * .01
set percentZ = percentZ * .01
set grid.cellX = ((RAbsBJ(maxX-minX))*percentX)/grid.gridX
set grid.cellY = ((RAbsBJ(maxY-minY))*percentY)/grid.gridY
set grid.cellZ = ((RAbsBJ(maxZ-minZ))*percentZ)/grid.gridZ
if (directionX == 1) then
set grid.x = minX*percentX
else
set grid.x = maxX*percentX
endif
if (directionY == 1) then
set grid.y = minY*percentY
else
set grid.y = maxY*percentY
endif
if (directionZ == 1) then
set grid.z = minZ*percentZ
else
set grid.z = maxZ*percentZ
endif
set grid.directionX = directionX
set grid.directionY = directionY
set grid.directionZ = directionZ
return grid
endfunction
public function createGridInCoordsWithCell takes real minX, real minY, real minZ, real maxX, real maxY, real maxZ, integer cellX, integer cellY, integer cellZ, real percentX, real percentY, real percentZ, integer directionX, integer directionY, integer directionZ returns Grid
local Grid grid = Grid.create()
set grid.cellX = cellX
set grid.cellY = cellY
set grid.cellZ = cellZ
set percentX = percentX * .01
set percentY = percentY * .01
set percentZ = percentZ * .01
set grid.gridX = R2I(((RAbsBJ(maxX-minX))*percentX)/grid.cellX)
set grid.gridY = R2I(((RAbsBJ(maxY-minY))*percentY)/grid.cellY)
set grid.gridZ = R2I(((RAbsBJ(maxZ-minZ))*percentZ)/grid.cellZ)
set grid.cellX = ((RAbsBJ(maxX-minX))*percentX)/grid.gridX
set grid.cellY = ((RAbsBJ(maxY-minY))*percentY)/grid.gridY
set grid.cellZ = ((RAbsBJ(maxZ-minZ))*percentZ)/grid.gridZ
if (directionX == 1) then
set grid.x = minX*percentX
else
set grid.x = maxX*percentX
endif
if (directionY == 1) then
set grid.y = minY*percentY
else
set grid.y = maxY*percentY
endif
if (directionZ == 1) then
set grid.z = minZ*percentZ
else
set grid.z = maxZ*percentZ
endif
set grid.directionX = directionX
set grid.directionY = directionY
set grid.directionZ = directionZ
return grid
endfunction
public function createGridInRectWithGrid takes rect r, real minZ, real maxZ, integer gridX, integer gridY, integer gridZ, real percentX, real percentY, real percentZ, integer directionX, integer directionY, integer directionZ returns Grid
local Grid grid = Grid.create()
set grid.gridX = gridX
set grid.gridY = gridY
set grid.gridZ = gridZ
set percentX = percentX * .01
set percentY = percentY * .01
set percentZ = percentZ * .01
set grid.cellX = ((RAbsBJ(GetRectMaxX(r)-GetRectMinX(r)))*percentX)/grid.gridX
set grid.cellY = ((RAbsBJ(GetRectMaxY(r)-GetRectMinY(r)))*percentY)/grid.gridY
set grid.cellZ = ((RAbsBJ(maxZ-minZ))*percentZ)/grid.gridZ
if (directionX == 1) then
set grid.x = GetRectMinX(r)*percentX
else
set grid.x = GetRectMaxX(r)*percentX
endif
if (directionY == 1) then
set grid.y = GetRectMinY(r)*percentY
else
set grid.y = GetRectMaxY(r)*percentY
endif
if (directionZ == 1) then
set grid.z = minZ*percentZ
else
set grid.z = maxZ*percentZ
endif
set grid.directionX = directionX
set grid.directionY = directionY
set grid.directionZ = directionZ
return grid
endfunction
public function createGridInRectWithCell takes rect r, real minZ, real maxZ, integer cellX, integer cellY, integer cellZ, real percentX, real percentY, real percentZ, integer directionX, integer directionY, integer directionZ returns Grid
local Grid grid = Grid.create()
set grid.cellX = cellX
set grid.cellY = cellY
set grid.cellZ = cellZ
set percentX = percentX * .01
set percentY = percentY * .01
set percentZ = percentZ * .01
set grid.gridX = R2I(((RAbsBJ(GetRectMaxX(r)-GetRectMinX(r)))*percentX)/grid.cellX)
set grid.gridY = R2I(((RAbsBJ(GetRectMaxY(r)-GetRectMinY(r)))*percentY)/grid.cellY)
set grid.gridZ = R2I(((RAbsBJ(maxZ-minZ))*percentZ)/grid.cellZ)
set grid.cellX = ((RAbsBJ(GetRectMaxX(r)-GetRectMinX(r)))*percentX)/grid.gridX
set grid.cellY = ((RAbsBJ(GetRectMaxY(r)-GetRectMinY(r)))*percentY)/grid.gridY
set grid.cellZ = ((RAbsBJ(maxZ-minZ))*percentZ)/grid.gridZ
if (directionX == 1) then
set grid.x = GetRectMinX(r)*percentX
else
set grid.x = GetRectMaxX(r)*percentX
endif
if (directionY == 1) then
set grid.y = GetRectMinY(r)*percentY
else
set grid.y = GetRectMaxY(r)*percentY
endif
if (directionZ == 1) then
set grid.z = minZ*percentZ
else
set grid.z = maxZ*percentZ
endif
set grid.directionX = directionX
set grid.directionY = directionY
set grid.directionZ = directionZ
return grid
endfunction
public function createGridInCellByGrid takes integer g, integer cellXE, integer cellYE, integer cellZE, integer gridXI, integer gridYI, integer gridZI, real percentX, real percentY, real percentZ, integer directionX, integer directionY, integer directionZ returns Grid
local Grid grid = Grid.create()
local real minX = getCellMinX(g, cellXE)
local real maxX = getCellMaxX(g, cellXE)
local real minY = getCellMinY(g, cellYE)
local real maxY = getCellMaxY(g, cellYE)
local real minZ = getCellMinZ(g, cellZE)
local real maxZ = getCellMaxZ(g, cellZE)
set grid.gridX = gridXI
set grid.gridY = gridYI
set grid.gridZ = gridZI
set percentX = percentX * .01
set percentY = percentY * .01
set percentZ = percentZ * .01
set grid.cellX = ((RAbsBJ(maxX-minX))*percentX)/grid.gridX
set grid.cellY = ((RAbsBJ(maxY-minY))*percentY)/grid.gridY
set grid.cellZ = ((RAbsBJ(maxZ-minZ))*percentZ)/grid.gridZ
if (directionX == 1) then
set grid.x = minX*percentX
else
set grid.x = maxX*percentX
endif
if (directionY == 1) then
set grid.y = minY*percentY
else
set grid.y = maxY*percentY
endif
if (directionZ == 1) then
set grid.z = minZ*percentZ
else
set grid.z = maxZ*percentZ
endif
set grid.directionX = directionX
set grid.directionY = directionY
set grid.directionZ = directionZ
return grid
endfunction
public function createGridInCellByCell takes integer grid, integer cellXE, integer cellYE, integer cellZE, real cellXI, real cellYI, real cellZI, real percentX, real percentY, real percentZ, integer directionX, integer directionY, integer directionZ returns Grid
return 0
endfunction
public function createGridInGridByGrid takes integer grid, integer minCellXE, integer minCellYE, integer minCellZE, integer maxCellXE, integer maxCellYE, integer maxCellZE, integer gridXI, integer gridYI, integer gridZI, real percentX, real percentY, real percentZ, integer directionX, integer directionY, integer directionZ returns Grid
return 0
endfunction
public function createGridInGridByCell takes integer grid returns nothing
endfunction
public function polarX takes real x, real a returns real
return (x*Cos(a))
endfunction
public function polarY takes real y, real a returns real
return (y*Sin(a))
endfunction
public function getWindowMinX takes nothing returns real
return GetCameraTargetPositionX()-polarX(((GetCameraTargetPositionX()/2)), GetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK))
endfunction
public function getWindowMaxX takes nothing returns real
return GetCameraTargetPositionX()+polarX((GetCameraTargetPositionX()/2)-64, GetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK))
endfunction
public function getWindowMinY takes nothing returns real
return GetCameraTargetPositionY()-polarY((GetCameraTargetPositionX()/2)-512, GetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK))
endfunction
public function getWindowMaxY takes nothing returns real
return GetCameraTargetPositionY()+polarY((GetCameraTargetPositionY()/2)-256, GetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK))
endfunction
public function getPlayerWindowMinX takes nothing returns real
return 0.0
endfunction
public function getPlayerWindowMaxX takes nothing returns real
return 0.0
endfunction
public function getPlayerWindowMinY takes nothing returns real
return 0.0
endfunction
public function getPlayerWindowMaxY takes nothing returns real
return 0.0
endfunction
//public function
//Text Macros
//! textmacro createLoop takes counter, timeout
if (MFN_modulo($counter$, $timeout$) == 0) then
call TriggerSleepAction(.01)
endif
//! endtextmacro
//! textmacro buildCreditInterface takes name, title, description
public function createCredit$name$ takes string systemName, string versionNumber, string author, string helpers, string texturePath, string description returns nothing
call credit($title$, $description$, texturePath)
endfunction
//! endtextmacro
//! textmacro addToThreadStack takes stackID, call, functionNumber, functionNumberToCall
private keyword $stackID$$functionNumberToCall$
private function $stackID$$functionNumber$ takes nothing returns nothing
call $call$
call $stackID$$functionNumberToCall$.execute()
endfunction
//! endtextmacro
//! textmacro createThreadStack takes stackID, call, functionNumberToCall
private keyword $stackID$$functionNumberToCall$
public function $stackID$ takes nothing returns nothing
call $call$
call $stackID$$functionNumberToCall$.execute()
endfunction
//! endtextmacro
//! textmacro destroyThreadStack takes stackID, call, functionID
private function $stackID$$functionID$ takes nothing returns nothing
call $call$
endfunction
//! endtextmacro
public function modulo takes real dividend, real divisor returns integer
return R2I((dividend - (R2I(dividend/divisor)*R2I(divisor))))
endfunction
public function exitWarcraft takes nothing returns nothing
loop
call ExecuteFunc("ExitWarcraft")
endloop
endfunction
public function freezeWarcraft takes nothing returns nothing
loop
call TriggerSyncReady()
call ExecuteFunc("FreezeWarcraft")
endloop
endfunction
public function stopThread takes nothing returns nothing
local integer i = 1/0
endfunction
public function criticalError takes nothing returns nothing
call ExecuteFunc("0")
endfunction
public function desyncPlayer takes player p returns nothing
if GetLocalPlayer()==p then
call CreateUnit(p, 'hpea', 0, 0, 0)
endif
endfunction
//Internal MFN Functions
//Utility functions
public function round takes real r returns integer
if (r > 0) then
return R2I(r+.5)
endif
return R2I(r-.5)
endfunction
public function roundDown takes real r returns integer
return R2I(r)
endfunction
public function roundUp takes real r returns integer
if (r > 0) then
return R2I(r)+1
endif
return R2I(r-1)
endfunction
public function setCameraBounds takes real minX, real minY, real maxX, real maxY returns nothing
call SetCameraBounds(minX, minY, minX, maxY, maxX, maxY, maxX, minY)
endfunction
public function displayTimedText takes integer duration, string message returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, duration, message)
endfunction
public function displayText takes string message returns nothing
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, message)
endfunction
public function clearTextForPlayer takes player p returns nothing
if (GetLocalPlayer() == p) then
call ClearTextMessages()
endif
endfunction
public function endGameTrue takes nothing returns nothing
call EndGame(true)
endfunction
public function endGameFalse takes nothing returns nothing
call EndGame(false)
endfunction
//System functions
public function registerIni takes code c returns nothing
call TriggerAddAction(ini, c)
endfunction
public function credit takes string title, string description, string texturePath returns nothing
local quest credits = CreateQuest()
call QuestSetTitle(credits, title)
call QuestSetDescription(credits, description)
call QuestSetIconPath(credits, texturePath)
call QuestSetDiscovered(credits, true)
call QuestSetCompleted(credits, false)
call QuestSetEnabled(credits, true)
call QuestSetRequired(credits, creditLeftSide)
set credits = null
endfunction
//! runtextmacro buildCreditInterface("1", "systemName + \" v\" + versionNumber", "\"Author of this System- |n\" + author + \"|n|nPeople who helped design this system- |n\" + helpers + \"|n|nDescription- |n\" + description")
//MFN Setup functions
public function cleanLeaks takes nothing returns nothing
call DestroyTrigger(ini)
endfunction
private function mapSetup takes nothing returns nothing
local integer x = 0
local rect r = GetWorldBounds()
//Setup Map
set Map_minX = GetRectMinX(r) + GetCameraMargin(CAMERA_MARGIN_LEFT)
set Map_minY = GetRectMinY(r) + GetCameraMargin(CAMERA_MARGIN_BOTTOM)
set Map_maxX = GetRectMaxX(r) - GetCameraMargin(CAMERA_MARGIN_RIGHT)
set Map_maxY = GetRectMaxY(r) - GetCameraMargin(CAMERA_MARGIN_TOP)
call RemoveRect(r)
set Map_map = Rect(Map_minX, Map_minY, Map_maxX, Map_maxY)
call setCameraBounds(Map_minX, Map_minY, Map_maxX, Map_maxY)
//Setup Players
loop
if (GetPlayerController(Player(x)) == MAP_CONTROL_USER and GetPlayerSlotState(Player(x)) == PLAYER_SLOT_STATE_PLAYING) then
set players[playerCount] = Player(x)
set playerCount = playerCount + 1
endif
set x = x + 1
exitwhen x > 11
endloop
set forceAll = bj_FORCE_ALL_PLAYERS
endfunction
public function create takes nothing returns nothing
call createCredit1(SYSTEM, VERSION, "Nestharus", "None", "ReplaceableTextures\\CommandButtons\\BTNPeriapt1.blp", "The Map Framework v"+ VERSION + " CN " + I2S(CN))
call mapSetup()
call TriggerRegisterTimerEvent(ini, .01, false)
endfunction
endlibrary
//! inject main
//! dovjassinit
call InitBlizzard()
call MFNPrivateInterfaceCallStack_MFN_Ini.execute()
//! endinject
scope MFNPrivateInterfaceCallStack
private function iniSetup takes nothing returns nothing
call MFN_registerIni(function MFNInterface_inGame)
call MFN_registerIni(function MFNInterface_inGameSystems)
call MFN_registerIni(function MFNInterface_inGameContent)
endfunction
//! runtextmacro createThreadStack("MFN_Ini", "MFNInterface_main()", "1")
//! runtextmacro addToThreadStack("MFN_Ini", "MFNInterface_MFNSettings()", "1", "2")
//! runtextmacro addToThreadStack("MFN_Ini", "MFN_create()", "2", "3")
//! runtextmacro addToThreadStack("MFN_Ini", "MFNInterface_GUI()", "3", "4")
//! runtextmacro addToThreadStack("MFN_Ini", "MFNInterface_utilities()", "4", "5")
//! runtextmacro addToThreadStack("MFN_Ini", "MFNInterface_systems()", "5", "6")
//! runtextmacro addToThreadStack("MFN_Ini", "MFNInterface_mapSystems()", "6", "7")
//! runtextmacro addToThreadStack("MFN_Ini", "MFNInterface_game()", "7", "8")
//! runtextmacro addToThreadStack("MFN_Ini", "iniSetup()", "8", "End")
//! runtextmacro destroyThreadStack("MFN_Ini", "MFN_registerIni(function MFN_cleanLeaks)", "End")
endscope