Chocobo
White-Flower
- Reaction score
- 409
I found some weird function in common.j of war3x.mpq. Can someone explain what they do?
PHP:
function TextTagSize2Height takes real size returns real
return size * 0.023 / 10
endfunction
PHP:
function TextTagSpeed2Velocity takes real speed returns real
return speed * 0.071 / 128
endfunction
PHP:
function BJDebugMsg takes string msg returns nothing
local integer i = 0
loop
call DisplayTimedTextToPlayer(Player(i),0,0,60,msg)
set i = i + 1
exitwhen i == bj_MAX_PLAYERS
endloop
endfunction
PHP:
function CameraSetEQNoiseForPlayer takes player whichPlayer,real magnitude returns nothing
local real richter = magnitude
if (richter > 5.0) then
set richter = 5.0
endif
if (richter < 2.0) then
set richter = 2.0
endif
if (GetLocalPlayer() == whichPlayer) then
call CameraSetTargetNoiseEx(magnitude*2.0, magnitude*Pow(10,richter),true)
call CameraSetSourceNoiseEx(magnitude*2.0, magnitude*Pow(10,richter),true)
endif
endfunction
//Edit : To who don't know what is EQ, it is Earthquake.
PHP:
constant native ConvertLimitOp takes integer i returns limitop
PHP:
native CreateMIDISound takes string soundLabel,integer fadeInRate,integer fadeOutRate returns sound
PHP:
native CripplePlayer takes player whichPlayer,force toWhichPlayers,boolean flag returns nothing
PHP:
native GetLocalizedString takes string source returns string
PHP:
function PerformStockUpdates takes nothing returns nothing
local integer pickedItemId
local itemtype pickedItemType
local integer pickedItemLevel = 0
local integer allowedCombinations = 0
local integer iLevel
set iLevel = 1
loop
if (bj_stockAllowedPermanent[iLevel]) then
set allowedCombinations = allowedCombinations + 1
if (GetRandomInt(1, allowedCombinations) == 1) then
set pickedItemType = ITEM_TYPE_PERMANENT
set pickedItemLevel = iLevel
endif
endif
if (bj_stockAllowedCharged[iLevel]) then
set allowedCombinations = allowedCombinations + 1
if (GetRandomInt(1, allowedCombinations) == 1) then
set pickedItemType = ITEM_TYPE_CHARGED
set pickedItemLevel = iLevel
endif
endif
if (bj_stockAllowedArtifact[iLevel]) then
set allowedCombinations = allowedCombinations + 1
if (GetRandomInt(1, allowedCombinations) == 1) then
set pickedItemType = ITEM_TYPE_ARTIFACT
set pickedItemLevel = iLevel
endif
endif
set iLevel = iLevel + 1
exitwhen iLevel > bj_MAX_ITEM_LEVEL
endloop
if (allowedCombinations == 0) then
return
endif
call UpdateEachStockBuilding(pickedItemType, pickedItemLevel)
endfunction
PHP:
function StartSoundForPlayerBJ takes player whichPlayer,sound soundHandle returns nothing
if (whichPlayer == GetLocalPlayer()) then
call StartSound(soundHandle)
endif
endfunction
PHP:
native VersionGet takes nothing returns version
PHP:
native VersionSupported takes version whichVersion returns boolean
PHP:
function WaitTransmissionDuration takes sound soundHandle,integer timeType,real timeVal returns nothing
if (timeType == bj_TIMETYPE_SET) then
call TriggerSleepAction(timeVal)
elseif (soundHandle == null) then
call TriggerSleepAction(bj_NOTHING_SOUND_DURATION)
elseif (timeType == bj_TIMETYPE_SUB) then
call WaitForSoundBJ(soundHandle, timeVal)
elseif (timeType == bj_TIMETYPE_ADD) then
call WaitForSoundBJ(soundHandle, 0)
call TriggerSleepAction(timeVal)
else
endif
endfunction