|
楼主 |
发表于 2010-1-21 11:52:29
|
显示全部楼层
源代码
[jass]
//===========================================================================
//
// WAR3小霸王系列之俄罗斯方块
//
// Warcraft III map script
// Generated by the Warcraft III World Editor
// Date: Thu Jan 21 10:39:32 2010
// Map Author: 活宝
//
//===========================================================================
//***************************************************************************
//*
//* Global Variables
//*
//***************************************************************************
globals
// User-defined
hashtable udg_AS = null
hashtable udg_NS = null
hashtable udg_GS = null
hashtable udg_IF = null
hashtable udg_BG = null
hashtable udg_FP = null
integer udg_iLarge = 0
integer udg_iCol = 0
boolean udg_isBottom = false
integer udg_currentRect = 0
integer udg_iLevel = 0
integer udg_iPerformance = 0
integer udg_icurrentStatus = 0
integer udg_inextStatus = 0
integer udg_iStartX = 0
boolean udg_bGameEnd = false
integer udg_iStartY = 0
boolean udg_bGamePaush = false
boolean udg_bMusic = false
boolean udg_bDrawGrid = false
integer udg_iRow = 0
timer udg_GTimer = null
timer udg_LTimer = null
timer udg_RTimer = null
timer udg_DTimer = null
timer udg_Delay = null
unit udg_CenterUnit = null
real udg_LevelTime = 0
hashtable udg_LS = null
hashtable udg_PS = null
hashtable udg_SS = null
hashtable udg_NP = null
hashtable udg_LP = null
hashtable udg_SP = null
hashtable udg_NGS = null
boolean array udg_bS
timer udg_Flash = null
boolean udg_bloop = false
integer udg_k = 0
integer array udg_UpScore
boolean udg_Up = false
integer udg_Value = 0
boolean udg_bFlash = false
boolean udg_bABrun = false
// Generated
camerasetup gg_cam_center = null
sound gg_snd_change = null
sound gg_snd_down = null
sound gg_snd_move = null
sound gg_snd_levelup = null
sound gg_snd_bottom = null
sound gg_snd_bang = null
sound gg_snd_gameover = null
string gg_snd_russia
sound gg_snd_LittleKing = null
sound gg_snd_deblock = null
sound gg_snd_tetris = null
string gg_snd_BWing
trigger gg_trg________________u = null
trigger gg_trg_OnKeyLeft = null
trigger gg_trg_OffKeyLeft = null
trigger gg_trg_left = null
trigger gg_trg_OnKeyRight = null
trigger gg_trg_OffKeRight = null
trigger gg_trg_right = null
trigger gg_trg_OnKeyDown = null
trigger gg_trg_OffKeDown = null
trigger gg_trg_down = null
trigger gg_trg_OnKeyUp = null
trigger gg_trg_OffKeUp = null
trigger gg_trg_GameStart = null
trigger gg_trg_OnTimer = null
unit gg_unit_e001_0002 = null
sound gg_snd_bigin = null
endglobals
function InitGlobals takes nothing returns nothing
local integer i = 0
set udg_iLarge = 60
set udg_iCol = 10
set udg_isBottom = true
set udg_currentRect = 2
set udg_iLevel = 0
set udg_iPerformance = 0
set udg_icurrentStatus = 2
set udg_inextStatus = 2
set udg_iStartX = 0
set udg_bGameEnd = false
set udg_iStartY = 0
set udg_bGamePaush = false
set udg_bMusic = false
set udg_bDrawGrid = false
set udg_iRow = 20
set udg_GTimer = CreateTimer()
set udg_LTimer = CreateTimer()
set udg_RTimer = CreateTimer()
set udg_DTimer = CreateTimer()
set udg_Delay = CreateTimer()
set udg_LevelTime = 1.00
set i = 0
loop
exitwhen (i > 100)
set udg_bS = false
set i = i + 1
endloop
set udg_Flash = CreateTimer()
set udg_bloop = false
set udg_k = 0
set i = 0
loop
exitwhen (i > 11)
set udg_UpScore = 0
set i = i + 1
endloop
set udg_Up = false
set udg_Value = 100
set udg_bFlash = false
set udg_bABrun = false
endfunction
//***************************************************************************
//*
//* Sounds
//*
//***************************************************************************
function InitSounds takes nothing returns nothing
set gg_snd_change = CreateSound( "war3mapImported\\\\change.wav", false, false, false, 10, 10, "" )
call SetSoundDuration( gg_snd_change, 345 )
call SetSoundChannel( gg_snd_change, 0 )
call SetSoundVolume( gg_snd_change, 127 )
call SetSoundPitch( gg_snd_change, 1.0 )
set gg_snd_down = CreateSound( "war3mapImported\\\\down.wav", false, false, false, 10, 10, "" )
call SetSoundDuration( gg_snd_down, 1000 )
call SetSoundChannel( gg_snd_down, 0 )
call SetSoundVolume( gg_snd_down, 127 )
call SetSoundPitch( gg_snd_down, 1.0 )
set gg_snd_move = CreateSound( "war3mapImported\\\\move.wav", false, false, false, 10, 10, "" )
call SetSoundDuration( gg_snd_move, 135 )
call SetSoundChannel( gg_snd_move, 0 )
call SetSoundVolume( gg_snd_move, 127 )
call SetSoundPitch( gg_snd_move, 1.0 )
set gg_snd_levelup = CreateSound( "war3mapImported\\\\levelup.wav", false, false, false, 10, 10, "" )
call SetSoundDuration( gg_snd_levelup, 934 )
call SetSoundChannel( gg_snd_levelup, 0 )
call SetSoundVolume( gg_snd_levelup, 127 )
call SetSoundPitch( gg_snd_levelup, 1.0 )
set gg_snd_bottom = CreateSound( "war3mapImported\\\\bottom.wav", false, false, false, 10, 10, "" )
call SetSoundDuration( gg_snd_bottom, 253 )
call SetSoundChannel( gg_snd_bottom, 0 )
call SetSoundVolume( gg_snd_bottom, 127 )
call SetSoundPitch( gg_snd_bottom, 1.0 )
set gg_snd_bang = CreateSound( "war3mapImported\\\\bang.wav", false, false, false, 10, 10, "" )
call SetSoundDuration( gg_snd_bang, 978 )
call SetSoundChannel( gg_snd_bang, 0 )
call SetSoundVolume( gg_snd_bang, 127 )
call SetSoundPitch( gg_snd_bang, 1.0 )
set gg_snd_gameover = CreateSound( "war3mapImported\\\\gameover.wav", false, false, false, 10, 10, "" )
call SetSoundDuration( gg_snd_gameover, 6498 )
call SetSoundChannel( gg_snd_gameover, 0 )
call SetSoundVolume( gg_snd_gameover, 127 )
call SetSoundPitch( gg_snd_gameover, 1.0 )
set gg_snd_russia = "war3mapImported\\\\russia.mp3"
set gg_snd_LittleKing = CreateSound( "war3mapImported\\\\LittleKing.mp3", false, false, false, 10, 10, "" )
call SetSoundDuration( gg_snd_LittleKing, 3200 )
call SetSoundChannel( gg_snd_LittleKing, 0 )
call SetSoundVolume( gg_snd_LittleKing, 127 )
call SetSoundPitch( gg_snd_LittleKing, 1.0 )
set gg_snd_deblock = CreateSound( "war3mapImported\\\\deblock.wav", false, false, false, 10, 10, "" )
call SetSoundDuration( gg_snd_deblock, 1520 )
call SetSoundChannel( gg_snd_deblock, 0 )
call SetSoundVolume( gg_snd_deblock, 127 )
call SetSoundPitch( gg_snd_deblock, 1.0 )
set gg_snd_tetris = CreateSound( "war3mapImported\\\\tetris.wav", false, false, false, 10, 10, "" )
call SetSoundDuration( gg_snd_tetris, 1965 )
call SetSoundChannel( gg_snd_tetris, 0 )
call SetSoundVolume( gg_snd_tetris, 127 )
call SetSoundPitch( gg_snd_tetris, 1.0 )
set gg_snd_BWing = "war3mapImported\\\\BWing.mp3"
set gg_snd_bigin = CreateSound( "war3mapImported\\\\bigin.wav", false, false, false, 10, 10, "" )
call SetSoundDuration( gg_snd_bigin, 4192 )
call SetSoundChannel( gg_snd_bigin, 0 )
call SetSoundVolume( gg_snd_bigin, 127 )
call SetSoundPitch( gg_snd_bigin, 1.0 )
endfunction
//***************************************************************************
//*
//* Unit Creation
//*
//***************************************************************************
//===========================================================================
function CreateUnitsForPlayer6 takes nothing returns nothing
local player p = Player(6)
local unit u
local integer unitID
local trigger t
local real life
set gg_unit_e001_0002 = CreateUnit( p, 'e001', -7.0, -0.2, 125.160 )
endfunction
//===========================================================================
function CreatePlayerBuildings takes nothing returns nothing
endfunction
//===========================================================================
function CreatePlayerUnits takes nothing returns nothing
call CreateUnitsForPlayer6( )
endfunction
//===========================================================================
function CreateAllUnits takes nothing returns nothing
call CreatePlayerBuildings( )
call CreatePlayerUnits( )
endfunction
//***************************************************************************
//*
//* Cameras
//*
//***************************************************************************
function CreateCameras takes nothing returns nothing
set gg_cam_center = CreateCameraSetup( )
call CameraSetupSetField( gg_cam_center, CAMERA_FIELD_ZOFFSET, 0.0, 0.0 )
call CameraSetupSetField( gg_cam_center, CAMERA_FIELD_ROTATION, 90.0, 0.0 )
call CameraSetupSetField( gg_cam_center, CAMERA_FIELD_ANGLE_OF_ATTACK, 270.0, 0.0 )
call CameraSetupSetField( gg_cam_center, CAMERA_FIELD_TARGET_DISTANCE, 1650.0, 0.0 )
call CameraSetupSetField( gg_cam_center, CAMERA_FIELD_ROLL, 0.0, 0.0 )
call CameraSetupSetField( gg_cam_center, CAMERA_FIELD_FIELD_OF_VIEW, 70.0, 0.0 )
call CameraSetupSetField( gg_cam_center, CAMERA_FIELD_FARZ, 5000.0, 0.0 )
call CameraSetupSetDestPosition( gg_cam_center, 0.0, 0.0, 0.0 )
endfunction
[/jass]
[jass]
//***************************************************************************
//*
//* Custom Script Code
//*
//***************************************************************************
function CHWRECTView takes nothing returns nothing
local integer i
local integer j
//总分值清零
set udg_iPerformance = 0
//测试值:为20行,10列
set udg_iRow = 20
set udg_iCol = 10
//缺省级别为1级
set udg_iLevel = 1
//缺省方块大小为udg_iLarge个象素
set udg_iLarge = 40
//缺省游戏是结束的
set udg_bGameEnd = TRUE
set udg_AS=InitHashtable()
set udg_GS=InitHashtable()
set udg_NS=InitHashtable()
set udg_NGS=InitHashtable()
set udg_LS=InitHashtable()
set udg_PS=InitHashtable()
set udg_SS=InitHashtable()
set udg_IF=InitHashtable()
set udg_FP=InitHashtable()
set udg_NP=InitHashtable()
set udg_SP=InitHashtable()
set udg_LP=InitHashtable()
set udg_BG=InitHashtable()
set i=0
//赋初值
loop
exitwhen(i>=100)
set j=0
loop
exitwhen (j>=100)
call SaveInteger(udg_GS,i,j,0)
set j=j+1
endloop
set i=i+1
endloop
set i=0
//赋初值
loop
exitwhen(i>=4)
set j=0
loop
exitwhen (j>=4)
call SaveInteger(udg_NGS,i,j,0)
set j=j+1
endloop
set i=i+1
endloop
set i=0
//赋初值
loop
exitwhen(i>=5)
set j=0
loop
exitwhen (j>=3)
call SaveInteger(udg_LS,i,j,0)
set j=j+1
endloop
set i=i+1
endloop
set i=0
//赋初值
loop
exitwhen(i>=5)
set j=0
loop
exitwhen (j>=15)
call SaveInteger(udg_SS,i,j,0)
set j=j+1
endloop
set i=i+1
endloop
//各种形状方块的接触面数据,参见设计书的接触面表格, 如果某种形状的方块没有4个接触面,则后面的数据填-1
set i=0
loop
exitwhen i>=74
set j=0
loop
exitwhen j>=4
call SaveInteger(udg_IF,i,j,-1)
set j=j+1
endloop
set i=i+1
endloop
set i=1
loop
exitwhen i>=10
set udg_UpScore=1000*(i-1)*(i-1)
set i=i+1
endloop
set udg_UpScore[10]=1000000
call SaveInteger(udg_IF,1,0,3)
call SaveInteger(udg_IF,11,0,0)
call SaveInteger(udg_IF,11,1,1)
call SaveInteger(udg_IF,11,2,2)
call SaveInteger(udg_IF,11,3,3)
call SaveInteger(udg_IF,2,0,1)
call SaveInteger(udg_IF,2,1,3)
call SaveInteger(udg_IF,3,0,0)
call SaveInteger(udg_IF,3,1,2)
call SaveInteger(udg_IF,3,2,3)
call SaveInteger(udg_IF,31,0,2)
call SaveInteger(udg_IF,31,1,3)
call SaveInteger(udg_IF,32,0,0)
call SaveInteger(udg_IF,32,1,2)
call SaveInteger(udg_IF,32,2,3)
call SaveInteger(udg_IF,33,0,0)
call SaveInteger(udg_IF,33,1,3)
call SaveInteger(udg_IF,4,0,1)
call SaveInteger(udg_IF,4,1,3)
call SaveInteger(udg_IF,41,0,0)
call SaveInteger(udg_IF,41,1,2)
call SaveInteger(udg_IF,41,2,3)
call SaveInteger(udg_IF,5,0,1)
call SaveInteger(udg_IF,5,1,3)
call SaveInteger(udg_IF,51,0,0)
call SaveInteger(udg_IF,51,1,2)
call SaveInteger(udg_IF,51,2,3)
call SaveInteger(udg_IF,6,0,0)
call SaveInteger(udg_IF,6,1,3)
call SaveInteger(udg_IF,61,0,1)
call SaveInteger(udg_IF,61,1,2)
call SaveInteger(udg_IF,61,2,3)
call SaveInteger(udg_IF,62,0,2)
call SaveInteger(udg_IF,62,1,3)
call SaveInteger(udg_IF,63,0,0)
call SaveInteger(udg_IF,63,1,1)
call SaveInteger(udg_IF,63,2,3)
call SaveInteger(udg_IF,7,0,2)
call SaveInteger(udg_IF,7,1,3)
call SaveInteger(udg_IF,71,0,1)
call SaveInteger(udg_IF,71,1,2)
call SaveInteger(udg_IF,71,2,3)
call SaveInteger(udg_IF,72,0,0)
call SaveInteger(udg_IF,72,1,3)
call SaveInteger(udg_IF,73,0,0)
call SaveInteger(udg_IF,73,1,1)
call SaveInteger(udg_IF,73,2,3)
endfunction
function S2Wx takes integer y, real x0 returns real
local real wx
set wx=x0+y*udg_iLarge
return wx
endfunction
function S2Wy takes integer x, real y0 returns real
local real wy
set wy=y0-x*udg_iLarge
return wy
endfunction
function InitDraw0 takes nothing returns nothing
local image bg
local real x0
local real y0
local real x00
local real y00
set bg=CreateImage("bg.tga",2000,2000,0,-1000,-1000,0,0,0,0,4)
call SetImageRenderAlways(bg,true)
call SaveImageHandle(udg_BG,0,0,bg)
set x00=(-udg_iCol/2)*udg_iLarge
set y00=(udg_iRow/2-1)*udg_iLarge
set x0=S2Wx(-17,x00)
set y0=S2Wy(21,y00)
set bg=CreateImage("logo.tga",400,400,0,x0,y0,0,0,0,0,3)
call SetImageRenderAlways(bg,true)
call SaveImageHandle(udg_BG,0,1,bg)
set bg=null
//return
endfunction
function InitDraw takes nothing returns nothing
local integer i
local integer in
local integer j
local integer jn
local real x
local real y
local real x00
local real y00
local real x0
local real y0
local image fp
set x00=(-udg_iCol/2)*udg_iLarge
set y00=(udg_iRow/2-1)*udg_iLarge
set x0=x00
set y0=y00
set i=-1
set in=udg_iRow
loop
exitwhen i>in
set j=-1
set jn=udg_iCol
loop
exitwhen j>jn
set x= S2Wx(j,x0)
set y= S2Wy(i,y0)
//set bg=CreateImage("bg.tga",udg_iLarge,udg_iLarge,0,x,y,0,0,0,0,4)
set fp=CreateImage("fp.tga",udg_iLarge,udg_iLarge,0,x,y,0,0,0,0,2)
//call SetImageRenderAlways(bg,true)
call SetImageRenderAlways(fp,true)
//call SaveImageHandle(udg_BG,i,j,bg)
call SaveImageHandle(udg_FP,i,j,fp)
set j=j+1
endloop
set i=i+1
endloop
set i=0
set in=udg_iRow-1
loop
exitwhen i>in
set j=0
set jn=udg_iCol-1
loop
exitwhen j>jn
set fp=LoadImageHandle(udg_FP,i,j)
call SetImageColor(fp,255,255,0,255)
call ShowImage(fp,false)
set j=j+1
endloop
set i=i+1
endloop
set x0=S2Wx(-7,x00)
set y0=S2Wy(0,y00)
set i=-1
set in=4
loop
exitwhen i>in
set j=0
set jn=3
loop
exitwhen j>jn
set x= S2Wx(j,x0)
set y= S2Wy(i,y0)
set fp=CreateImage("fp.tga",udg_iLarge,udg_iLarge,0,x,y,0,0,0,0,2)
call SetImageRenderAlways(fp,true)
call SaveImageHandle(udg_NP,i,j,fp)
set j=j+1
endloop
set i=i+1
endloop
set i=0
set in=3
loop
exitwhen i>in
set j=0
set jn=3
loop
exitwhen j>jn
set fp=LoadImageHandle(udg_NP,i,j)
call SetImageColor(fp,255,255,0,255)
call ShowImage(fp,false)
set j=j+1
endloop
set i=i+1
endloop
set fp=null
//return
endfunction
function InitDraw2 takes nothing returns nothing
local integer i
local integer in
local integer j
local integer jn
local real x
local real y
local real x00
local real y00
local real x0
local real y0
local image fp
set x00=(-udg_iCol/2)*udg_iLarge
set y00=(udg_iRow/2-1)*udg_iLarge
set x0=S2Wx(12,x00)
set y0=S2Wy(0,y00)
set i=-1
set in=5
loop
exitwhen i>in
set j=0
set jn=2
loop
exitwhen j>jn
set x= S2Wx(j,x0)
set y= S2Wy(i,y0)
set fp=CreateImage("fp.tga",udg_iLarge,udg_iLarge,0,x,y,0,0,0,0,2)
call SetImageRenderAlways(fp,true)
call SaveImageHandle(udg_LP,i,j,fp)
set j=j+1
endloop
set i=i+1
endloop
set i=0
set in=4
loop
exitwhen i>in
set j=0
set jn=2
loop
exitwhen j>jn
set fp=LoadImageHandle(udg_LP,i,j)
call SetImageColor(fp,255,0,0,255)
call ShowImage(fp,false)
set j=j+1
endloop
set i=i+1
endloop
set x0=S2Wx(12,x00)
set y0=S2Wy(15,y00)
set i=-1
set in=5
loop
exitwhen i>in
set j=0
set jn=14
loop
exitwhen j>jn
set x= S2Wx(j,x0)
set y= S2Wy(i,y0)
set fp=CreateImage("fp.tga",udg_iLarge,udg_iLarge,0,x,y,0,0,0,0,2)
call SetImageRenderAlways(fp,true)
call SaveImageHandle(udg_SP,i,j,fp)
set j=j+1
endloop
set i=i+1
endloop
set i=0
set in=4
loop
exitwhen i>in
set j=0
set jn=14
loop
exitwhen j>jn
set fp=LoadImageHandle(udg_SP,i,j)
call SetImageColor(fp,0,255,0,255)
call ShowImage(fp,false)
set j=j+1
endloop
set i=i+1
endloop
set fp=null
//return
endfunction
[/jass]
[jass]
function ActiveStatusToGameStatus takes nothing returns nothing
local integer x1
local integer x2
local integer x3
local integer x4
local integer y1
local integer y2
local integer y3
local integer y4
set x1 = LoadInteger(udg_AS,0,0)
set x2 = LoadInteger(udg_AS,1,0)
set x3 = LoadInteger(udg_AS,2,0)
set x4 = LoadInteger(udg_AS,3,0)
set y1 = LoadInteger(udg_AS,0,1)
set y2 = LoadInteger(udg_AS,1,1)
set y3 = LoadInteger(udg_AS,2,1)
set y4 = LoadInteger(udg_AS,3,1)
call SaveInteger(udg_GS,x1,y1,1)
call SaveInteger(udg_GS,x2,y2,1)
call SaveInteger(udg_GS,x3,y3,1)
call SaveInteger(udg_GS,x4,y4,1)
endfunction
function NextStatusToGameNextStatus takes nothing returns nothing
local integer x1
local integer x2
local integer x3
local integer x4
local integer y1
local integer y2
local integer y3
local integer y4
local integer i
local integer j
set i=0
//赋初值
loop
exitwhen(i>=4)
set j=0
loop
exitwhen (j>=4)
call SaveInteger(udg_NGS,i,j,0)
set j=j+1
endloop
set i=i+1
endloop
set x1 = LoadInteger(udg_NS,0,0)
set x2 = LoadInteger(udg_NS,1,0)
set x3 = LoadInteger(udg_NS,2,0)
set x4 = LoadInteger(udg_NS,3,0)
set y1 = LoadInteger(udg_NS,0,1)
set y2 = LoadInteger(udg_NS,1,1)
set y3 = LoadInteger(udg_NS,2,1)
set y4 = LoadInteger(udg_NS,3,1)
call SaveInteger(udg_NGS,x1,y1,1)
call SaveInteger(udg_NGS,x2,y2,1)
call SaveInteger(udg_NGS,x3,y3,1)
call SaveInteger(udg_NGS,x4,y4,1)
endfunction
function RectStatusToActiveStatus takes integer udg_which returns nothing
if(udg_which==1) then
call SaveInteger(udg_AS,0,0,0)
call SaveInteger(udg_AS,0,1,5)
call SaveInteger(udg_AS,1,0,1)
call SaveInteger(udg_AS,1,1,5)
call SaveInteger(udg_AS,2,0,2)
call SaveInteger(udg_AS,2,1,5)
call SaveInteger(udg_AS,3,0,3)
call SaveInteger(udg_AS,3,1,5)
endif
if(udg_which==2) then
call SaveInteger(udg_AS,0,0,0)
call SaveInteger(udg_AS,0,1,5)
call SaveInteger(udg_AS,1,0,1)
call SaveInteger(udg_AS,1,1,5)
call SaveInteger(udg_AS,2,0,0)
call SaveInteger(udg_AS,2,1,6)
call SaveInteger(udg_AS,3,0,1)
call SaveInteger(udg_AS,3,1,6)
endif
if(udg_which==3) then
call SaveInteger(udg_AS,0,0,1)
call SaveInteger(udg_AS,0,1,4)
call SaveInteger(udg_AS,1,0,0)
call SaveInteger(udg_AS,1,1,5)
call SaveInteger(udg_AS,2,0,1)
call SaveInteger(udg_AS,2,1,5)
call SaveInteger(udg_AS,3,0,1)
call SaveInteger(udg_AS,3,1,6)
endif
if(udg_which==4) then
call SaveInteger(udg_AS,0,0,0)
call SaveInteger(udg_AS,0,1,5)
call SaveInteger(udg_AS,1,0,1)
call SaveInteger(udg_AS,1,1,5)
call SaveInteger(udg_AS,2,0,1)
call SaveInteger(udg_AS,2,1,6)
call SaveInteger(udg_AS,3,0,2)
call SaveInteger(udg_AS,3,1,6)
endif
if(udg_which==5) then
call SaveInteger(udg_AS,0,0,1)
call SaveInteger(udg_AS,0,1,5)
call SaveInteger(udg_AS,1,0,2)
call SaveInteger(udg_AS,1,1,5)
call SaveInteger(udg_AS,2,0,0)
call SaveInteger(udg_AS,2,1,6)
call SaveInteger(udg_AS,3,0,1)
call SaveInteger(udg_AS,3,1,6)
endif
if(udg_which==6) then
call SaveInteger(udg_AS,0,0,0)
call SaveInteger(udg_AS,0,1,5)
call SaveInteger(udg_AS,1,0,0)
call SaveInteger(udg_AS,1,1,6)
call SaveInteger(udg_AS,2,0,1)
call SaveInteger(udg_AS,2,1,6)
call SaveInteger(udg_AS,3,0,2)
call SaveInteger(udg_AS,3,1,6)
endif
if(udg_which==7) then
call SaveInteger(udg_AS,0,0,0)
call SaveInteger(udg_AS,0,1,5)
call SaveInteger(udg_AS,1,0,1)
call SaveInteger(udg_AS,1,1,5)
call SaveInteger(udg_AS,2,0,2)
call SaveInteger(udg_AS,2,1,5)
call SaveInteger(udg_AS,3,0,0)
call SaveInteger(udg_AS,3,1,6)
endif
endfunction
function RectStatusToNextStatus takes integer udg_which returns nothing
if(udg_which==1) then
call SaveInteger(udg_NS,0,0,0)
call SaveInteger(udg_NS,0,1,1)
call SaveInteger(udg_NS,1,0,1)
call SaveInteger(udg_NS,1,1,1)
call SaveInteger(udg_NS,2,0,2)
call SaveInteger(udg_NS,2,1,1)
call SaveInteger(udg_NS,3,0,3)
call SaveInteger(udg_NS,3,1,1)
endif
if(udg_which==2) then
call SaveInteger(udg_NS,0,0,0)
call SaveInteger(udg_NS,0,1,1)
call SaveInteger(udg_NS,1,0,1)
call SaveInteger(udg_NS,1,1,1)
call SaveInteger(udg_NS,2,0,0)
call SaveInteger(udg_NS,2,1,2)
call SaveInteger(udg_NS,3,0,1)
call SaveInteger(udg_NS,3,1,2)
endif
if(udg_which==3) then
call SaveInteger(udg_NS,0,0,1)
call SaveInteger(udg_NS,0,1,0)
call SaveInteger(udg_NS,1,0,0)
call SaveInteger(udg_NS,1,1,1)
call SaveInteger(udg_NS,2,0,1)
call SaveInteger(udg_NS,2,1,1)
call SaveInteger(udg_NS,3,0,1)
call SaveInteger(udg_NS,3,1,2)
endif
if(udg_which==4) then
call SaveInteger(udg_NS,0,0,0)
call SaveInteger(udg_NS,0,1,1)
call SaveInteger(udg_NS,1,0,1)
call SaveInteger(udg_NS,1,1,1)
call SaveInteger(udg_NS,2,0,1)
call SaveInteger(udg_NS,2,1,2)
call SaveInteger(udg_NS,3,0,2)
call SaveInteger(udg_NS,3,1,2)
endif
if(udg_which==5) then
call SaveInteger(udg_NS,0,0,1)
call SaveInteger(udg_NS,0,1,1)
call SaveInteger(udg_NS,1,0,2)
call SaveInteger(udg_NS,1,1,1)
call SaveInteger(udg_NS,2,0,0)
call SaveInteger(udg_NS,2,1,2)
call SaveInteger(udg_NS,3,0,1)
call SaveInteger(udg_NS,3,1,2)
endif
if(udg_which==6) then
call SaveInteger(udg_NS,0,0,0)
call SaveInteger(udg_NS,0,1,1)
call SaveInteger(udg_NS,1,0,0)
call SaveInteger(udg_NS,1,1,2)
call SaveInteger(udg_NS,2,0,1)
call SaveInteger(udg_NS,2,1,2)
call SaveInteger(udg_NS,3,0,2)
call SaveInteger(udg_NS,3,1,2)
endif
if(udg_which==7) then
call SaveInteger(udg_NS,0,0,0)
call SaveInteger(udg_NS,0,1,1)
call SaveInteger(udg_NS,1,0,1)
call SaveInteger(udg_NS,1,1,1)
call SaveInteger(udg_NS,2,0,2)
call SaveInteger(udg_NS,2,1,1)
call SaveInteger(udg_NS,3,0,0)
call SaveInteger(udg_NS,3,1,2)
endif
endfunction
function LevelCheck takes integer score returns integer
local integer level=1
local integer i
set i=2
loop
exitwhen i>=10
if (score>=udg_UpScore) then
set level=level+1
endif
set i=i+1
endloop
return level
endfunction
function PrintNumS takes integer x,integer y,integer num returns nothing
if (num==0) then
call SaveInteger(udg_SS,x+0,y+0,1)
call SaveInteger(udg_SS,x+0,y+1,1)
call SaveInteger(udg_SS,x+0,y+2,1)
call SaveInteger(udg_SS,x+1,y+0,1)
call SaveInteger(udg_SS,x+1,y+1,0)
call SaveInteger(udg_SS,x+1,y+2,1)
call SaveInteger(udg_SS,x+2,y+0,1)
call SaveInteger(udg_SS,x+2,y+1,0)
call SaveInteger(udg_SS,x+2,y+2,1)
call SaveInteger(udg_SS,x+3,y+0,1)
call SaveInteger(udg_SS,x+3,y+1,0)
call SaveInteger(udg_SS,x+3,y+2,1)
call SaveInteger(udg_SS,x+4,y+0,1)
call SaveInteger(udg_SS,x+4,y+1,1)
call SaveInteger(udg_SS,x+4,y+2,1)
endif
if (num==1) then
call SaveInteger(udg_SS,x+0,y+0,0)
call SaveInteger(udg_SS,x+0,y+1,0)
call SaveInteger(udg_SS,x+0,y+2,1)
call SaveInteger(udg_SS,x+1,y+0,0)
call SaveInteger(udg_SS,x+1,y+1,0)
call SaveInteger(udg_SS,x+1,y+2,1)
call SaveInteger(udg_SS,x+2,y+0,0)
call SaveInteger(udg_SS,x+2,y+1,0)
call SaveInteger(udg_SS,x+2,y+2,1)
call SaveInteger(udg_SS,x+3,y+0,0)
call SaveInteger(udg_SS,x+3,y+1,0)
call SaveInteger(udg_SS,x+3,y+2,1)
call SaveInteger(udg_SS,x+4,y+0,0)
call SaveInteger(udg_SS,x+4,y+1,0)
call SaveInteger(udg_SS,x+4,y+2,1)
endif
if (num==2) then
call SaveInteger(udg_SS,x+0,y+0,1)
call SaveInteger(udg_SS,x+0,y+1,1)
call SaveInteger(udg_SS,x+0,y+2,1)
call SaveInteger(udg_SS,x+1,y+0,0)
call SaveInteger(udg_SS,x+1,y+1,0)
call SaveInteger(udg_SS,x+1,y+2,1)
call SaveInteger(udg_SS,x+2,y+0,1)
call SaveInteger(udg_SS,x+2,y+1,1)
call SaveInteger(udg_SS,x+2,y+2,1)
call SaveInteger(udg_SS,x+3,y+0,1)
call SaveInteger(udg_SS,x+3,y+1,0)
call SaveInteger(udg_SS,x+3,y+2,0)
call SaveInteger(udg_SS,x+4,y+0,1)
call SaveInteger(udg_SS,x+4,y+1,1)
call SaveInteger(udg_SS,x+4,y+2,1)
endif
if (num==3) then
call SaveInteger(udg_SS,x+0,y+0,1)
call SaveInteger(udg_SS,x+0,y+1,1)
call SaveInteger(udg_SS,x+0,y+2,1)
call SaveInteger(udg_SS,x+1,y+0,0)
call SaveInteger(udg_SS,x+1,y+1,0)
call SaveInteger(udg_SS,x+1,y+2,1)
call SaveInteger(udg_SS,x+2,y+0,1)
call SaveInteger(udg_SS,x+2,y+1,1)
call SaveInteger(udg_SS,x+2,y+2,1)
call SaveInteger(udg_SS,x+3,y+0,0)
call SaveInteger(udg_SS,x+3,y+1,0)
call SaveInteger(udg_SS,x+3,y+2,1)
call SaveInteger(udg_SS,x+4,y+0,1)
call SaveInteger(udg_SS,x+4,y+1,1)
call SaveInteger(udg_SS,x+4,y+2,1)
endif
if (num==4) then
call SaveInteger(udg_SS,x+0,y+0,1)
call SaveInteger(udg_SS,x+0,y+1,0)
call SaveInteger(udg_SS,x+0,y+2,1)
call SaveInteger(udg_SS,x+1,y+0,1)
call SaveInteger(udg_SS,x+1,y+1,0)
call SaveInteger(udg_SS,x+1,y+2,1)
call SaveInteger(udg_SS,x+2,y+0,1)
call SaveInteger(udg_SS,x+2,y+1,1)
call SaveInteger(udg_SS,x+2,y+2,1)
call SaveInteger(udg_SS,x+3,y+0,0)
call SaveInteger(udg_SS,x+3,y+1,0)
call SaveInteger(udg_SS,x+3,y+2,1)
call SaveInteger(udg_SS,x+4,y+0,0)
call SaveInteger(udg_SS,x+4,y+1,0)
call SaveInteger(udg_SS,x+4,y+2,1)
endif
if (num==5) then
call SaveInteger(udg_SS,x+0,y+0,1)
call SaveInteger(udg_SS,x+0,y+1,1)
call SaveInteger(udg_SS,x+0,y+2,1)
call SaveInteger(udg_SS,x+1,y+0,1)
call SaveInteger(udg_SS,x+1,y+1,0)
call SaveInteger(udg_SS,x+1,y+2,0)
call SaveInteger(udg_SS,x+2,y+0,1)
call SaveInteger(udg_SS,x+2,y+1,1)
call SaveInteger(udg_SS,x+2,y+2,1)
call SaveInteger(udg_SS,x+3,y+0,0)
call SaveInteger(udg_SS,x+3,y+1,0)
call SaveInteger(udg_SS,x+3,y+2,1)
call SaveInteger(udg_SS,x+4,y+0,1)
call SaveInteger(udg_SS,x+4,y+1,1)
call SaveInteger(udg_SS,x+4,y+2,1)
endif
if (num==6) then
call SaveInteger(udg_SS,x+0,y+0,1)
call SaveInteger(udg_SS,x+0,y+1,1)
call SaveInteger(udg_SS,x+0,y+2,1)
call SaveInteger(udg_SS,x+1,y+0,1)
call SaveInteger(udg_SS,x+1,y+1,0)
call SaveInteger(udg_SS,x+1,y+2,0)
call SaveInteger(udg_SS,x+2,y+0,1)
call SaveInteger(udg_SS,x+2,y+1,1)
call SaveInteger(udg_SS,x+2,y+2,1)
call SaveInteger(udg_SS,x+3,y+0,1)
call SaveInteger(udg_SS,x+3,y+1,0)
call SaveInteger(udg_SS,x+3,y+2,1)
call SaveInteger(udg_SS,x+4,y+0,1)
call SaveInteger(udg_SS,x+4,y+1,1)
call SaveInteger(udg_SS,x+4,y+2,1)
endif
if (num==7) then
call SaveInteger(udg_SS,x+0,y+0,1)
call SaveInteger(udg_SS,x+0,y+1,1)
call SaveInteger(udg_SS,x+0,y+2,1)
call SaveInteger(udg_SS,x+1,y+0,0)
call SaveInteger(udg_SS,x+1,y+1,0)
call SaveInteger(udg_SS,x+1,y+2,1)
call SaveInteger(udg_SS,x+2,y+0,0)
call SaveInteger(udg_SS,x+2,y+1,0)
call SaveInteger(udg_SS,x+2,y+2,1)
call SaveInteger(udg_SS,x+3,y+0,0)
call SaveInteger(udg_SS,x+3,y+1,0)
call SaveInteger(udg_SS,x+3,y+2,1)
call SaveInteger(udg_SS,x+4,y+0,0)
call SaveInteger(udg_SS,x+4,y+1,0)
call SaveInteger(udg_SS,x+4,y+2,1)
endif
if (num==8) then
call SaveInteger(udg_SS,x+0,y+0,1)
call SaveInteger(udg_SS,x+0,y+1,1)
call SaveInteger(udg_SS,x+0,y+2,1)
call SaveInteger(udg_SS,x+1,y+0,1)
call SaveInteger(udg_SS,x+1,y+1,0)
call SaveInteger(udg_SS,x+1,y+2,1)
call SaveInteger(udg_SS,x+2,y+0,1)
call SaveInteger(udg_SS,x+2,y+1,1)
call SaveInteger(udg_SS,x+2,y+2,1)
call SaveInteger(udg_SS,x+3,y+0,1)
call SaveInteger(udg_SS,x+3,y+1,0)
call SaveInteger(udg_SS,x+3,y+2,1)
call SaveInteger(udg_SS,x+4,y+0,1)
call SaveInteger(udg_SS,x+4,y+1,1)
call SaveInteger(udg_SS,x+4,y+2,1)
endif
if (num==9) then
call SaveInteger(udg_SS,x+0,y+0,1)
call SaveInteger(udg_SS,x+0,y+1,1)
call SaveInteger(udg_SS,x+0,y+2,1)
call SaveInteger(udg_SS,x+1,y+0,1)
call SaveInteger(udg_SS,x+1,y+1,0)
call SaveInteger(udg_SS,x+1,y+2,1)
call SaveInteger(udg_SS,x+2,y+0,1)
call SaveInteger(udg_SS,x+2,y+1,1)
call SaveInteger(udg_SS,x+2,y+2,1)
call SaveInteger(udg_SS,x+3,y+0,0)
call SaveInteger(udg_SS,x+3,y+1,0)
call SaveInteger(udg_SS,x+3,y+2,1)
call SaveInteger(udg_SS,x+4,y+0,1)
call SaveInteger(udg_SS,x+4,y+1,1)
call SaveInteger(udg_SS,x+4,y+2,1)
endif
//return
endfunction
function PrintNumL takes integer x,integer y,integer num returns nothing
if (num==0) then
call SaveInteger(udg_LS,x+0,y+0,1)
call SaveInteger(udg_LS,x+0,y+1,1)
call SaveInteger(udg_LS,x+0,y+2,1)
call SaveInteger(udg_LS,x+1,y+0,1)
call SaveInteger(udg_LS,x+1,y+1,0)
call SaveInteger(udg_LS,x+1,y+2,1)
call SaveInteger(udg_LS,x+2,y+0,1)
call SaveInteger(udg_LS,x+2,y+1,0)
call SaveInteger(udg_LS,x+2,y+2,1)
call SaveInteger(udg_LS,x+3,y+0,1)
call SaveInteger(udg_LS,x+3,y+1,0)
call SaveInteger(udg_LS,x+3,y+2,1)
call SaveInteger(udg_LS,x+4,y+0,1)
call SaveInteger(udg_LS,x+4,y+1,1)
call SaveInteger(udg_LS,x+4,y+2,1)
endif
if (num==1) then
call SaveInteger(udg_LS,x+0,y+0,0)
call SaveInteger(udg_LS,x+0,y+1,0)
call SaveInteger(udg_LS,x+0,y+2,1)
call SaveInteger(udg_LS,x+1,y+0,0)
call SaveInteger(udg_LS,x+1,y+1,0)
call SaveInteger(udg_LS,x+1,y+2,1)
call SaveInteger(udg_LS,x+2,y+0,0)
call SaveInteger(udg_LS,x+2,y+1,0)
call SaveInteger(udg_LS,x+2,y+2,1)
call SaveInteger(udg_LS,x+3,y+0,0)
call SaveInteger(udg_LS,x+3,y+1,0)
call SaveInteger(udg_LS,x+3,y+2,1)
call SaveInteger(udg_LS,x+4,y+0,0)
call SaveInteger(udg_LS,x+4,y+1,0)
call SaveInteger(udg_LS,x+4,y+2,1)
endif
if (num==2) then
call SaveInteger(udg_LS,x+0,y+0,1)
call SaveInteger(udg_LS,x+0,y+1,1)
call SaveInteger(udg_LS,x+0,y+2,1)
call SaveInteger(udg_LS,x+1,y+0,0)
call SaveInteger(udg_LS,x+1,y+1,0)
call SaveInteger(udg_LS,x+1,y+2,1)
call SaveInteger(udg_LS,x+2,y+0,1)
call SaveInteger(udg_LS,x+2,y+1,1)
call SaveInteger(udg_LS,x+2,y+2,1)
call SaveInteger(udg_LS,x+3,y+0,1)
call SaveInteger(udg_LS,x+3,y+1,0)
call SaveInteger(udg_LS,x+3,y+2,0)
call SaveInteger(udg_LS,x+4,y+0,1)
call SaveInteger(udg_LS,x+4,y+1,1)
call SaveInteger(udg_LS,x+4,y+2,1)
endif
if (num==3) then
call SaveInteger(udg_LS,x+0,y+0,1)
call SaveInteger(udg_LS,x+0,y+1,1)
call SaveInteger(udg_LS,x+0,y+2,1)
call SaveInteger(udg_LS,x+1,y+0,0)
call SaveInteger(udg_LS,x+1,y+1,0)
call SaveInteger(udg_LS,x+1,y+2,1)
call SaveInteger(udg_LS,x+2,y+0,1)
call SaveInteger(udg_LS,x+2,y+1,1)
call SaveInteger(udg_LS,x+2,y+2,1)
call SaveInteger(udg_LS,x+3,y+0,0)
call SaveInteger(udg_LS,x+3,y+1,0)
call SaveInteger(udg_LS,x+3,y+2,1)
call SaveInteger(udg_LS,x+4,y+0,1)
call SaveInteger(udg_LS,x+4,y+1,1)
call SaveInteger(udg_LS,x+4,y+2,1)
endif
if (num==4) then
call SaveInteger(udg_LS,x+0,y+0,1)
call SaveInteger(udg_LS,x+0,y+1,0)
call SaveInteger(udg_LS,x+0,y+2,1)
call SaveInteger(udg_LS,x+1,y+0,1)
call SaveInteger(udg_LS,x+1,y+1,0)
call SaveInteger(udg_LS,x+1,y+2,1)
call SaveInteger(udg_LS,x+2,y+0,1)
call SaveInteger(udg_LS,x+2,y+1,1)
call SaveInteger(udg_LS,x+2,y+2,1)
call SaveInteger(udg_LS,x+3,y+0,0)
call SaveInteger(udg_LS,x+3,y+1,0)
call SaveInteger(udg_LS,x+3,y+2,1)
call SaveInteger(udg_LS,x+4,y+0,0)
call SaveInteger(udg_LS,x+4,y+1,0)
call SaveInteger(udg_LS,x+4,y+2,1)
endif
if (num==5) then
call SaveInteger(udg_LS,x+0,y+0,1)
call SaveInteger(udg_LS,x+0,y+1,1)
call SaveInteger(udg_LS,x+0,y+2,1)
call SaveInteger(udg_LS,x+1,y+0,1)
call SaveInteger(udg_LS,x+1,y+1,0)
call SaveInteger(udg_LS,x+1,y+2,0)
call SaveInteger(udg_LS,x+2,y+0,1)
call SaveInteger(udg_LS,x+2,y+1,1)
call SaveInteger(udg_LS,x+2,y+2,1)
call SaveInteger(udg_LS,x+3,y+0,0)
call SaveInteger(udg_LS,x+3,y+1,0)
call SaveInteger(udg_LS,x+3,y+2,1)
call SaveInteger(udg_LS,x+4,y+0,1)
call SaveInteger(udg_LS,x+4,y+1,1)
call SaveInteger(udg_LS,x+4,y+2,1)
endif
if (num==6) then
call SaveInteger(udg_LS,x+0,y+0,1)
call SaveInteger(udg_LS,x+0,y+1,1)
call SaveInteger(udg_LS,x+0,y+2,1)
call SaveInteger(udg_LS,x+1,y+0,1)
call SaveInteger(udg_LS,x+1,y+1,0)
call SaveInteger(udg_LS,x+1,y+2,0)
call SaveInteger(udg_LS,x+2,y+0,1)
call SaveInteger(udg_LS,x+2,y+1,1)
call SaveInteger(udg_LS,x+2,y+2,1)
call SaveInteger(udg_LS,x+3,y+0,1)
call SaveInteger(udg_LS,x+3,y+1,0)
call SaveInteger(udg_LS,x+3,y+2,1)
call SaveInteger(udg_LS,x+4,y+0,1)
call SaveInteger(udg_LS,x+4,y+1,1)
call SaveInteger(udg_LS,x+4,y+2,1)
endif
if (num==7) then
call SaveInteger(udg_LS,x+0,y+0,1)
call SaveInteger(udg_LS,x+0,y+1,1)
call SaveInteger(udg_LS,x+0,y+2,1)
call SaveInteger(udg_LS,x+1,y+0,0)
call SaveInteger(udg_LS,x+1,y+1,0)
call SaveInteger(udg_LS,x+1,y+2,1)
call SaveInteger(udg_LS,x+2,y+0,0)
call SaveInteger(udg_LS,x+2,y+1,0)
call SaveInteger(udg_LS,x+2,y+2,1)
call SaveInteger(udg_LS,x+3,y+0,0)
call SaveInteger(udg_LS,x+3,y+1,0)
call SaveInteger(udg_LS,x+3,y+2,1)
call SaveInteger(udg_LS,x+4,y+0,0)
call SaveInteger(udg_LS,x+4,y+1,0)
call SaveInteger(udg_LS,x+4,y+2,1)
endif
if (num==8) then
call SaveInteger(udg_LS,x+0,y+0,1)
call SaveInteger(udg_LS,x+0,y+1,1)
call SaveInteger(udg_LS,x+0,y+2,1)
call SaveInteger(udg_LS,x+1,y+0,1)
call SaveInteger(udg_LS,x+1,y+1,0)
call SaveInteger(udg_LS,x+1,y+2,1)
call SaveInteger(udg_LS,x+2,y+0,1)
call SaveInteger(udg_LS,x+2,y+1,1)
call SaveInteger(udg_LS,x+2,y+2,1)
call SaveInteger(udg_LS,x+3,y+0,1)
call SaveInteger(udg_LS,x+3,y+1,0)
call SaveInteger(udg_LS,x+3,y+2,1)
call SaveInteger(udg_LS,x+4,y+0,1)
call SaveInteger(udg_LS,x+4,y+1,1)
call SaveInteger(udg_LS,x+4,y+2,1)
endif
if (num==9) then
call SaveInteger(udg_LS,x+0,y+0,1)
call SaveInteger(udg_LS,x+0,y+1,1)
call SaveInteger(udg_LS,x+0,y+2,1)
call SaveInteger(udg_LS,x+1,y+0,1)
call SaveInteger(udg_LS,x+1,y+1,0)
call SaveInteger(udg_LS,x+1,y+2,1)
call SaveInteger(udg_LS,x+2,y+0,1)
call SaveInteger(udg_LS,x+2,y+1,1)
call SaveInteger(udg_LS,x+2,y+2,1)
call SaveInteger(udg_LS,x+3,y+0,0)
call SaveInteger(udg_LS,x+3,y+1,0)
call SaveInteger(udg_LS,x+3,y+2,1)
call SaveInteger(udg_LS,x+4,y+0,1)
call SaveInteger(udg_LS,x+4,y+1,1)
call SaveInteger(udg_LS,x+4,y+2,1)
endif
//return
endfunction
[/jass]
[jass]
function InvalidateCurrent takes nothing returns nothing
local integer x1
local integer x2
local integer x3
local integer x4
local integer y1
local integer y2
local integer y3
local integer y4
local integer b1
local integer b2
local integer b3
local integer b4
local image fp
set x1 = LoadInteger(udg_AS,0,0)
set x2 = LoadInteger(udg_AS,1,0)
set x3 = LoadInteger(udg_AS,2,0)
set x4 = LoadInteger(udg_AS,3,0)
set y1 = LoadInteger(udg_AS,0,1)
set y2 = LoadInteger(udg_AS,1,1)
set y3 = LoadInteger(udg_AS,2,1)
set y4 = LoadInteger(udg_AS,3,1)
set b1= LoadInteger(udg_GS,x1,y1)
set b2= LoadInteger(udg_GS,x2,y2)
set b3= LoadInteger(udg_GS,x3,y3)
set b4= LoadInteger(udg_GS,x4,y4)
if (b1>=1) then
set fp=LoadImageHandle(udg_FP,x1,y1)
call ShowImage(fp,true)
else
set fp=LoadImageHandle(udg_FP,x1,y1)
call ShowImage(fp,false)
endif
if (b2>=1) then
set fp=LoadImageHandle(udg_FP,x2,y2)
call ShowImage(fp,true)
else
set fp=LoadImageHandle(udg_FP,x2,y2)
call ShowImage(fp,false)
endif
if (b3>=1) then
set fp=LoadImageHandle(udg_FP,x3,y3)
call ShowImage(fp,true)
else
set fp=LoadImageHandle(udg_FP,x3,y3)
call ShowImage(fp,false)
endif
if (b4>=1) then
set fp=LoadImageHandle(udg_FP,x4,y4)
call ShowImage(fp,true)
else
set fp=LoadImageHandle(udg_FP,x4,y4)
call ShowImage(fp,false)
endif
set fp=null
endfunction
function InvalidateRect takes nothing returns nothing
local integer i
local integer in
local integer j
local integer jn
local integer b
local image fp
set i=0
set in=udg_iRow-1
loop
exitwhen i>in
set j=0
set jn=udg_iCol-1
loop
exitwhen j>jn
set b=LoadInteger(udg_GS,i,j)
if (b>=1) then
set fp=LoadImageHandle(udg_FP,i,j)
call ShowImage(fp,true)
else
set fp=LoadImageHandle(udg_FP,i,j)
call ShowImage(fp,false)
endif
set j=j+1
endloop
set i=i+1
endloop
set fp=null
//return
endfunction
function InvalidateNext takes nothing returns nothing
local integer i
local integer in
local integer j
local integer jn
local integer b
local image fp
set i=0
set in=3
loop
exitwhen i>in
set j=0
set jn=3
loop
exitwhen j>jn
set b=LoadInteger(udg_NGS,i,j)
if (b>=1) then
set fp=LoadImageHandle(udg_NP,i,j)
call ShowImage(fp,true)
else
set fp=LoadImageHandle(udg_NP,i,j)
call ShowImage(fp,false)
endif
set j=j+1
endloop
set i=i+1
endloop
set fp=null
//return
endfunction
function InvalidateLevel takes nothing returns nothing
local integer i
local integer in
local integer j
local integer jn
local integer b
local image fp
set i=0
set in=4
loop
exitwhen i>in
set j=0
set jn=2
loop
exitwhen j>jn
set b=LoadInteger(udg_LS,i,j)
if (b>=1) then
set fp=LoadImageHandle(udg_LP,i,j)
call ShowImage(fp,true)
else
set fp=LoadImageHandle(udg_LP,i,j)
call ShowImage(fp,false)
endif
set j=j+1
endloop
set i=i+1
endloop
set fp=null
//return
endfunction
function InvalidateScore takes nothing returns nothing
local integer i
local integer in
local integer j
local integer jn
local integer b
local image fp
set i=0
set in=4
loop
exitwhen i>in
set j=0
set jn=14
loop
exitwhen j>jn
set b=LoadInteger(udg_SS,i,j)
if (b>=1) then
set fp=LoadImageHandle(udg_SP,i,j)
call ShowImage(fp,true)
else
set fp=LoadImageHandle(udg_SP,i,j)
call ShowImage(fp,false)
endif
set j=j+1
endloop
set i=i+1
endloop
set fp=null
//return
endfunction
function SetScore takes integer score returns nothing
local integer s0
local integer s1
local integer s2
local integer s3
local integer s4
local integer s
if(score<=99999) then
set s=score
set s0=ModuloInteger(s,10)
set s=(s-s0)/10
set s1=ModuloInteger(s,10)
set s=(s-s1)/10
set s2=ModuloInteger(s,10)
set s=(s-s2)/10
set s3=ModuloInteger(s,10)
set s=(s-s3)/10
set s4=ModuloInteger(s,10)
else
set s0=9
set s1=9
set s2=9
set s3=9
set s4=9
endif
call PrintNumS(0,0,s4)
call PrintNumS(0,3,s3)
call PrintNumS(0,6,s2)
call PrintNumS(0,9,s1)
call PrintNumS(0,12,s0)
call InvalidateScore()
//return
endfunction
function SetLevel takes integer level returns nothing
call PrintNumL(0,0,level)
set udg_LevelTime=1.00-0.1*(level-1)
set udg_Up=TRUE
call InvalidateLevel()
//return
endfunction
[/jass]
[jass]
function FlashLine takes nothing returns nothing
local integer i
local integer j
local image fp
if (udg_bloop) then
set i=0
loop
exitwhen i>=udg_iRow
if(udg_bS==TRUE) then
set j=0
loop
exitwhen j>=udg_iCol
set fp=LoadImageHandle(udg_FP,i,j)
call ShowImage(fp,TRUE)
set j=j+1
endloop
endif
set i=i+1
endloop
else
set i=0
loop
exitwhen i>=udg_iRow
if(udg_bS==TRUE) then
set j=0
loop
exitwhen j>=udg_iCol
set fp=LoadImageHandle(udg_FP,i,j)
call ShowImage(fp,FALSE)
set j=j+1
endloop
endif
set i=i+1
endloop
endif
set udg_bloop=not udg_bloop
set fp=null
//return
endfunction
function ActiveIsBottom takes nothing returns nothing
//到底有两种概念:1是已到底部,2是下面碰到了另外的方块
local integer x1
local integer x2
local integer x3
local integer x4
local integer x
local integer xx
local integer yy
local integer i
local integer j
local integer k
local integer clevel
local integer iMuch=0
local real tr
local boolean bIsSucced
if (udg_bGameEnd==FALSE and udg_bFlash==FALSE and udg_bABrun==FALSE) then
set udg_bABrun=TRUE
set x1 = LoadInteger(udg_AS,0,0)
set x2 = LoadInteger(udg_AS,1,0)
set x3 = LoadInteger(udg_AS,2,0)
set x4 = LoadInteger(udg_AS,3,0)
//已到底
//如果下面碰到了另外的方块
//一个方块分为四个小方块,只有这样的小方块下面有另外的方块才算到底,这样的小方块满足条件如下:
//它的下面不再有本方块的另外的小方块
//用算法描述为:y坐标相等的一组小方块中的最下面的哪个小方块, 我称之为接触面
if (x1>=(udg_iRow-1) or (x2>=udg_iRow-1) or (x3>=udg_iRow-1) or (x4>=udg_iRow-1)) then
set udg_isBottom = TRUE
else
set i=0
loop
exitwhen i>=4
if(LoadInteger(udg_IF,udg_currentRect,i) > -1) then
set x=LoadInteger(udg_IF,udg_currentRect,i)
set xx=LoadInteger(udg_AS,x,0)+1
set yy=LoadInteger(udg_AS,x,1)
if (LoadInteger(udg_GS,xx,yy)>=1) then
set udg_isBottom = TRUE
endif
endif
set i=i+1
endloop
endif
//本次销掉的行数
//计分规则:一次销掉一行,加100分,一次销掉两行,加400分,三行,900分
//例如销掉x行,则分数为:x*(x*100)
//判断是否已得分
if (udg_isBottom) then
// set i=0
/// loop
// exitwhen i>=udg_iRow
// set bIsSucced = TRUE
// set udg_bS=TRUE
// set j=0
// loop
// exitwhen j>=udg_iCol
// if (LoadInteger(udg_GS,i,j)==0) then
// set bIsSucced = FALSE
/// set udg_bS=FALSE
// endif
// set j=j+1
// endloop
// if (bIsSucced) then
// set udg_bFlash=TRUE
// call PauseTimer(udg_GTimer)
// set udg_bloop=false
// set udg_k=0
// call TimerStart(udg_Flash,0.1,true,function FlashLine)
//
// call PolledWait(0.6)
// call PauseTimer(udg_Flash)
// call ResumeTimer(udg_GTimer)
// set udg_bFlash=FALSE
// endif
// set i=i+1
// endloop
set i=0
loop
exitwhen i>=udg_iRow
set bIsSucced = TRUE
set j=0
loop
exitwhen j>=udg_iCol
if (LoadInteger(udg_GS,i,j)==0) then
set bIsSucced = FALSE
endif
set j=j+1
endloop
if (bIsSucced) then
set k=i
loop
exitwhen k<=0
set j=0
loop
exitwhen j>=udg_iCol
call SaveInteger(udg_GS,k,j,LoadInteger(udg_GS,k-1,j))
set j=j+1
endloop
set k=k-1
endloop
set j=0
loop
exitwhen j>=udg_iCol
call SaveInteger(udg_GS,0,j,0)
set j=j+1
endloop
set iMuch=iMuch+1
endif
set i=i+1
endloop
if (iMuch>0) then
if(iMuch<4) then
call PlaySoundBJ( gg_snd_deblock)
else
call PlaySoundBJ( gg_snd_tetris)
endif
//刷新游戏区域
call InvalidateRect()
// //刷新分数区域
set udg_iPerformance =udg_iPerformance+iMuch * iMuch * udg_Value
call SetScore(udg_iPerformance)
set clevel=LevelCheck(udg_iPerformance)
if (clevel>udg_iLevel) then
if (udg_iLevel<=5 and clevel>=6) then
call StopMusic(TRUE)
call ClearMapMusicBJ( )
call SetMapMusicIndexedBJ( gg_snd_BWing, 0 )
call PlayMusicBJ( gg_snd_BWing )
endif
call PlaySoundBJ( gg_snd_levelup)
set udg_iLevel=clevel
call SetLevel(udg_iLevel)
endif
endif
endif
set udg_bABrun=FALSE
endif
endfunction
[/jass]
[jass]
function LeftIsLimit takes nothing returns boolean
local integer x1
local integer x2
local integer x3
local integer x4
local integer y1
local integer y2
local integer y3
local integer y4
local boolean bb=TRUE
set x1 = LoadInteger(udg_AS,0,0)
set x2 = LoadInteger(udg_AS,1,0)
set x3 = LoadInteger(udg_AS,2,0)
set x4 = LoadInteger(udg_AS,3,0)
set y1 = LoadInteger(udg_AS,0,1)
set y2 = LoadInteger(udg_AS,1,1)
set y3 = LoadInteger(udg_AS,2,1)
set y4 = LoadInteger(udg_AS,3,1)
if(udg_currentRect==1) then
if (LoadInteger(udg_GS,x1,y1-1)>=1 or LoadInteger(udg_GS,x2,y2-1)>=1 or LoadInteger(udg_GS,x3,y3-1)>=1 or LoadInteger(udg_GS,x4,y4-1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==11) then
if (LoadInteger(udg_GS,x1,y1-1)>=1) then
set bb=FALSE
endif
endif
if(udg_currentRect==2) then
if (LoadInteger(udg_GS,x1,y1-1)>=1 or LoadInteger(udg_GS,x2,y2-1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==3) then
if (LoadInteger(udg_GS,x1,y1-1)>=1 or LoadInteger(udg_GS,x2,y2-1)>=1) then
set bb=FALSE
endif
endif
if(udg_currentRect==31) then
if (LoadInteger(udg_GS,x1,y1-1)>=1 or LoadInteger(udg_GS,x2,y2-1)>=1 or LoadInteger(udg_GS,x3,y3-1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==32) then
if (LoadInteger(udg_GS,x1,y1-1)>=1 or LoadInteger(udg_GS,x3,y3-1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==33) then
if (LoadInteger(udg_GS,x1,y1-1)>=1 or LoadInteger(udg_GS,x2,y2-1)>=1 or LoadInteger(udg_GS,x4,y4-1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==4) then
if (LoadInteger(udg_GS,x1,y1-1)>=1 or LoadInteger(udg_GS,x2,y2-1)>=1 or LoadInteger(udg_GS,x4,y4-1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==41) then
if (LoadInteger(udg_GS,x1,y1-1)>=1 or LoadInteger(udg_GS,x2,y2-1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==5) then
if (LoadInteger(udg_GS,x1,y1-1)>=1 or LoadInteger(udg_GS,x2,y2-1)>=1 or LoadInteger(udg_GS,x3,y3-1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==51) then
if (LoadInteger(udg_GS,x1,y1-1)>=1 or LoadInteger(udg_GS,x3,y3-1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==6) then
if (LoadInteger(udg_GS,x1,y1-1)>=1 or LoadInteger(udg_GS,x3,y3-1)>=1 or LoadInteger(udg_GS,x4,y4-1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==61) then
if (LoadInteger(udg_GS,x1,y1-1)>=1 or LoadInteger(udg_GS,x2,y2-1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==62) then
if (LoadInteger(udg_GS,x1,y1-1)>=1 or LoadInteger(udg_GS,x2,y2-1)>=1 or LoadInteger(udg_GS,x3,y3-1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==63) then
if (LoadInteger(udg_GS,x1,y1-1)>=1 or LoadInteger(udg_GS,x3,y3-1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==7) then
if (LoadInteger(udg_GS,x1,y1-1)>=1 or LoadInteger(udg_GS,x2,y2-1)>=1 or LoadInteger(udg_GS,x3,y3-1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==71) then
if (LoadInteger(udg_GS,x1,y1-1)>=1 or LoadInteger(udg_GS,x2,y2-1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==72) then
if (LoadInteger(udg_GS,x1,y1-1)>=1 or LoadInteger(udg_GS,x2,y2-1)>=1 or LoadInteger(udg_GS,x3,y3-1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==73) then
if (LoadInteger(udg_GS,x1,y1-1)>=1 or LoadInteger(udg_GS,x4,y4-1)>=1 ) then
set bb=FALSE
endif
endif
return bb
endfunction
function RightIsLimit takes nothing returns boolean
local integer x1
local integer x2
local integer x3
local integer x4
local integer y1
local integer y2
local integer y3
local integer y4
local boolean bb=TRUE
set x1 = LoadInteger(udg_AS,0,0)
set x2 = LoadInteger(udg_AS,1,0)
set x3 = LoadInteger(udg_AS,2,0)
set x4 = LoadInteger(udg_AS,3,0)
set y1 = LoadInteger(udg_AS,0,1)
set y2 = LoadInteger(udg_AS,1,1)
set y3 = LoadInteger(udg_AS,2,1)
set y4 = LoadInteger(udg_AS,3,1)
if(udg_currentRect==1) then
if (LoadInteger(udg_GS,x1,y1+1)>=1 or LoadInteger(udg_GS,x2,y2+1)>=1 or LoadInteger(udg_GS,x3,y3+1)>=1 or LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==11) then
if (LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==2) then
if (LoadInteger(udg_GS,x3,y3+1)>=1 or LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==3) then
if (LoadInteger(udg_GS,x2,y2+1)>=1 or LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==31) then
if (LoadInteger(udg_GS,x1,y1+1)>=1 or LoadInteger(udg_GS,x3,y3+1)>=1 or LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==32) then
if (LoadInteger( udg_GS,x3,y3+1)>=1 or LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==33) then
if ( LoadInteger(udg_GS,x2,y2+1)>=1 or LoadInteger(udg_GS,x3,y3+1)>=1 or LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==4) then
if (LoadInteger(udg_GS,x1,y1+1)>=1 or LoadInteger(udg_GS,x3,y3+1)>=1 or LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==41) then
if ( LoadInteger(udg_GS,x3,y3+1)>=1 or LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==5) then
if ( LoadInteger(udg_GS,x2,y2+1)>=1 or LoadInteger(udg_GS,x3,y3+1)>=1 or LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==51) then
if ( LoadInteger(udg_GS,x2,y2+1)>=1 or LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==6) then
if ( LoadInteger(udg_GS,x2,y2+1)>=1 or LoadInteger(udg_GS,x3,y3+1)>=1 or LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==61) then
if (LoadInteger(udg_GS,x2,y2+1)>=1 or LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==62) then
if (LoadInteger(udg_GS,x1,y1+1)>=1 or LoadInteger(udg_GS,x2,y2+1)>=1 or LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==63) then
if ( LoadInteger(udg_GS,x3,y3+1)>=1 or LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==7) then
if (LoadInteger(udg_GS,x2,y2+1)>=1 or LoadInteger(udg_GS,x3,y3+1)>=1 or LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==71) then
if (LoadInteger(udg_GS,x1,y1+1)>=1 or LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==72) then
if (LoadInteger(udg_GS,x2,y2+1)>=1 or LoadInteger(udg_GS,x3,y3+1)>=1 or LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
if(udg_currentRect==73) then
if (LoadInteger(udg_GS,x3,y3+1)>=1 or LoadInteger(udg_GS,x4,y4+1)>=1 ) then
set bb=FALSE
endif
endif
return bb
endfunction
function RectDown takes nothing returns nothing
local integer x1
local integer x2
local integer x3
local integer x4
local integer y1
local integer y2
local integer y3
local integer y4
if (udg_bGameEnd==FALSE and udg_bFlash==FALSE and udg_bABrun==FALSE) then
call ActiveIsBottom()
if (not udg_isBottom) then
//清除以前的方块
set x1 = LoadInteger(udg_AS,0,0)
set x2 = LoadInteger(udg_AS,1,0)
set x3 = LoadInteger(udg_AS,2,0)
set x4 = LoadInteger(udg_AS,3,0)
set y1 = LoadInteger(udg_AS,0,1)
set y2 = LoadInteger(udg_AS,1,1)
set y3 = LoadInteger(udg_AS,2,1)
set y4 = LoadInteger(udg_AS,3,1)
call SaveInteger(udg_GS,x1,y1,0)
call SaveInteger(udg_GS,x2,y2,0)
call SaveInteger(udg_GS,x3,y3,0)
call SaveInteger(udg_GS,x4,y4,0)
call InvalidateCurrent()
//方块下落
set x1=x1+1
set x2=x2+1
set x3=x3+1
set x4=x4+1
call SaveInteger(udg_AS,0,0,x1)
call SaveInteger(udg_AS,1,0,x2)
call SaveInteger(udg_AS,2,0,x3)
call SaveInteger(udg_AS,3,0,x4)
call SaveInteger(udg_GS,x1,y1,1)
call SaveInteger(udg_GS,x2,y2,1)
call SaveInteger(udg_GS,x3,y3,1)
call SaveInteger(udg_GS,x4,y4,1)
call InvalidateCurrent()
else
call PlaySoundBJ( gg_snd_bottom )
endif
endif
endfunction
function RectChange takes nothing returns nothing
//先预先变形,然后判断变形后的方块是否有空间,如有足够空间,则进行实际变形,否则不变
local integer xx1
local integer xx2
local integer xx3
local integer xx4
local integer yy1
local integer yy2
local integer yy3
local integer yy4
local integer iscurrentRect
//local boolean bb=TRUE
local integer x1
local integer x2
local integer x3
local integer x4
local integer y1
local integer y2
local integer y3
local integer y4
if (udg_bGameEnd==FALSE and udg_bFlash==FALSE and udg_bABrun==FALSE) then
set x1 = LoadInteger(udg_AS,0,0)
set x2 = LoadInteger(udg_AS,1,0)
set x3 = LoadInteger(udg_AS,2,0)
set x4 = LoadInteger(udg_AS,3,0)
set y1 = LoadInteger(udg_AS,0,1)
set y2 = LoadInteger(udg_AS,1,1)
set y3 = LoadInteger(udg_AS,2,1)
set y4 = LoadInteger(udg_AS,3,1)
//变形后位置在数组中的存放顺序仍需遵循先左后右,在同一列中先上后下
set xx1=x1
set xx2=x2
set xx3=x3
set xx4=x4
set yy1=y1
set yy2=y2
set yy3=y3
set yy4=y4
if(udg_currentRect==1) then
set xx1=x1+1
set yy1=y1-1
set xx3=x3-1
set yy3=y3+1
set xx4=x4-2
set yy4=y4+2
set iscurrentRect=11
endif
if(udg_currentRect==11) then
set xx1=x1-1
set yy1=y1+1
set xx3=x3+1
set yy3=y3-1
set xx4=x4+2
set yy4=y4-2
set iscurrentRect=1
endif
if(udg_currentRect==2) then
set iscurrentRect=2
endif
if(udg_currentRect==3) then
set xx1=x2
set yy1=y2
set xx2=x3
set xx3=x3+1
set iscurrentRect=31
endif
if(udg_currentRect==31) then
set xx1=x2
set yy1=y1-1
set iscurrentRect=32
endif
if(udg_currentRect==32) then
set xx2=x2-1
set xx3=x2
set xx4=x3
set yy4=y3
set iscurrentRect=33
endif
if(udg_currentRect==33) then
set xx4=x4-1
set yy4=y4+1
set iscurrentRect=3
endif
if(udg_currentRect==4) then
set xx1=x4
set yy2=y3
set xx3=x4
set xx4=x2
set yy4=y4+1
set iscurrentRect=41
endif
if(udg_currentRect==41) then
set xx1=x1-2
set yy2=y1
set xx3=x2
set xx4=x3
set yy4=y3
set iscurrentRect=4
endif
if(udg_currentRect==5) then
set yy1=y1-1
set xx2=x1
set xx3=x2
set yy3=y2
set xx4=x2
set iscurrentRect=51
endif
if(udg_currentRect==51) then
set yy1=y2
set xx2=x3
set xx3=x3-2
set yy3=y4
set xx4=x2
set iscurrentRect=5
endif
if(udg_currentRect==6) then
set xx1=x1+1
set xx2=x4
set yy2=y1
set xx4=x3
set yy4=y4+1
set iscurrentRect=61
endif
if(udg_currentRect==61) then
set xx1=x1-1
set yy1=y3
set xx2=x3
set yy2=y3
set xx3=x2
set xx4=x2
set iscurrentRect=62
endif
if(udg_currentRect==62) then
set xx1=x2
set yy1=y1-1
set xx3=x1
set yy3=y4
set xx4=x2
set iscurrentRect=63
endif
if(udg_currentRect==63) then
set xx1=x3
set xx2=x3
set xx3=x2
set yy3=y2
set xx4=x4+1
set yy4=y2
set iscurrentRect=6
endif
if(udg_currentRect==7) then
set yy1=y1-1
set yy2=y2-1
set xx3=x2
set xx4=x2
set iscurrentRect=71
endif
if(udg_currentRect==71) then
set xx1=x1+2
set xx2=x1
set yy2=y3
set xx4=x4+1
set yy4=y3
set iscurrentRect=72
endif
if(udg_currentRect==72) then
set xx1=x3
set xx2=x3
set yy3=y3+1
set yy4=y4+1
set iscurrentRect=73
endif
if(udg_currentRect==73) then
set xx1=x1-1
set yy1=y2
set xx3=x4
set yy3=y2
set xx4=x4-2
set iscurrentRect=7
endif
//如果变形后所在的区域内无其他方块,则表示有足够空间,可以变形
//且不能超越边界
call SaveInteger(udg_GS,x1,y1,0)
call SaveInteger(udg_GS,x2,y2,0)
call SaveInteger(udg_GS,x3,y3,0)
call SaveInteger(udg_GS,x4,y4,0)
if (LoadInteger(udg_GS,xx1,yy1)==0 and LoadInteger(udg_GS,xx2,yy2)==0 and LoadInteger(udg_GS,xx3,yy3)==0 and LoadInteger(udg_GS,xx4,yy4)==0 and yy1>=0 and yy4<=(udg_iCol-1) and xx1>=0 and xx2>=0 and xx3>=0 and xx4>=0 and xx1<=udg_iRow and xx2<=udg_iRow and xx3<=udg_iRow and xx4<=udg_iRow ) then
call InvalidateCurrent()
call SaveInteger(udg_AS,0,0,xx1)
call SaveInteger(udg_AS,1,0,xx2)
call SaveInteger(udg_AS,2,0,xx3)
call SaveInteger(udg_AS,3,0,xx4)
call SaveInteger(udg_AS,0,1,yy1)
call SaveInteger(udg_AS,1,1,yy2)
call SaveInteger(udg_AS,2,1,yy3)
call SaveInteger(udg_AS,3,1,yy4)
call SaveInteger(udg_GS,xx1,yy1,1)
call SaveInteger(udg_GS,xx2,yy2,1)
call SaveInteger(udg_GS,xx3,yy3,1)
call SaveInteger(udg_GS,xx4,yy4,1)
call InvalidateCurrent()
//改变形状代码
set udg_currentRect = iscurrentRect
else
call SaveInteger(udg_GS,x1,y1,1)
call SaveInteger(udg_GS,x2,y2,1)
call SaveInteger(udg_GS,x3,y3,1)
call SaveInteger(udg_GS,x4,y4,1)
endif
//判断是否已到底
call PlaySoundBJ( gg_snd_change)
call ActiveIsBottom()
endif
endfunction
function RectArrow takes integer tp returns nothing
local integer x1
local integer x2
local integer x3
local integer x4
local integer y1
local integer y2
local integer y3
local integer y4
if (udg_bGameEnd==FALSE and udg_bFlash==FALSE and udg_bABrun==FALSE) then
set x1 = LoadInteger(udg_AS,0,0)
set x2 = LoadInteger(udg_AS,1,0)
set x3 = LoadInteger(udg_AS,2,0)
set x4 = LoadInteger(udg_AS,3,0)
set y1 = LoadInteger(udg_AS,0,1)
set y2 = LoadInteger(udg_AS,1,1)
set y3 = LoadInteger(udg_AS,2,1)
set y4 = LoadInteger(udg_AS,3,1)
//如果方块已到底则不能再移动
if (tp==0) then
call PlaySoundBJ( gg_snd_move )
if(y1>0 and LeftIsLimit() and (not udg_isBottom)) then
call SaveInteger(udg_GS,x1,y1,0)
call SaveInteger(udg_GS,x2,y2,0)
call SaveInteger(udg_GS,x3,y3,0)
call SaveInteger(udg_GS,x4,y4,0)
call InvalidateCurrent()
set y1=y1-1
set y2=y2-1
set y3=y3-1
set y4=y4-1
call SaveInteger(udg_AS,0,1,y1)
call SaveInteger(udg_AS,1,1,y2)
call SaveInteger(udg_AS,2,1,y3)
call SaveInteger(udg_AS,3,1,y4)
call SaveInteger(udg_GS,x1,y1,1)
call SaveInteger(udg_GS,x2,y2,1)
call SaveInteger(udg_GS,x3,y3,1)
call SaveInteger(udg_GS,x4,y4,1)
call InvalidateCurrent()
endif
endif
if (tp==1) then
call PlaySoundBJ( gg_snd_move )
if(y4<(udg_iCol-1) and RightIsLimit() and (not udg_isBottom)) then
call SaveInteger(udg_GS,x1,y1,0)
call SaveInteger(udg_GS,x2,y2,0)
call SaveInteger(udg_GS,x3,y3,0)
call SaveInteger(udg_GS,x4,y4,0)
call InvalidateCurrent()
set y1=y1+1
set y2=y2+1
set y3=y3+1
set y4=y4+1
call SaveInteger(udg_AS,0,1,y1)
call SaveInteger(udg_AS,1,1,y2)
call SaveInteger(udg_AS,2,1,y3)
call SaveInteger(udg_AS,3,1,y4)
call SaveInteger(udg_GS,x1,y1,1)
call SaveInteger(udg_GS,x2,y2,1)
call SaveInteger(udg_GS,x3,y3,1)
call SaveInteger(udg_GS,x4,y4,1)
call InvalidateCurrent()
endif
endif
if (tp==2) then
call PlaySoundBJ( gg_snd_down )
call RectDown()
endif
endif
endfunction
[/jass]
[jass]
function GameOver takes nothing returns nothing
local integer i
local integer j
call PauseTimer(udg_GTimer)
call StopMusic(FALSE)
call ClearMapMusic()
call PlaySoundBJ( gg_snd_gameover )
set i=0
loop
exitwhen i>=udg_iRow
set j=0
loop
exitwhen j>=udg_iCol
call SaveInteger(udg_GS,i,j,1)
set j=j+1
endloop
set i=i+1
endloop
call SaveInteger(udg_GS,0,1,0)
call SaveInteger(udg_GS,0,6,0)
call SaveInteger(udg_GS,0,8,0)
call SaveInteger(udg_GS,1,2,0)
call SaveInteger(udg_GS,1,3,0)
call SaveInteger(udg_GS,1,7,0)
call SaveInteger(udg_GS,2,2,0)
call SaveInteger(udg_GS,3,2,0)
call SaveInteger(udg_GS,3,7,0)
call SaveInteger(udg_GS,4,1,0)
call SaveInteger(udg_GS,4,7,0)
call SaveInteger(udg_GS,5,2,0)
call SaveInteger(udg_GS,6,7,0)
call SaveInteger(udg_GS,6,8,0)
call SaveInteger(udg_GS,7,2,0)
call SaveInteger(udg_GS,8,2,0)
call SaveInteger(udg_GS,8,7,0)
call SaveInteger(udg_GS,8,8,0)
call SaveInteger(udg_GS,9,2,0)
call SaveInteger(udg_GS,10,1,0)
call SaveInteger(udg_GS,10,3,0)
call SaveInteger(udg_GS,10,7,0)
call SaveInteger(udg_GS,11,2,0)
call SaveInteger(udg_GS,11,7,0)
call SaveInteger(udg_GS,12,2,0)
call SaveInteger(udg_GS,12,7,0)
call SaveInteger(udg_GS,13,2,0)
call SaveInteger(udg_GS,14,1,0)
call SaveInteger(udg_GS,14,3,0)
call SaveInteger(udg_GS,14,6,0)
call SaveInteger(udg_GS,14,8,0)
call SaveInteger(udg_GS,15,8,0)
call SaveInteger(udg_GS,16,2,0)
call SaveInteger(udg_GS,16,3,0)
call SaveInteger(udg_GS,16,7,0)
call SaveInteger(udg_GS,17,8,0)
call SaveInteger(udg_GS,18,2,0)
call SaveInteger(udg_GS,18,3,0)
call SaveInteger(udg_GS,18,7,0)
call SaveInteger(udg_GS,19,7,0)
set i=0
loop
exitwhen i>=udg_iRow
call SaveInteger(udg_GS,i,0,0)
call SaveInteger(udg_GS,i,4,0)
call SaveInteger(udg_GS,i,5,0)
call SaveInteger(udg_GS,i,9,0)
set i=i+1
endloop
call InvalidateRect()
set i=0
loop
exitwhen(i>=100)
set j=0
loop
exitwhen (j>=100)
call SaveInteger(udg_GS,i,j,0)
set j=j+1
endloop
set i=i+1
endloop
set i=0
loop
exitwhen(i>=4)
set j=0
loop
exitwhen (j>=4)
call SaveInteger(udg_NGS,i,j,0)
set j=j+1
endloop
set i=i+1
endloop
set i=0
loop
exitwhen(i>=5)
set j=0
loop
exitwhen (j>=15)
call SaveInteger(udg_LS,i,j,0)
set j=j+1
endloop
set i=i+1
endloop
set i=0
loop
exitwhen(i>=5)
set j=0
loop
exitwhen (j>=15)
call SaveInteger(udg_SS,i,j,0)
set j=j+1
endloop
set i=i+1
endloop
// call EnableTrigger( gg_trg_GameStart )
//return
endfunction
function OnTimer takes nothing returns nothing
//如果原来的方块已到底或游戏刚开始,则掉下一个新的方块
local integer i
local integer j
local integer k
if (udg_bGameEnd==FALSE and udg_bFlash==FALSE and udg_bABrun==FALSE) then
if (udg_isBottom) then
set udg_icurrentStatus = udg_inextStatus
set udg_inextStatus = GetRandomInt(1,7) //得到下一次的方块样式
set udg_currentRect = udg_icurrentStatus //当前落下的方块的形状代码
call RectStatusToActiveStatus( udg_icurrentStatus )
call ActiveStatusToGameStatus()
set udg_isBottom = FALSE
call ActiveIsBottom()
call InvalidateCurrent()
//在屏幕右边显示下一次将会出来的方块的模样
call RectStatusToNextStatus( udg_inextStatus )
call NextStatusToGameNextStatus()
call InvalidateNext()
//判断游戏是否已结束: 碰了底,且第1行有小方块
if (udg_isBottom) then
set i=0
loop
exitwhen (i>=udg_iCol or udg_bGameEnd)
if (LoadInteger(udg_GS,0,i)>=1) then
set udg_bGameEnd = TRUE
set udg_isBottom=FALSE
call DisableTrigger( gg_trg_OnKeyLeft )
call DisableTrigger( gg_trg_OnKeyRight )
call DisableTrigger( gg_trg_OnKeyDown )
call DisableTrigger( gg_trg_OnKeyUp )
//call PauseTimer(udg_GTimer)
call GameOver()
call ShowInterfaceForceOn( GetPlayersAll(), 6.49 )
endif
set i=i+1
endloop
endif
if (udg_Up) then
set udg_Up=FALSE
call TimerStart(udg_GTimer,udg_LevelTime,true,function OnTimer)
endif
else //当前方块下降
if (not udg_bGameEnd ) then
call RectDown()
endif
endif
endif
endfunction
//***************************************************************************
//*
//* Triggers
//*
//***************************************************************************
//===========================================================================
// Trigger: 对战初始化
//
// 默认的对所有玩家的对战游戏初始化
//===========================================================================
function Trig________________u_Actions takes nothing returns nothing
call MeleeStartingVisibility( )
call MeleeStartingHeroLimit( )
call MeleeStartingResources( )
call FogEnableOff( )
call FogMaskEnableOff( )
call EnableDawnDusk( false )
call CHWRECTView()
call InitDraw0()
call InitDraw()
set udg_CenterUnit = gg_unit_e001_0002
call ShowUnitHide( udg_CenterUnit )
call CameraSetupApplyForPlayer( true, gg_cam_center, Player(6), 0 )
call SetCameraTargetControllerNoZForPlayer( Player(6), udg_CenterUnit, 0, 0, false )
call PolledWait( 0.10 )
call InitDraw2()
call PolledWait( 0.01 )
call StopMusicBJ( false )
call ClearMapMusicBJ( )
call PlaySoundBJ( gg_snd_LittleKing )
call QuestMessageBJ( GetPlayersAll(), bj_QUESTMESSAGE_ALWAYSHINT, "TRIGSTR_055" )
endfunction
//===========================================================================
function InitTrig________________u takes nothing returns nothing
set gg_trg________________u = CreateTrigger( )
call TriggerAddAction( gg_trg________________u, function Trig________________u_Actions )
endfunction
//===========================================================================
// Trigger: OnKeyLeft
//===========================================================================
function Trig_OnKeyLeft_Conditions takes nothing returns boolean
if ( not ( udg_bFlash == false ) ) then
return false
endif
if ( not ( udg_bABrun == false ) ) then
return false
endif
if ( not ( udg_bGameEnd == false ) ) then
return false
endif
return true
endfunction
function Trig_OnKeyLeft_Actions takes nothing returns nothing
call DisableTrigger( gg_trg_OnKeyLeft )
call DisableTrigger( gg_trg_OnKeyRight )
call DisableTrigger( gg_trg_OnKeyDown )
call DisableTrigger( gg_trg_OnKeyUp )
call RectArrow(0)
call StartTimerBJ( udg_LTimer, true, 0.10 )
call EnableTrigger( gg_trg_OffKeyLeft )
call EnableTrigger( gg_trg_left )
endfunction
//===========================================================================
function InitTrig_OnKeyLeft takes nothing returns nothing
set gg_trg_OnKeyLeft = CreateTrigger( )
call DisableTrigger( gg_trg_OnKeyLeft )
call TriggerRegisterPlayerKeyEventBJ( gg_trg_OnKeyLeft, Player(6), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_LEFT )
call TriggerAddCondition( gg_trg_OnKeyLeft, Condition( function Trig_OnKeyLeft_Conditions ) )
call TriggerAddAction( gg_trg_OnKeyLeft, function Trig_OnKeyLeft_Actions )
endfunction
//===========================================================================
// Trigger: OffKeyLeft
//===========================================================================
function Trig_OffKeyLeft_Func004C takes nothing returns boolean
if ( not ( udg_bGameEnd == false ) ) then
return false
endif
return true
endfunction
function Trig_OffKeyLeft_Actions takes nothing returns nothing
call DisableTrigger( gg_trg_OffKeyLeft )
call DisableTrigger( gg_trg_left )
call PauseTimerBJ( true, udg_LTimer )
if ( Trig_OffKeyLeft_Func004C() ) then
call EnableTrigger( gg_trg_OnKeyLeft )
call EnableTrigger( gg_trg_OnKeyRight )
call EnableTrigger( gg_trg_OnKeyUp )
call EnableTrigger( gg_trg_OnKeyDown )
else
call DoNothing( )
endif
endfunction
//===========================================================================
function InitTrig_OffKeyLeft takes nothing returns nothing
set gg_trg_OffKeyLeft = CreateTrigger( )
call DisableTrigger( gg_trg_OffKeyLeft )
call TriggerRegisterPlayerKeyEventBJ( gg_trg_OffKeyLeft, Player(6), bj_KEYEVENTTYPE_RELEASE, bj_KEYEVENTKEY_LEFT )
call TriggerAddAction( gg_trg_OffKeyLeft, function Trig_OffKeyLeft_Actions )
endfunction
//===========================================================================
// Trigger: left
//===========================================================================
function Trig_left_Conditions takes nothing returns boolean
if ( not ( udg_bFlash == false ) ) then
return false
endif
if ( not ( udg_bABrun == false ) ) then
return false
endif
if ( not ( udg_bGameEnd == false ) ) then
return false
endif
return true
endfunction
function Trig_left_Actions takes nothing returns nothing
call RectArrow(0)
endfunction
//===========================================================================
function InitTrig_left takes nothing returns nothing
set gg_trg_left = CreateTrigger( )
call DisableTrigger( gg_trg_left )
call TriggerRegisterTimerExpireEventBJ( gg_trg_left, udg_LTimer )
call TriggerAddCondition( gg_trg_left, Condition( function Trig_left_Conditions ) )
call TriggerAddAction( gg_trg_left, function Trig_left_Actions )
endfunction
//===========================================================================
// Trigger: OnKeyRight
//===========================================================================
function Trig_OnKeyRight_Conditions takes nothing returns boolean
if ( not ( udg_bFlash == false ) ) then
return false
endif
if ( not ( udg_bABrun == false ) ) then
return false
endif
if ( not ( udg_bGameEnd == false ) ) then
return false
endif
return true
endfunction
function Trig_OnKeyRight_Actions takes nothing returns nothing
call DisableTrigger( gg_trg_OnKeyRight )
call DisableTrigger( gg_trg_OnKeyLeft )
call DisableTrigger( gg_trg_OnKeyDown )
call DisableTrigger( gg_trg_OnKeyUp )
call RectArrow(1)
call StartTimerBJ( udg_RTimer, true, 0.10 )
call EnableTrigger( gg_trg_OffKeRight )
call EnableTrigger( gg_trg_right )
endfunction
//===========================================================================
function InitTrig_OnKeyRight takes nothing returns nothing
set gg_trg_OnKeyRight = CreateTrigger( )
call DisableTrigger( gg_trg_OnKeyRight )
call TriggerRegisterPlayerKeyEventBJ( gg_trg_OnKeyRight, Player(6), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_RIGHT )
call TriggerAddCondition( gg_trg_OnKeyRight, Condition( function Trig_OnKeyRight_Conditions ) )
call TriggerAddAction( gg_trg_OnKeyRight, function Trig_OnKeyRight_Actions )
endfunction
//===========================================================================
// Trigger: OffKeRight
//===========================================================================
function Trig_OffKeRight_Func004C takes nothing returns boolean
if ( not ( udg_bGameEnd == false ) ) then
return false
endif
return true
endfunction
function Trig_OffKeRight_Actions takes nothing returns nothing
call DisableTrigger( gg_trg_OffKeRight )
call DisableTrigger( gg_trg_right )
call PauseTimerBJ( true, udg_RTimer )
if ( Trig_OffKeRight_Func004C() ) then
call EnableTrigger( gg_trg_OnKeyLeft )
call EnableTrigger( gg_trg_OnKeyRight )
call EnableTrigger( gg_trg_OnKeyUp )
call EnableTrigger( gg_trg_OnKeyDown )
else
call DoNothing( )
endif
endfunction
//===========================================================================
function InitTrig_OffKeRight takes nothing returns nothing
set gg_trg_OffKeRight = CreateTrigger( )
call DisableTrigger( gg_trg_OffKeRight )
call TriggerRegisterPlayerKeyEventBJ( gg_trg_OffKeRight, Player(6), bj_KEYEVENTTYPE_RELEASE, bj_KEYEVENTKEY_RIGHT )
call TriggerAddAction( gg_trg_OffKeRight, function Trig_OffKeRight_Actions )
endfunction
//===========================================================================
// Trigger: right
//===========================================================================
function Trig_right_Conditions takes nothing returns boolean
if ( not ( udg_bFlash == false ) ) then
return false
endif
if ( not ( udg_bABrun == false ) ) then
return false
endif
if ( not ( udg_bGameEnd == false ) ) then
return false
endif
return true
endfunction
function Trig_right_Actions takes nothing returns nothing
call RectArrow(1)
endfunction
//===========================================================================
function InitTrig_right takes nothing returns nothing
set gg_trg_right = CreateTrigger( )
call DisableTrigger( gg_trg_right )
call TriggerRegisterTimerExpireEventBJ( gg_trg_right, udg_RTimer )
call TriggerAddCondition( gg_trg_right, Condition( function Trig_right_Conditions ) )
call TriggerAddAction( gg_trg_right, function Trig_right_Actions )
endfunction
//===========================================================================
// Trigger: OnKeyDown
//===========================================================================
function Trig_OnKeyDown_Conditions takes nothing returns boolean
if ( not ( udg_bFlash == false ) ) then
return false
endif
if ( not ( udg_bABrun == false ) ) then
return false
endif
if ( not ( udg_bGameEnd == false ) ) then
return false
endif
return true
endfunction
function Trig_OnKeyDown_Actions takes nothing returns nothing
call DisableTrigger( gg_trg_OnKeyLeft )
call DisableTrigger( gg_trg_OnKeyRight )
call DisableTrigger( gg_trg_OnKeyDown )
call DisableTrigger( gg_trg_OnKeyUp )
call RectArrow(2)
call StartTimerBJ( udg_DTimer, true, 0.05 )
call EnableTrigger( gg_trg_OffKeDown )
call EnableTrigger( gg_trg_down )
endfunction
//===========================================================================
function InitTrig_OnKeyDown takes nothing returns nothing
set gg_trg_OnKeyDown = CreateTrigger( )
call DisableTrigger( gg_trg_OnKeyDown )
call TriggerRegisterPlayerKeyEventBJ( gg_trg_OnKeyDown, Player(6), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_DOWN )
call TriggerAddCondition( gg_trg_OnKeyDown, Condition( function Trig_OnKeyDown_Conditions ) )
call TriggerAddAction( gg_trg_OnKeyDown, function Trig_OnKeyDown_Actions )
endfunction
//===========================================================================
// Trigger: OffKeDown
//===========================================================================
function Trig_OffKeDown_Func004C takes nothing returns boolean
if ( not ( udg_bGameEnd == false ) ) then
return false
endif
return true
endfunction
function Trig_OffKeDown_Actions takes nothing returns nothing
call DisableTrigger( gg_trg_OffKeDown )
call DisableTrigger( gg_trg_down )
call PauseTimerBJ( true, udg_DTimer )
if ( Trig_OffKeDown_Func004C() ) then
call EnableTrigger( gg_trg_OnKeyLeft )
call EnableTrigger( gg_trg_OnKeyRight )
call EnableTrigger( gg_trg_OnKeyUp )
call EnableTrigger( gg_trg_OnKeyDown )
else
call DoNothing( )
endif
endfunction
//===========================================================================
function InitTrig_OffKeDown takes nothing returns nothing
set gg_trg_OffKeDown = CreateTrigger( )
call DisableTrigger( gg_trg_OffKeDown )
call TriggerRegisterPlayerKeyEventBJ( gg_trg_OffKeDown, Player(6), bj_KEYEVENTTYPE_RELEASE, bj_KEYEVENTKEY_DOWN )
call TriggerAddAction( gg_trg_OffKeDown, function Trig_OffKeDown_Actions )
endfunction
//===========================================================================
// Trigger: down
//===========================================================================
function Trig_down_Conditions takes nothing returns boolean
if ( not ( udg_bFlash == false ) ) then
return false
endif
if ( not ( udg_bABrun == false ) ) then
return false
endif
if ( not ( udg_bGameEnd == false ) ) then
return false
endif
return true
endfunction
function Trig_down_Actions takes nothing returns nothing
call RectArrow(2)
endfunction
//===========================================================================
function InitTrig_down takes nothing returns nothing
set gg_trg_down = CreateTrigger( )
call DisableTrigger( gg_trg_down )
call TriggerRegisterTimerExpireEventBJ( gg_trg_down, udg_DTimer )
call TriggerAddCondition( gg_trg_down, Condition( function Trig_down_Conditions ) )
call TriggerAddAction( gg_trg_down, function Trig_down_Actions )
endfunction
//===========================================================================
// Trigger: OnKeyUp
//===========================================================================
function Trig_OnKeyUp_Conditions takes nothing returns boolean
if ( not ( udg_bFlash == false ) ) then
return false
endif
if ( not ( udg_bABrun == false ) ) then
return false
endif
if ( not ( udg_bGameEnd == false ) ) then
return false
endif
return true
endfunction
function Trig_OnKeyUp_Actions takes nothing returns nothing
call DisableTrigger( gg_trg_OnKeyUp )
call DisableTrigger( gg_trg_OnKeyLeft )
call DisableTrigger( gg_trg_OnKeyRight )
call DisableTrigger( gg_trg_OnKeyDown )
call RectChange()
call EnableTrigger( gg_trg_OffKeUp )
endfunction
//===========================================================================
function InitTrig_OnKeyUp takes nothing returns nothing
set gg_trg_OnKeyUp = CreateTrigger( )
call DisableTrigger( gg_trg_OnKeyUp )
call TriggerRegisterPlayerKeyEventBJ( gg_trg_OnKeyUp, Player(6), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_UP )
call TriggerAddCondition( gg_trg_OnKeyUp, Condition( function Trig_OnKeyUp_Conditions ) )
call TriggerAddAction( gg_trg_OnKeyUp, function Trig_OnKeyUp_Actions )
endfunction
//===========================================================================
// Trigger: OffKeUp
//===========================================================================
function Trig_OffKeUp_Func002C takes nothing returns boolean
if ( not ( udg_bGameEnd == false ) ) then
return false
endif
return true
endfunction
function Trig_OffKeUp_Actions takes nothing returns nothing
call DisableTrigger( gg_trg_OffKeUp )
if ( Trig_OffKeUp_Func002C() ) then
call EnableTrigger( gg_trg_OnKeyLeft )
call EnableTrigger( gg_trg_OnKeyRight )
call EnableTrigger( gg_trg_OnKeyUp )
call EnableTrigger( gg_trg_OnKeyDown )
else
call DoNothing( )
endif
endfunction
//===========================================================================
function InitTrig_OffKeUp takes nothing returns nothing
set gg_trg_OffKeUp = CreateTrigger( )
call DisableTrigger( gg_trg_OffKeUp )
call TriggerRegisterPlayerKeyEventBJ( gg_trg_OffKeUp, Player(6), bj_KEYEVENTTYPE_RELEASE, bj_KEYEVENTKEY_UP )
call TriggerAddAction( gg_trg_OffKeUp, function Trig_OffKeUp_Actions )
endfunction
//===========================================================================
// Trigger: GameStart
//===========================================================================
function Trig_GameStart_Conditions takes nothing returns boolean
if ( not ( udg_bGameEnd == true ) ) then
return false
endif
return true
endfunction
function Trig_GameStart_Actions takes nothing returns nothing
set udg_bFlash = false
set udg_iLevel = 1
set udg_iPerformance = 0
call SetScore(udg_iPerformance)
call SetLevel(udg_iLevel)
set udg_isBottom = true
set udg_Up = false
set udg_bGameEnd = false
set udg_bABrun = false
call InvalidateRect()
set udg_LevelTime = 1.00
call CameraSetupApplyForPlayer( true, gg_cam_center, Player(6), 0 )
call SetCameraTargetControllerNoZForPlayer( Player(6), udg_CenterUnit, 0, 0, false )
call ShowInterfaceForceOff( GetPlayersAll(), 4.19 )
call PlaySoundBJ( gg_snd_bigin )
call WaitForSoundBJ( gg_snd_bigin, 0 )
call SetUserControlForceOn( GetPlayersAll() )
call TimerStart(udg_GTimer,udg_LevelTime,true,function OnTimer)
call EnableTrigger( gg_trg_OnKeyLeft )
call EnableTrigger( gg_trg_OnKeyRight )
call EnableTrigger( gg_trg_OnKeyUp )
call EnableTrigger( gg_trg_OnKeyDown )
call ClearMapMusicBJ( )
call SetMapMusicIndexedBJ( gg_snd_russia, 0 )
call PlayMusicBJ( gg_snd_russia )
endfunction
//===========================================================================
function InitTrig_GameStart takes nothing returns nothing
set gg_trg_GameStart = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_GameStart, Player(6), "START", true )
call TriggerAddCondition( gg_trg_GameStart, Condition( function Trig_GameStart_Conditions ) )
call TriggerAddAction( gg_trg_GameStart, function Trig_GameStart_Actions )
endfunction
//===========================================================================
function InitCustomTriggers takes nothing returns nothing
call InitTrig________________u( )
call InitTrig_OnKeyLeft( )
call InitTrig_OffKeyLeft( )
call InitTrig_left( )
call InitTrig_OnKeyRight( )
call InitTrig_OffKeRight( )
call InitTrig_right( )
call InitTrig_OnKeyDown( )
call InitTrig_OffKeDown( )
call InitTrig_down( )
call InitTrig_OnKeyUp( )
call InitTrig_OffKeUp( )
call InitTrig_GameStart( )
endfunction
//===========================================================================
function RunInitializationTriggers takes nothing returns nothing
call ConditionalTriggerExecute( gg_trg________________u )
endfunction
//***************************************************************************
//*
//* Players
//*
//***************************************************************************
function InitCustomPlayerSlots takes nothing returns nothing
// Player 6
call SetPlayerStartLocation( Player(6), 0 )
call ForcePlayerStartLocation( Player(6), 0 )
call SetPlayerColor( Player(6), ConvertPlayerColor(6) )
call SetPlayerRacePreference( Player(6), RACE_PREF_HUMAN )
call SetPlayerRaceSelectable( Player(6), false )
call SetPlayerController( Player(6), MAP_CONTROL_USER )
endfunction
function InitCustomTeams takes nothing returns nothing
// Force: TRIGSTR_006
call SetPlayerTeam( Player(6), 0 )
endfunction
//***************************************************************************
//*
//* Main Initialization
//*
//***************************************************************************
//===========================================================================
function main takes nothing returns nothing
call SetCameraBounds( -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM) )
call SetDayNightModels( "Environment\\\\DNC\\\\DNCLordaeron\\\\DNCLordaeronTerrain\\\\DNCLordaeronTerrain.mdl", "Environment\\\\DNC\\\\DNCLordaeron\\\\DNCLordaeronUnit\\\\DNCLordaeronUnit.mdl" )
call NewSoundEnvironment( "Default" )
call SetAmbientDaySound( "IceCrownDay" )
call SetAmbientNightSound( "IceCrownNight" )
call SetMapMusic( "Music", true, 0 )
call InitSounds( )
call CreateCameras( )
call CreateAllUnits( )
call InitBlizzard( )
call InitGlobals( )
call InitCustomTriggers( )
call RunInitializationTriggers( )
endfunction
//***************************************************************************
//*
//* Map Configuration
//*
//***************************************************************************
function config takes nothing returns nothing
call SetMapName( "TRIGSTR_001" )
call SetMapDescription( "TRIGSTR_003" )
call SetPlayers( 1 )
call SetTeams( 1 )
call SetGamePlacement( MAP_PLACEMENT_USE_MAP_SETTINGS )
call DefineStartLocation( 0, -448.0, -832.0 )
// Player setup
call InitCustomPlayerSlots( )
call InitCustomTeams( )
endfunction
[/jass] |
|