If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!

Notes:Tetris Worlds (Windows)

From The Cutting Room Floor
Jump to navigation Jump to search

This page contains notes for the game Tetris Worlds (Windows).

TWS (Tetris Worlds Script) files

CASCADE.TWS

//   FILE: Cascade Tetris v7.2DP.tws
// SOURCE: Cascade Tetris v7.2DP
//   DATE: Wed, Oct 31, 2001  12:36:11 PM


GeneralInfo
{
	PlayfieldColumns 10
	PlayfieldRows 22
	MaxMovementsPerSecond 15
	MaxRotationsPerSecond 5
	GameType Marathon
	RemoveFromBagAfterUse
	NextPieceQueueSize 8
}

MinoSticky
{
	NotStickyBetweenPieces
	1: 1
	2: 2
	3: 3
	4: 4
	5: 5
	6: 6
	7: 7
}

Mino
{
	Name "J"
	Tags 0,1
}

Mino
{
	Name "T"
	Tags 0,2
}

Mino
{
	Name "S"
	Tags 0,3
}

Mino
{
	Name "Z"
	Tags 0,4
}

Mino
{
	Name "L"
	Tags 0,5
}

Mino
{
	Name "O"
	Tags 0,6
}

Mino
{
	Name "I"
	Tags 0,7
}

Tetramino
{
	Name "T"
	NumberInBag 1
	ID 1
	MinoList
	{
		"T" (0,1)
		"T" (-1,0)
		"T" (0,0)
		"T" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "J"
	NumberInBag 1
	ID 2
	MinoList
	{
		"J" (-1,1)
		"J" (-1,0)
		"J" (0,0)
		"J" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "L"
	NumberInBag 1
	ID 3
	MinoList
	{
		"L" (1,1)
		"L" (-1,0)
		"L" (0,0)
		"L" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "S"
	NumberInBag 1
	ID 4
	MinoList
	{
		"S" (0,1)
		"S" (1,1)
		"S" (-1,0)
		"S" (0,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "Z"
	NumberInBag 1
	ID 5
	MinoList
	{
		"Z" (-1,1)
		"Z" (0,1)
		"Z" (0,0)
		"Z" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "I"
	NumberInBag 1
	ID 6
	MinoList
	{
		"I" (-1,0)
		"I" (0,0)
		"I" (1,0)
		"I" (2,0)
	}
	Rot0CWOffsetList (0,0),(-1,0),(2,0),(-1,0),(2,0)
	Rot90CWOffsetList (-1,0),(0,0),(0,0),(0,1),(0,-2)
	Rot180CWOffsetList (-1,1),(1,1),(-2,1),(1,0),(-2,0)
	Rot270CWOffsetList (0,1),(0,1),(0,1),(0,-1),(0,2)
}

Tetramino
{
	Name "O"
	NumberInBag 1
	ID 7
	MinoList
	{
		"O" (0,1)
		"O" (1,1)
		"O" (0,0)
		"O" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,-1),(0,-1),(0,-1),(0,-1),(0,-1)
	Rot180CWOffsetList (-1,-1),(-1,-1),(-1,-1),(-1,-1),(-1,-1)
	Rot270CWOffsetList (-1,0),(-1,0),(-1,0),(-1,0),(-1,0)
}

Shape
{
	Name "tspin1"
	Hotspot (7,8)
	ShapeCoords (6,9),(6,7),(8,7)
}

Shape
{
	Name "tspin2"
	Hotspot (7,8)
	ShapeCoords (6,7),(8,9),(8,7)
}

Pattern
{
	Name "line clear"
	Tags 0
	Method Search
	SearchType Horizontal
	SearchCount 10
	PatternMinoScript
	{
		kill mino
		sound "FX_CLR01"
	}
	PatternEndScript
	{
		set st1.d3 to st1.d3 + 1
	}
}

GenerationPhase
{
	GenerationTime ((.8-((level-1)*.007))^(level-1))/20
	PieceStartingLocation (4,0)
	GenerationBeginScript
	{
		set pf.d2 to 1
		set pf.d4 to 0
	}
	GenerationEndScript
	{
		set st0.d4 to st0.d4 + 1
	}
}

FallingPhase
{
	FallSpeed (.8-((level-1)*.007))^(level-1)
	SoftDropSpeed ((.8-((level-1)*.007))^(level-1))/20
	HardDropSpeed 0.0001
	MoveTolerance 1
}

LockPhase
{
	MovementRestartsClock
	Duration 0.5
}

PatternPhase
{
}

IteratePhase
{
}

EliminatePhase
{
	FallSpeed 0.05
	EliminateBeginScript
	{
		set ph.d0 to 0
		set ph.d1 to 0
	}
	LineCollapsedScript
	{
		set ph.d0 to ph.d0 + 1
		set ph.d1 to ph.d1 + 1
	}
	GroupLandedScript
	{
		sound "FX_LNE01"
	}
	EliminateEndScript
	{
		if ph.d0 >= 1
			set goal to goal - (ph.d0 + (ph.d0 - 1))
		end
		if ph.d0>0
			if cascades>1
				set goal to goal - ((cascades-1)*2)
			end
		end
		if ph.d0 > st1.d6
			set st1.d6 to ph.d0
		end
		if goal < 0
		 set goal to 0
		end
	}
}

SolidifyPhase
{
}

GravityPhase
{
	GravityEnabled
	FallSpeed 0.05
	GroupLandedScript
	{
		sound "FX_LOCK"
	}
}

CompletionPhase
{
	CompletionBeginScript
	{
		if pl.d8 - goal
		  set pl.d7 to (((pl.d9-goal)/pl.d9)-(level time/120)) * 20
					if pl.d7 > 4
						set pl.d7 to 4
					end
		 mino mood pl.d7
		 set pl.d8 to goal
		end
		if cascades > 0
			set st1.d4 to st1.d4 + cascades
		end
		if st1.d4 > 0
			if (cascades - 1) > st1.d5
				set st1.d5 to (cascades - 1)
			end
		end
		if cascades = 2
		message "2 Cascade"
		line color (109,0,23)
		 sound "FX_MTRS1"
		 sound "VO_CAS02"
		end
		if cascades = 3
		message "3 Cascades"
		line color (39,0,87)
		 sound "FX_MTRS2"
		 sound "VO_CAS03"
		end
		if cascades = 4
		message "4 Cascades"
		line color (39,0,87)
		 sound "FX_MTRS3"
		 sound "VO_CAS04"
		end
		if cascades = 5
		message "5 Cascades"
		line color (116,55,0)
		 sound "FX_MTRS4"
		 sound "VO_CAS05"
		end
		if cascades = 6
		message "6 Cascades"
		line color (116,55,0)
		 sound "FX_MTRS5"
		 sound "VO_CAS06"
		end
		if cascades = 7
		message "7 Cascades"
		line color (0,91,56)
		 sound "FX_MTRS6"
		 sound "VO_CAS07"
		end
		if cascades = 8
			message "8 Cascades"
		line color (0,91,56)
		 sound "FX_MTRS6"
		 sound "VO_CAS08"
		end
		if cascades = 9
			message "9 Cascades"
		line color (118,119,0)
		 sound "FX_MTRS6"
		 sound "VO_CAS09"
		end
		if cascades = 10
			message "10 Cascades"
		line color (118,119,0)
		 sound "FX_MTRS6"
		 sound "VO_CAS10"
		end
		if cascades >= 11
			message "Super Cascade!!!"
		line color (0,36,154)
			sound "VO_AMAZING"
		 sound "FX_MTRS6"
		end
		if goal <= 0
			next level
			if level < 15
				sound "FX_LEVEL"
		 message "LEVEL UP!"
			end
		end
	}
}

EventScripts
{
	GameStartScript
	{
		set st2.d7 to rank
		sound "FX_LEVEL"
		set ghost to 1
		set st0.d4 to 0
		set st0.d5 to 0
		set st0.d7 to 0
		set st0.d8 to 0
		set st1.d3 to 0
		set st1.d4 to 0
		set st1.d5 to 0
		set st1.d6 to 0
		line color (30,30,30)
	}
	LevelStartScript
	{
		set goal to (5*level)
		set st2.d8 to goal
		if level < 5
		 mino intensity low
		 else
		 if level < 10
		  mino intensity medium
		  else
		   mino intensity high
		 end
		end
	}
	LevelEndScript
	{
		if level >= 15
		 sound "VO_EXLNT"
		 win
		end
	}
	MoveSuccessfulScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	MoveFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	RotateSuccessfulScript
	{
		sound "FX_RTA01"
		set st0.d5 to st0.d5 + 1
	}
	RotateFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	HardDropStartScript
	{
		sound "FX_HRDDP"
		set st0.d5 to st0.d5 + 1
		set pf.d2 to 0
	}
	SoftDropStepScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	FallStepScript
	{
		sound "FX_FALL"
	}
	TouchdownScript
	{
		if pf.d2
		 sound "FX_LND01"
		end
	}
	LockdownScript
	{
		if pf.d2
		 sound "FX_LCK01"
		end
		if piece.id = 1
			if spin
				shape "T-spin1" at piece.x, piece.y
				if result = 1
		   if level < 6
		    sound "VO_TSPIN"
		   else
		    sound "FX_RWD01"
		   end
		   set goal to goal -1 
					set pf.d4 to 1
				else
					shape "T-spin2" at piece.x, piece.y
					if result = 1
		    if level < 6
		     sound "VO_TSPIN"
		    else
		     sound "FX_RWD01"
		    end
		    set goal to goal -1 
						set pf.d4 to 1
					end
				end
			end
		end
	}
	GameSecondScript
	{
		set st0.d8 to game time
	}
	LevelSecondScript
	{
		set st0.d7 to level time
	}
}

CustomEvent
{
	Name "Cascade Intro"
	TriggerType LevelTime 3
	Script
	{
		if level < 4
		 sound "VO_INT02"
		end
	}
}

CustomEvent
{
	Name "30sec"
	TriggerType LevelTime 90
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_30TIC"
				end
			end
		end
	}
}

CustomEvent
{
	Name "20sec"
	TriggerType LevelTime 100
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_20TIC"
				end
			end
		end
	}
}

CustomEvent
{
	Name "10sec"
	TriggerType LevelTime 110
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_10TIC"
				end
			end
		end
		sound "FX_TIC10"
	}
}

CustomEvent
{
	Name "9sec"
	TriggerType LevelTime 111
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_09TIC"
				end
			end
		end
		sound "FX_TIC09"
	}
}

CustomEvent
{
	Name "8sec"
	TriggerType LevelTime 112
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_08TIC"
				end
			end
		end
		sound "FX_TIC08"
	}
}

CustomEvent
{
	Name "7sec"
	TriggerType LevelTime 113
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_07TIC"
				end
			end
		end
		sound "FX_TIC07"
	}
}

CustomEvent
{
	Name "6sec"
	TriggerType LevelTime 114
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_06TIC"
				end
			end
		end
		sound "FX_TIC06"
	}
}

CustomEvent
{
	Name "5sec"
	TriggerType LevelTime 115
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_05TIC"
				end
			end
		end
		sound "FX_TIC05"
	}
}

CustomEvent
{
	Name "4sec"
	TriggerType LevelTime 116
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_04TIC"
				end
			end
		end
		sound "FX_TIC04"
	}
}

CustomEvent
{
	Name "3sec"
	TriggerType LevelTime 117
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_03TIC"
				end
			end
		end
		sound "FX_TIC03"
	}
}

CustomEvent
{
	Name "2sec"
	TriggerType LevelTime 118
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_02TIC"
				end
			end
		end
		sound "FX_TIC02"
	}
}

CustomEvent
{
	Name "1sec"
	TriggerType LevelTime 119
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_01TIC"
				end
			end
		end
		sound "FX_TIC01"
	}
}

CustomEvent
{
	Name "Time Up"
	TriggerType LevelTime 120
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_OVRTIME"
				end
			end
		end
	}
}

CustomEvent
{
	Name "Countdown"
	TriggerType LevelTime 108
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_COUNTDWN"
				end
			end
		end
	}
}

CustomEvent
{
	Name "Go for a Rank Up"
	TriggerType LevelTime 1
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					message "GO FOR A RANK UP!!!"
				end
			end
		end
	}
}

CONNECT.TWS

//   FILE: Fusion Tetris v7.2DP.tws
// SOURCE: Fusion Tetris v7.2DP
//   DATE: Wed, Oct 31, 2001  12:36:25 PM


GeneralInfo
{
	PlayfieldColumns 10
	PlayfieldRows 22
	MaxMovementsPerSecond 15
	MaxRotationsPerSecond 5
	GameType Marathon
	RemoveFromBagAfterUse
	NextPieceQueueSize 8
}

MinoSticky
{
	NotStickyBetweenPieces
	1: 1
	2: 2
	3: 3
	4: 4
	5: 5
	6: 6
	7: 7
}

Mino
{
	Name "J"
	Tags 0,1
	MutateMino "Solo Blue"
}

Mino
{
	Name "S"
	Tags 0,2
	MutateMino "Solo Green"
}

Mino
{
	Name "O"
	Tags 0,3
	MutateMino "Solo Yellow"
}

Mino
{
	Name "L"
	Tags 0,4
	MutateMino "Solo Orange"
}

Mino
{
	Name "T"
	Tags 0,5
	MutateMino "Solo Cyan"
}

Mino
{
	Name "I"
	Tags 0,6
	MutateMino "Solo Purple"
}

Mino
{
	Name "Z"
	Tags 0,7
	MutateMino "Solo Red"
}

Mino
{
	Name "Gold"
	Tags 0,10
	MutateMino "Red"
	D0 1
	D1 1
}

Mino
{
	Name "Red"
	Tags 0,11
	D0 1
}

Mino
{
	Name "Garbage"
	Antigravity
	Tags 0,31
}

Mino
{
	Name "Solo Blue"
	Tags 0,20
}

Mino
{
	Name "Solo Green"
	Tags 0,21
}

Mino
{
	Name "Solo Yellow"
	Tags 0,22
}

Mino
{
	Name "Solo Orange"
	Tags 0,23
}

Mino
{
	Name "Solo Cyan"
	Tags 0,24
}

Mino
{
	Name "Solo Purple"
	Tags 0,25
}

Mino
{
	Name "Solo Red"
	Tags 0,26
}

Tetramino
{
	Name "T"
	NumberInBag 1
	ID 1
	MinoList
	{
		"T" (0,1)
		"T" (-1,0)
		"T" (0,0)
		"T" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "J"
	NumberInBag 1
	ID 2
	MinoList
	{
		"J" (-1,1)
		"J" (-1,0)
		"J" (0,0)
		"J" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "L"
	NumberInBag 1
	ID 3
	MinoList
	{
		"L" (1,1)
		"L" (-1,0)
		"L" (0,0)
		"L" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "S"
	NumberInBag 1
	ID 4
	MinoList
	{
		"S" (0,1)
		"S" (1,1)
		"S" (-1,0)
		"S" (0,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "Z"
	NumberInBag 1
	ID 5
	MinoList
	{
		"Z" (-1,1)
		"Z" (0,1)
		"Z" (0,0)
		"Z" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "I"
	NumberInBag 1
	ID 6
	MinoList
	{
		"I" (-1,0)
		"I" (0,0)
		"I" (1,0)
		"I" (2,0)
	}
	Rot0CWOffsetList (0,0),(-1,0),(2,0),(-1,0),(2,0)
	Rot90CWOffsetList (-1,0),(0,0),(0,0),(0,1),(0,-2)
	Rot180CWOffsetList (-1,1),(1,1),(-2,1),(1,0),(-2,0)
	Rot270CWOffsetList (0,1),(0,1),(0,1),(0,-1),(0,2)
}

Tetramino
{
	Name "O"
	NumberInBag 1
	ID 7
	MinoList
	{
		"O" (0,1)
		"O" (1,1)
		"O" (0,0)
		"O" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,-1),(0,-1),(0,-1),(0,-1),(0,-1)
	Rot180CWOffsetList (-1,-1),(-1,-1),(-1,-1),(-1,-1),(-1,-1)
	Rot270CWOffsetList (-1,0),(-1,0),(-1,0),(-1,0),(-1,0)
}

Tetramino
{
	Name "One"
	NumberInBag 3
	ID 8
	MinoList
	{
		"Gold" (0,0)
	}
	Rot0CWOffsetList (0,0)
	Rot90CWOffsetList (0,0)
	Rot180CWOffsetList (0,0)
	Rot270CWOffsetList (0,0)
}

GarbageInfo
{
	NormalMino "Garbage"
	NormalCount 6
}

Shape
{
	Name "tspin1"
	Hotspot (7,8)
	ShapeCoords (6,9),(6,7),(8,7)
}

Shape
{
	Name "tspin2"
	Hotspot (7,8)
	ShapeCoords (6,7),(8,9),(8,7)
}

Pattern
{
	Name "line clear"
	Tags 0
	Method Search
	SearchType Horizontal
	SearchCount 10
	PatternMinoScript
	{
		if mino.d0 = 0
			kill mino
			sound "FX_CLR01"
		else
			set gravity to 1
		line color (136,147,181)
		end
	}
	PatternEndScript
	{
		sound"FX_SLVRF"
		set st1.d3 to st1.d3 + 1
		set pf.d8 to pf.d8 + 1
		set ph.d0 to 1
	}
}

Pattern
{
	Name "disease"
	Tags 11
	Method Search
	SearchType FloodFill4D
	SearchCount 1
	PatternMinoScript
	{
		pattern "infection" at mino.x, mino.y
	}
}

Pattern
{
	Name "infection"
	Triggered
	Tags 10,11
	Method Search
	SearchType FloodFill4D
	SearchCount 2
	PatternMinoScript
	{
		set st2.d8 to goal
		if mino.d1 = 1
			mutate mino
			sound "FX_FUS02"
		 sound "FX_MTRS4"
			set goal to goal -1
		set st2.d9 to st2.d8 - goal
			set st2.d4 to st2.d4 + 1
			message "Fusion!"
			sound "VO_FUSION"
			if goal <= 0
				set pf.d0 to 1
			end
		end
	}
}

Trash
{
	Name "left"
	Height 1
	MinoList
	{
		"Red" (0,0)
		"Garbage" (2,0)
		"Garbage" (4,0)
		"Garbage" (6,0)
		"Garbage" (8,0)
	}
}

Trash
{
	Name "right"
	Height 1
	MinoList
	{
		"Garbage" (1,0)
		"Garbage" (3,0)
		"Garbage" (5,0)
		"Garbage" (7,0)
		"Red" (9,0)
	}
}

GenerationPhase
{
	GenerationTime ((.8-((level-1)*.007))^(level-1))/20
	PieceStartingLocation (4,0)
	GenerationBeginScript
	{
		set pf.d9 to 0
		set pf.d2 to 1
		set pf.d4 to 0
	}
	GenerationEndScript
	{
		set st0.d4 to st0.d4 + 1
	}
}

FallingPhase
{
	FallSpeed (.8-((level-1)*.007))^(level-1)
	SoftDropSpeed ((.8-((level-1)*.007))^(level-1))/20
	HardDropSpeed 0.0001
	MoveTolerance 1
}

LockPhase
{
	MovementRestartsClock
	Duration 0.5
}

PatternPhase
{
	PatternBeginScript
	{
		set pf.d8 to 0
		set pf.d0 to 0
		set ph.d0 to 0
	}
	PatternEndScript
	{
		if ph.d0 = 1
			set pf.d9 to pf.d9 + 1
		end
	}
}

IteratePhase
{
	IterateBeginScript
	{
		set st2.d5 to 0
	}
	PrimaryIterator
	{
		IteratorExpression pf.d0 = 1
		MinoIteratorScript
		{
			kill mino
			sound "FX_LOCK"
			sound "VO_LEVELUP"
		}
	}
	SecondaryIterator
	{
		MinoIteratorScript
		{
			if mino.d1 = 1
			 set st2.d5 to st2.d5 + 1
			end
		}
	}
}

EliminatePhase
{
	FallSpeed 0.05
	EliminateBeginScript
	{
		set ph.d0 to pf.d8
	}
	GroupLandedScript
	{
		sound "FX_LNE01"
	}
	EliminateEndScript
	{
		if ph.d0 > st1.d6
			set st1.d6 to ph.d0
		end
		if goal < 0
		 set goal to 0
		end
	}
}

SolidifyPhase
{
}

GravityPhase
{
	FallSpeed 0.05
	GroupLandedScript
	{
		sound "FX_LOCK"
	}
	GravityEndScript
	{
		set gravity to 0
	}
}

CompletionPhase
{
	CompletionBeginScript
	{
		if pl.d8 - goal
		  set pl.d7 to (((pl.d9-goal)/pl.d9)-(level time/120)) * 20
					if pl.d7 > 4
						set pl.d7 to 4
					end
		 mino mood pl.d7
		 set pl.d8 to goal
		end
			set st1.d4 to st1.d4 + pf.d9
		if st1.d4 > 0
			if pf.d9 > st1.d5
				set st1.d5 to pf.d9
			end
		end
		if pf.d9 = 2
		message "2 Cascades"
		line color (109,0,23)
		end
		if pf.d9 = 3
		message "3 Cascades"
		line color (39,0,87)
		end
		if pf.d9 = 4
		message "4 Cascades"
		line color (39,0,87)
		end
		if pf.d9 = 5
		message "5 Cascades"
		line color (116,55,0)
		end
		if pf.d9 = 6
		message "6 Cascades"
		line color (116,55,0)
		end
		if pf.d9 = 7
		message "7 Cascades"
		line color (0,91,56)
		end
		if pf.d9 = 8
			message "8 Cascades"
		line color (0,91,56)
		end
		if pf.d9 = 9
			message "9 Cascades"
		line color (118,119,0)
		end
		if pf.d9 = 10
			message "10 Cascades"
		line color (118,119,0)
		end
		if pf.d9 >= 11
			message "Super Cascade!!!"
		line color (0,36,154)
		end
		if goal <= 0
			next level
			if level < 15
				sound "FX_LEVEL"
			end
		end
	}
}

EventScripts
{
	GameStartScript
	{
		set st2.d7 to rank
		sound "FX_LEVEL"
		set ghost to 1
		set st2.d4 to 0
		set st2.d5 to 0
		set st0.d4 to 0
		set st0.d5 to 0
		set st0.d7 to 0
		set st0.d8 to 0
		set st1.d3 to 0
		set st1.d4 to 0
		set st1.d5 to 0
		set st1.d6 to 0
		line color (30,30,30)
	}
	LevelStartScript
	{
		set st2.d4 to 0
		if level < 5
		 mino intensity low
		 else
		 if level < 10
		  mino intensity medium
		  else
		   mino intensity high
		 end
		end
		mixed garbage level
		if ((level/2) - (level\2)) = 0
			trash "left"
		else
			trash "right"
		end
		set pf.d6 to level * 2
		set goal to pf.d6
		set pf.d7 to 0
		set pl.d9 to goal
		set pl.d8 to goal
	}
	LevelEndScript
	{
		if level >= 15
		 sound "VO_EXLNT"
		 win
		end
	}
	MoveSuccessfulScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	MoveFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	RotateSuccessfulScript
	{
		sound "FX_RTA01"
		set st0.d5 to st0.d5 + 1
	}
	RotateFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	HardDropStartScript
	{
		sound "FX_HRDDP"
		set st0.d5 to st0.d5 + 1
		set pf.d2 to 0
	}
	SoftDropStepScript
	{
		sound"FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	FallStepScript
	{
		sound "FX_FALL"
	}
	TouchdownScript
	{
		if pf.d2
		 sound "FX_LND01"
		end
	}
	LockdownScript
	{
		if pf.d2
		 sound "FX_LCK01"
		end
		if piece.id = 1
			if spin
				shape "T-spin1" at piece.x, piece.y
				if result = 1
		   if level < 6
		    sound "VO_TSPIN"
		   else
		    sound "FX_RWD01"
		   end 
					set pf.d4 to 1
				else
					shape "T-spin2" at piece.x, piece.y
					if result = 1
		    if level < 6
		     sound "VO_TSPIN"
		    else
		     sound "FX_RWD01"
		    end 
						set pf.d4 to 1
					end
				end
			end
		end
	}
	GameSecondScript
	{
		set st0.d8 to game time
	}
	LevelSecondScript
	{
		set st0.d7 to level time
	}
}

CustomEvent
{
	Name "30sec"
	TriggerType LevelTime 90
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_30TIC"
				end
			end
		end
	}
}

CustomEvent
{
	Name "20sec"
	TriggerType LevelTime 100
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_20TIC"
				end
			end
		end
	}
}

CustomEvent
{
	Name "10sec"
	TriggerType LevelTime 110
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_10TIC"
				end
			end
		end
		sound "FX_TIC10"
	}
}

CustomEvent
{
	Name "9sec"
	TriggerType LevelTime 111
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_09TIC"
				end
			end
		end
		sound "FX_TIC09"
	}
}

CustomEvent
{
	Name "8sec"
	TriggerType LevelTime 112
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_08TIC"
				end
			end
		end
		sound "FX_TIC08"
	}
}

CustomEvent
{
	Name "7sec"
	TriggerType LevelTime 113
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_07TIC"
				end
			end
		end
		sound "FX_TIC07"
	}
}

CustomEvent
{
	Name "6sec"
	TriggerType LevelTime 114
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_06TIC"
				end
			end
		end
		sound "FX_TIC06"
	}
}

CustomEvent
{
	Name "5sec"
	TriggerType LevelTime 115
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_05TIC"
				end
			end
		end
		sound "FX_TIC05"
	}
}

CustomEvent
{
	Name "4sec"
	TriggerType LevelTime 116
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_04TIC"
				end
			end
		end
		sound "FX_TIC04"
	}
}

CustomEvent
{
	Name "3sec"
	TriggerType LevelTime 117
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_03TIC"
				end
			end
		end
		sound "FX_TIC03"
	}
}

CustomEvent
{
	Name "2sec"
	TriggerType LevelTime 118
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_02TIC"
				end
			end
		end
		sound "FX_TIC02"
	}
}

CustomEvent
{
	Name "1sec"
	TriggerType LevelTime 119
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_01TIC"
				end
			end
		end
		sound "FX_TIC01"
	}
}

CustomEvent
{
	Name "Time Up"
	TriggerType LevelTime 120
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_OVRTIME"
				end
			end
		end
	}
}

CustomEvent
{
	Name "Intro"
	TriggerType LevelTime 3
	Script
	{
		if level < 4
			sound "VO_INT04"
		end
	}
}

CustomEvent
{
	Name "Countdown"
	TriggerType LevelTime 108
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_COUNTDWN"
				end
			end
		end
	}
}

CustomEvent
{
	Name "Go for a Rank Up"
	TriggerType LevelTime 1
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					message "GO FOR A RANK UP!!!"
				end
			end
		end
	}
}

ENDURE.TWS

//   FILE: TET2001.TWS
// SOURCE: Tetris v4.8DP
//   DATE: Thu, Aug 9, 2001  1:11:21 PM


GeneralInfo
{
	PlayfieldColumns 10
	PlayfieldRows 22
	MaxMovementsPerSecond 10
	MaxRotationsPerSecond 5
	GameType Marathon
	RemoveFromBagAfterUse
	NextPieceQueueSize 8
}

MinoSticky
{
	1: 20
	2: 20
	3: 20
	4: 20
	5: 20
	6: 20
	7: 7
}

Mino
{
	Name "J color"
	Tags 0,1
}

Mino
{
	Name "L color"
	Tags 0,2
}

Mino
{
	Name "S color"
	Tags 0,3
}

Mino
{
	Name "Z color"
	Tags 0,4
}

Mino
{
	Name "O color"
	Tags 0,5
}

Mino
{
	Name "T color"
	Tags 0,6
}

Mino
{
	Name "I color"
	Tags 0,7
}

Mino
{
	Name "Garbage"
	Tags 0,31
}

Tetramino
{
	Name "T Tetrimino"
	NumberInBag 1
	ID 1
	MinoList
	{
		"T color" (0,1)
		"T color" (-1,0)
		"T color" (0,0)
		"T color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "J Tetrimino"
	NumberInBag 1
	ID 2
	MinoList
	{
		"J color" (-1,1)
		"J color" (-1,0)
		"J color" (0,0)
		"J color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "L Tetrimino"
	NumberInBag 1
	ID 3
	MinoList
	{
		"L color" (1,1)
		"L color" (-1,0)
		"L color" (0,0)
		"L color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "S Tetrimino"
	NumberInBag 1
	ID 4
	MinoList
	{
		"S color" (0,1)
		"S color" (1,1)
		"S color" (-1,0)
		"S color" (0,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "Z Tetrimino"
	NumberInBag 1
	ID 5
	MinoList
	{
		"Z color" (-1,1)
		"Z color" (0,1)
		"Z color" (0,0)
		"Z color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "I Tetrimino"
	NumberInBag 6
	ID 6
	MinoList
	{
		"I color" (-1,0)
		"I color" (0,0)
		"I color" (1,0)
		"I color" (2,0)
	}
	Rot0CWOffsetList (0,0),(-1,0),(2,0),(-1,0),(2,0)
	Rot90CWOffsetList (-1,0),(0,0),(0,0),(0,1),(0,-2)
	Rot180CWOffsetList (-1,1),(1,1),(-2,1),(1,0),(-2,0)
	Rot270CWOffsetList (0,1),(0,1),(0,1),(0,-1),(0,2)
}

Tetramino
{
	Name "O Tetrimino"
	NumberInBag 1
	ID 7
	MinoList
	{
		"O color" (0,1)
		"O color" (1,1)
		"O color" (0,0)
		"O color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,-1),(0,-1),(0,-1),(0,-1),(0,-1)
	Rot180CWOffsetList (-1,-1),(-1,-1),(-1,-1),(-1,-1),(-1,-1)
	Rot270CWOffsetList (-1,0),(-1,0),(-1,0),(-1,0),(-1,0)
}

GarbageInfo
{
	NormalMino "Garbage"
	NormalCount 9
}

Shape
{
	Name "T-spin1"
	Hotspot (7,8)
	ShapeCoords (6,9),(6,7),(8,7)
}

Shape
{
	Name "T-spin2"
	Hotspot (7,8)
	ShapeCoords (6,7),(8,9),(8,7)
}

Pattern
{
	Name "Line clear"
	Tags 0
	Method Search
	SearchType Horizontal
	SearchCount 1
	PatternMinoScript
	{

		if (pl.d3)

			if (mino.y < 8)
				kill mino
				set ph.d0 to 2
			end

			if (mino.id = pl.d4)
				kill mino
			end

			set ph.d0 to 3

		end

	}
}

Level
{
	Name "Level #1"
}

Level
{
	Name "Level #2"
}

Level
{
	Name "Level #3"
}

Level
{
	Name "Level #4"
}

Level
{
	Name "Level #5"
}

Level
{
	Name "Level #6"
}

Level
{
	Name "Level #7"
}

Level
{
	Name "Level #8"
}

Level
{
	Name "Level #9"
}

Level
{
	Name "Level #10"
}

Level
{
	Name "Level #11"
}

Level
{
	Name "Level #12"
}

Level
{
	Name "Level #13"
}

Level
{
	Name "Level #14"
}

Level
{
	Name "Level #15"
}

GenerationPhase
{
	GenerationTime ((.8-((level-1)*.007))^(level-1))/20
	PieceStartingLocation (4,0)
	GenerationBeginScript
	{
		set pf.d2 to 1
		set pf.d4 to 0
	}
}

FallingPhase
{
	FallSpeed	0.05
								// original fall speed (.8-((level-1)*.007))^(level-1)

	SoftDropSpeed ((.8-((level-1)*.007))^(level-1))/20
	HardDropSpeed 0.0001
	MoveTolerance 1
}

LockPhase
{
	MovementRestartsClock
	Duration 0.5
}

PatternPhase
{
}

//Increase intensity as well fills up
IteratePhase
{
	IterateBeginScript		
	{
		set pl.d7 to 30
	}

	PrimaryIterator					
	{
		MinoIteratorScript	
		{
			if (mino.y < pl.d7)
				set pl.d7 to mino.y		
			end
		}
	}

	IterateEndScript
	{
		// pl.d2 stores old height
		// pl.d7 is new height

		if (pl.d2 - pl.d7)
			if (pl.d7 < 6)
			
				//Activate endurance clear
				set pl.d3 to 1

				set ph.d0 to 1

				set goal to goal - 4

				set pl.d4 to pl.d4 + 1

				if (pl.d4 > 6)
					set pl.d4 to 0
				end

				if (goal < 10)
					set pl.d4 to 7
				end

				if (pl.d1 = 0)
					mino intensity high
					set pl.d1 to 1

				end
			else

				set pl.d3 to 0

			end
			set pl.d2 to pl.d7
		end
	}
}

EliminatePhase
{
	FallSpeed 0.05
	LineCollapsedScript
	{
	}
	GroupLandedScript
	{
		sound "FX_LNE01"
	}
	EliminateEndScript
	{
		if ph.d0 = 1
		 if level < 6
		  sound "VO_LINE01"
		 end
		 sound "FX_LNE01"
			sound "FX_MTRS1"
		 set goal to goal -1
		 set pf.d3 to 0
		 if pf.d4
		  set goal to goal -1
		 end
		end
		if ph.d0 = 2
		 if level < 6
		  sound "VO_LINE02"
		 end
			sound "FX_LNE02"
			sound "FX_MTRS2"
			set goal to goal -3 
		 set pf.d3 to 0
		 if pf.d4
		  set goal to goal -3
		 end
			send "Attack1"
		end
		if ph.d0 = 3
		 if level < 6
		  sound "VO_LINE03"
		 end
			sound "FX_LNE03"
			sound "FX_MTRS3"
			set goal to goal -5
		 set pf.d3 to 0
			send "Attack2"
		end
		if ph.d0 = 4
		 if level < 11
		  sound "VO_TETRS"
		 end
			sound "FX_LNE04"
			sound "FX_MTRS4"
		 if pf.d3
		  set goal to goal -4
		  	sound "FX_MTRS5"
		 end
		 set pf.d3 to 1
		 set goal to goal -8
			send "Attack3"
		end
		if goal < 0
		 set goal to 0
		end
	}
}

SolidifyPhase
{
}

GravityPhase
{
	GravityEnabled				
	FallSpeed 0.05
	GroupLandedScript
	{
		sound "FX_LOCK"
	}
}

CompletionPhase
{
	CompletionBeginScript
	{
		//Calc Mino Mood

		//pl.d7 is only used in this phase - feel free to re-use it
		//pl.d8 is the last goal

		if pl.d8 - goal
		  set pl.d7 to pl.d8 - goal
		  if (pl.d7 > 5)
			set pl.d7 to 5
		  end
		  if (pl.d7 < -5)
			set pl.d7 to -5
		  end
		  mino mood pl.d7
		  set pl.d8 to goal
		end

		//LEVEL UP
		if goal <= 0
			next level
			if (level < 5)
				mino mood level
			else 
				mino mood 5
			end

			message "Level up"
		end
	}
}

EventScripts
{
	GameStartScript
	{
		set ghost to 1
	}
	LevelStartScript
	{
		set pf.d3 to 0
		set pf.d1 to (5*level)
		set goal to pf.d1
		set pf.d7 to 0			// nothing - used in mood calculations and height calculations
		set pl.d8 to goal		// last goal
		set pl.d1 to 0			// Intensity based on time
		set pl.d2 to 50			// Last well height
		set pl.d3 to 0		//Endurance - will eliminate everything if true

		set pl.d4 to 0
	}
	LevelEndScript
	{
		if level >= 15
		 sound "VO_EXLNT"
		 mino mood 5
		end
	}
	MoveSuccessfulScript
	{
		sound "FX_FALL"
	}
	MoveFailedScript
	{
		sound "FX_LND01"
	}
	RotateSuccessfulScript
	{
		sound "FX_RTA01"
	}
	RotateFailedScript
	{
		sound "FX_LND01"
	}
	HardDropStartScript
	{
		sound "FX_HRDDP"
		set pf.d2 to 0
	}
	SoftDropStepScript
	{
		sound "FX_FALL"
	}
	FallStepScript
	{
		sound "FX_FALL"
	}
	TouchdownScript
	{
		if pf.d2
		 sound "FX_LND01"
		end
	}
	LockdownScript
	{
		if pf.d2
		 sound "FX_LCK01"
		end
		if piece.id = 1
			if spin
				shape "T-spin1" at piece.x, piece.y
				if result = 1
		   if level < 6
		    sound "VO_TSPIN"
		   else
		    sound "FX_RWD01"
		   end
		   set goal to goal -1 
					set pf.d4 to 1
				else
					shape "T-spin2" at piece.x, piece.y
					if result = 1
		    if level < 6
		     sound "VO_TSPIN"
		    else
		     sound "FX_RWD01"
		    end
		    set goal to goal -1 
						set pf.d4 to 1
					end
				end
			end
		end

	}

	GameSecondScript
	{
		if pl.d0 > 0
			mix garbage
			garbage pl.d0
			set pl.d0 to 0
		end

		message pl.d9 "Tick "
		set pl.d9 to pl.d9 + 1
	}
}

CustomEvent
{
	//10 seconds into game set intensity to low 
	// Doing it at level start will interrupt victory win
	Name "110 seconds"
	TriggerType LevelTime 10
	Script
	{
		mino intensity low
	}
}

CustomEvent
{
	Name "60 seconds"
	TriggerType LevelTime 60
	Script
	{
		mino intensity medium
	}
}

CustomEvent
{
	Name "30 seconds"
	TriggerType LevelTime 90
	Script
	{
		sound "VO_30TIC"
	}
}

CustomEvent
{
	Name "20 seconds"
	TriggerType LevelTime 100
	Script
	{
		sound "VO_20TIC"
	}
}

CustomEvent
{
	Name "10 seconds"
	TriggerType LevelTime 110
	Script
	{
		sound "VO_10TIC"
		mino mood -2
		mino intensity high
	}
}

CustomEvent
{
	Name "9 seconds"
	TriggerType LevelTime 111
	Script
	{
		sound "VO_09TIC"
	}
}

CustomEvent
{
	Name "8 seconds"
	TriggerType LevelTime 112
	Script
	{
		sound "VO_08TIC"
	}
}

CustomEvent
{
	Name "7 seconds"
	TriggerType LevelTime 113
	Script
	{
		sound "VO_07TIC"
	}
}

CustomEvent
{
	Name "6 seconds"
	TriggerType LevelTime 114
	Script
	{
		sound "VO_06TIC"
	}
}

CustomEvent
{
	Name "5 seconds"
	TriggerType LevelTime 115
	Script
	{
		sound "VO_05TIC"
	}
}

CustomEvent
{
	Name "4 seconds"
	TriggerType LevelTime 116
	Script
	{
		sound "VO_04TIC"
	}
}

CustomEvent
{
	Name "3 seconds"
	TriggerType LevelTime 117
	Script
	{
		sound "VO_03TIC"
	}
}

CustomEvent
{
	Name "2 seconds"
	TriggerType LevelTime 118
	Script
	{
		sound "VO_02TIC"
	}
}

CustomEvent
{
	Name "1 second"
	TriggerType LevelTime 119
	Script
	{
		sound "VO_01TIC"
	}
}

CustomEvent
{
	Name "Time up"
	TriggerType LevelTime 120
	Script
	{
		sound "VO_TIME"
		mino mood -5
	}
}

CustomEvent
{
	Name "Go for a Tetris"
	TriggerType GameTime 3
	Script
	{
		sound "VO_INT01"
	}
}

CustomEvent
{
	Name "Attack1"
	TriggerType Manual
	Script
	{
		set pl.d0 to pl.d0 + 1
	}
}

CustomEvent
{
	Name "Attack2"
	TriggerType Manual
	Script
	{
		set pl.d0 to pl.d0 + 2
	}
}

CustomEvent
{
	Name "Attack3"
	TriggerType Manual
	Script
	{
		set pl.d0 to pl.d0 + 4
	}
}

HOTLINE.TWS

//   FILE: Hot-Line Tetris v7.2DP.tws
// SOURCE: Hot-Line Tetris v7.2DP
//   DATE: Wed, Oct 31, 2001  12:36:35 PM


GeneralInfo
{
	PlayfieldColumns 10
	PlayfieldRows 22
	MaxMovementsPerSecond 15
	MaxRotationsPerSecond 5
	GameType Marathon
	RemoveFromBagAfterUse
	NextPieceQueueSize 8
}

MinoSticky
{
	NotStickyBetweenPieces
	1: 1
	2: 2
	3: 3
	4: 4
	5: 5
	6: 6
	7: 7
}

Mino
{
	Name "J"
	Tags 0,1
	AltMino "T"
	AltChance 10
	MutateMino "Solo Blue"
}

Mino
{
	Name "S"
	Tags 0,2
	AltMino "J"
	AltChance 10
	MutateMino "Solo Green"
}

Mino
{
	Name "T"
	Tags 0,3
	AltMino "L"
	AltChance 10
	MutateMino "Solo Cyan"
}

Mino
{
	Name "Z"
	Tags 0,4
	AltMino "O"
	AltChance 10
	MutateMino "Solo Red"
}

Mino
{
	Name "O"
	Tags 0,5
	AltMino "I"
	AltChance 10
	MutateMino "Solo Yellow"
}

Mino
{
	Name "I"
	Tags 0,6
	AltMino "S"
	AltChance 10
	MutateMino "Solo Purple"
}

Mino
{
	Name "L"
	Tags 0,7
	AltMino "Z"
	AltChance 10
	MutateMino "Solo Orange"
}

Mino
{
	Name "Solo Blue"
	Tags 0,20
}

Mino
{
	Name "Solo Green"
	Tags 0,21
}

Mino
{
	Name "Solo Cyan"
	Tags 0,22
}

Mino
{
	Name "Solo Red"
	Tags 0,23
}

Mino
{
	Name "Solo Yellow"
	Tags 0,24
}

Mino
{
	Name "Solo Purple"
	Tags 0,25
}

Mino
{
	Name "Solo Orange"
	Tags 0,26
}

Tetramino
{
	Name "T"
	NumberInBag 1
	ID 1
	MinoList
	{
		"T" (0,1)
		"T" (-1,0)
		"T" (0,0)
		"T" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "S"
	NumberInBag 1
	ID 2
	MinoList
	{
		"S" (0,1)
		"S" (1,1)
		"S" (-1,0)
		"S" (0,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "Z"
	NumberInBag 1
	ID 3
	MinoList
	{
		"Z" (-1,1)
		"Z" (0,1)
		"Z" (0,0)
		"Z" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "L"
	NumberInBag 1
	ID 4
	MinoList
	{
		"L" (1,1)
		"L" (-1,0)
		"L" (0,0)
		"L" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "J"
	NumberInBag 1
	ID 5
	MinoList
	{
		"J" (-1,1)
		"J" (-1,0)
		"J" (0,0)
		"J" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "I"
	NumberInBag 1
	ID 6
	MinoList
	{
		"I" (-1,0)
		"I" (0,0)
		"I" (1,0)
		"I" (2,0)
	}
	Rot0CWOffsetList (0,0),(-1,0),(2,0),(-1,0),(2,0)
	Rot90CWOffsetList (-1,0),(0,0),(0,0),(0,1),(0,-2)
	Rot180CWOffsetList (-1,1),(1,1),(-2,1),(1,0),(-2,0)
	Rot270CWOffsetList (0,1),(0,1),(0,1),(0,-1),(0,2)
}

Tetramino
{
	Name "O"
	NumberInBag 1
	ID 7
	MinoList
	{
		"O" (0,1)
		"O" (1,1)
		"O" (0,0)
		"O" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,-1),(0,-1),(0,-1),(0,-1),(0,-1)
	Rot180CWOffsetList (-1,-1),(-1,-1),(-1,-1),(-1,-1),(-1,-1)
	Rot270CWOffsetList (-1,0),(-1,0),(-1,0),(-1,0),(-1,0)
}

Shape
{
	Name "tspin1"
	Hotspot (7,8)
	ShapeCoords (6,9),(6,7),(8,7)
}

Shape
{
	Name "tspin2"
	Hotspot (7,8)
	ShapeCoords (6,7),(8,9),(8,7)
}

Pattern
{
	Name "line clear"
	Tags 0
	Method Search
	SearchType Horizontal
	SearchCount 10
	PatternMinoScript
	{
		kill mino
		sound "FX_CLR01"
		set ph.d0 to mino.y
	}
	PatternEndScript
	{
		set st2.d8 to goal
		if pf.d0 < 2
			if ph.d0 = 2
				set goal to goal - 6
		set st2.d9 to st2.d8 - goal
		set st2.d3 to st2.d3 + 1
		message "Hotline!!"
				sound "FX_HTLN6"
				sound "FX_MTRS6"
			else
				if ph.d0 = 3
				set goal to goal - 5
		set st2.d9 to st2.d8 - goal
		set st2.d2 to st2.d2 + 1
		message "Hotline!"
				sound "FX_HTLN5"
				sound "FX_MTRS5"
				else
					if ph.d0 = 5
					set goal to goal - 4
		set st2.d9 to st2.d8 - goal
		set st2.d1 to st2.d1 + 1
		message "Hotline"
					sound "FX_HTLN4"
					sound "FX_MTRS4"
					else
						if ph.d0 = 8
						set goal to goal - 3
		set st2.d9 to st2.d8 - goal
		set st2.d0 to st2.d0 + 1
		message "Hotline"
						sound "FX_HTLN3"
						sound "FX_MTRS3"
						else
							if ph.d0 = 12
							set goal to goal - 2
		set st2.d9 to st2.d8 - goal
		set st1.d9 to st1.d9 + 1
		message "Hotline"
							sound "FX_HTLN2"
							sound "FX_MTRS2"
							else
								if ph.d0 = 17
								set goal to goal - 1
		set st2.d9 to st2.d8 - goal
		set st1.d8 to st1.d8 + 1
		message "Hotline"
								sound "FX_HTLN1"
								sound "FX_MTRS1"
								end
							end
						end
					end
				end
			end
			if score >= goal
				set pf.d0 to 1
			end
		end
	}
}

GenerationPhase
{
	GenerationTime ((.8-((level-1)*.007))^(level-1))/20
	PieceStartingLocation (4,0)
	GenerationBeginScript
	{
		set pf.d0 to 0
		set pf.d2 to 1
		set pf.d4 to 0
	}
	GenerationEndScript
	{
		set st0.d4 to st0.d4 + 1
	}
}

FallingPhase
{
	FallSpeed (.8-((level-1)*.007))^(level-1)
	SoftDropSpeed ((.8-((level-1)*.007))^(level-1))/20
	HardDropSpeed 0.0001
	MoveTolerance 1
}

LockPhase
{
	MovementRestartsClock
	Duration 0.5
}

PatternPhase
{
}

IteratePhase
{
	PrimaryIterator
	{
		IteratorExpression pf.d0 = 1
		IteratorTags 1,2,3,4,5,6,7
		MinoIteratorScript
		{
			mutate mino
			sound "FX_LOCK"
		}
	}
	IterateEndScript
	{
		if pf.d0 = 1
			set pf.d0 to 2
		end
	}
}

EliminatePhase
{
	FallSpeed 0.05
	GroupLandedScript
	{
		sound "FX_LNE01"
	}
	EliminateEndScript
	{
		if goal < 0
		 set goal to 0
		end
	}
}

SolidifyPhase
{
}

GravityPhase
{
	GravityEnabled
	FallSpeed 0.05
	GroupLandedScript
	{
		sound "FX_LOCK"
	}
}

CompletionPhase
{
	CompletionBeginScript
	{
		if pl.d8 - goal
		  set pl.d7 to (((pl.d9-goal)/pl.d9)-(level time/120)) * 20
					if pl.d7 > 4
						set pl.d7 to 4
					end
		 mino mood pl.d7
		 set pl.d8 to goal
		end
		if goal <= 0
			next level
			if level < 15
				sound "FX_LEVEL"
		 message "LEVEL UP!"
			end
		end
	}
}

EventScripts
{
	GameStartScript
	{
		set st2.d7 to rank
		sound "FX_LEVEL"
		set ghost to 1
		set st0.d4 to 0
		set st0.d5 to 0
		set st0.d7 to 0
		set st0.d8 to 0
		set st1.d8 to 0
		set st1.d9 to 0
		set st2.d0 to 0
		set st2.d1 to 0
		set st2.d2 to 0
		set st2.d3 to 0
		line color (30,30,30)
		line color 2 (0,36,154)
		line color 3 (39,0,87)
		line color 5 (109,0,23)
		line color 8 (116,55,0)
		line color 12 (118,119,0)
		line color 17 (0,91,56)
	}
	LevelStartScript
	{
		set pf.d1 to (5*level)
		set goal to pf.d1
		if level < 5
		 mino intensity low
		 else
		 if level < 10
		  mino intensity medium
		  else
		   mino intensity high
		 end
		end
	}
	LevelEndScript
	{
		if level >= 15
		 sound "VO_EXLNT"
		 win
		end
	}
	MoveSuccessfulScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	MoveFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	RotateSuccessfulScript
	{
		sound "FX_RTA01"
		set st0.d5 to st0.d5 + 1
	}
	RotateFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	HardDropStartScript
	{
		sound "FX_HRDDP"
		set st0.d5 to st0.d5 + 1
		set pf.d2 to 0
	}
	SoftDropStepScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	FallStepScript
	{
		sound "FX_FALL"
	}
	TouchdownScript
	{
		if pf.d2
		 sound "FX_LND01"
		end
	}
	LockdownScript
	{
		if pf.d2
		 sound "FX_LCK01"
		end
		if piece.id = 1
			if spin
				shape "T-spin1" at piece.x, piece.y
				if result = 1
		   if level < 6
		    sound "VO_TSPIN"
		   else
		    sound "FX_RWD01"
		   end 
					set pf.d4 to 1
				else
					shape "T-spin2" at piece.x, piece.y
					if result = 1
		    if level < 6
		     sound "VO_TSPIN"
		    else
		     sound "FX_RWD01"
		    end
						set pf.d4 to 1
					end
				end
			end
		end
	}
	GameSecondScript
	{
		set st0.d8 to game time
	}
	LevelSecondScript
	{
		set st0.d7 to level time
	}
}

CustomEvent
{
	Name "Hot Line Intro"
	TriggerType LevelTime 3
	Script
	{
		if level < 4
			sound "VO_INT03"
		end
	}
}

CustomEvent
{
	Name "30sec"
	TriggerType LevelTime 90
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_30TIC"
				end
			end
		end
	}
}

CustomEvent
{
	Name "20sec"
	TriggerType LevelTime 100
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_20TIC"
				end
			end
		end
	}
}

CustomEvent
{
	Name "10sec"
	TriggerType LevelTime 110
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_10TIC"
				end
			end
		end
		sound "FX_TIC10"
	}
}

CustomEvent
{
	Name "9sec"
	TriggerType LevelTime 111
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_09TIC"
				end
			end
		end
		sound "FX_TIC09"
	}
}

CustomEvent
{
	Name "8sec"
	TriggerType LevelTime 112
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_08TIC"
				end
			end
		end
		sound "FX_TIC08"
	}
}

CustomEvent
{
	Name "7sec"
	TriggerType LevelTime 113
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_07TIC"
				end
			end
		end
		sound "FX_TIC07"
	}
}

CustomEvent
{
	Name "6sec"
	TriggerType LevelTime 114
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_06TIC"
				end
			end
		end
		sound "FX_TIC06"
	}
}

CustomEvent
{
	Name "5sec"
	TriggerType LevelTime 115
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_05TIC"
				end
			end
		end
		sound "FX_TIC05"
	}
}

CustomEvent
{
	Name "4sec"
	TriggerType LevelTime 116
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_04TIC"
				end
			end
		end
		sound "FX_TIC04"
	}
}

CustomEvent
{
	Name "3sec"
	TriggerType LevelTime 117
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_03TIC"
				end
			end
		end
		sound "FX_TIC03"
	}
}

CustomEvent
{
	Name "2sec"
	TriggerType LevelTime 118
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_02TIC"
				end
			end
		end
		sound "FX_TIC02"
	}
}

CustomEvent
{
	Name "1sec"
	TriggerType LevelTime 119
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_01TIC"
				end
			end
		end
		sound "FX_TIC01"
	}
}

CustomEvent
{
	Name "Time Up"
	TriggerType LevelTime 120
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
		 		sound "VO_OVRTIME"
				end
			end
		end
	}
}

CustomEvent
{
	Name "Countdown"
	TriggerType LevelTime 108
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
				 sound "VO_COUNTDWN"
				end
			end
		end
	}
}

CustomEvent
{
	Name "Go for a Rank Up"
	TriggerType LevelTime 1
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
				 message "GO FOR A RANK UP!!!"
				end
			end
		end
	}
}

LEARNING.TWS

//   FILE: Learning Tetris v7.2DP.tws
// SOURCE: Learning Tetris v7.2DP
//   DATE: Wed, Oct 31, 2001  12:36:46 PM


GeneralInfo
{
	PlayfieldColumns 10
	PlayfieldRows 22
	MaxMovementsPerSecond 15
	MaxRotationsPerSecond 5
	GameType Levels
	NextPieceQueueSize 8
}

MinoSticky
{
	NotStickyBetweenPieces
	1: 1
	2: 2
	3: 3
	4: 4
	5: 5
	6: 6
	7: 7
}

Mino
{
	Name "J color"
	Tags 0,1
}

Mino
{
	Name "L color"
	Tags 0,2
}

Mino
{
	Name "S color"
	Tags 0,3
}

Mino
{
	Name "Z color"
	Tags 0,4
}

Mino
{
	Name "O color"
	Tags 0,5
}

Mino
{
	Name "T color"
	Tags 0,6
}

Mino
{
	Name "I color"
	Tags 0,7
}

Mino
{
	Name "Garbage"
	Tags 0,31
}

Tetramino
{
	Name "T"
	NumberInBag 0
	ID 1
	MinoList
	{
		"T color" (0,1)
		"T color" (-1,0)
		"T color" (0,0)
		"T color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "J"
	NumberInBag 0
	ID 2
	MinoList
	{
		"J color" (-1,1)
		"J color" (-1,0)
		"J color" (0,0)
		"J color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "L"
	NumberInBag 0
	ID 3
	MinoList
	{
		"L color" (1,1)
		"L color" (-1,0)
		"L color" (0,0)
		"L color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "S"
	NumberInBag 0
	ID 4
	MinoList
	{
		"S color" (0,1)
		"S color" (1,1)
		"S color" (-1,0)
		"S color" (0,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "Z"
	NumberInBag 0
	ID 5
	MinoList
	{
		"Z color" (-1,1)
		"Z color" (0,1)
		"Z color" (0,0)
		"Z color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "I"
	NumberInBag 1
	ID 6
	MinoList
	{
		"I color" (-1,0)
		"I color" (0,0)
		"I color" (1,0)
		"I color" (2,0)
	}
	Rot0CWOffsetList (0,0),(-1,0),(2,0),(-1,0),(2,0)
	Rot90CWOffsetList (-1,0),(0,0),(0,0),(0,1),(0,-2)
	Rot180CWOffsetList (-1,1),(1,1),(-2,1),(1,0),(-2,0)
	Rot270CWOffsetList (0,1),(0,1),(0,1),(0,-1),(0,2)
}

Tetramino
{
	Name "O"
	NumberInBag 0
	ID 7
	MinoList
	{
		"O color" (0,1)
		"O color" (1,1)
		"O color" (0,0)
		"O color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,-1),(0,-1),(0,-1),(0,-1),(0,-1)
	Rot180CWOffsetList (-1,-1),(-1,-1),(-1,-1),(-1,-1),(-1,-1)
	Rot270CWOffsetList (-1,0),(-1,0),(-1,0),(-1,0),(-1,0)
}

GarbageInfo
{
	NormalMino "Garbage"
	NormalCount 9
}

Shape
{
	Name "T-spin1"
	Hotspot (7,8)
	ShapeCoords (6,9),(6,7),(8,7)
}

Shape
{
	Name "T-spin2"
	Hotspot (7,8)
	ShapeCoords (6,7),(8,9),(8,7)
}

Pattern
{
	Name "Line clear"
	Tags 0
	Method Search
	SearchType Horizontal
	SearchCount 10
	PatternMinoScript
	{
		kill mino
	}
	PatternEndScript
	{
		sound "FX_CLR01"
	}
}

Level
{
	Name "Level #1"
	LevelStartScript
	{
		set bag "I" to 4
		shuffle 0
		set pf.d9 to 2
	}
}

Level
{
	Name "Level #2"
	LevelStartScript
	{
		set bag "I" to 4
		set bag "O" to 1
		shuffle 0
		set pf.d9 to 2
	}
}

Level
{
	Name "Level #3"
	LevelStartScript
	{
		set bag "I" to 4
		set bag "O" to 2
		set bag "L" to 1
		shuffle 0
		set pf.d9 to 2
	}
}

Level
{
	Name "Level #4"
	LevelStartScript
	{
		set bag "I" to 4
		set bag "O" to 4
		set bag "L" to 2
		set bag "J" to 1
		shuffle 0
		set pf.d9 to 1.8
	}
}

Level
{
	Name "Level #5"
	LevelStartScript
	{
		set bag "I" to 4
		set bag "O" to 4
		set bag "L" to 4
		set bag "J" to 2
		set bag "S" to 1
		shuffle 0
		set pf.d9 to 1.6
	}
}

Level
{
	Name "Level #6"
	LevelStartScript
	{
		set bag "I" to 4
		set bag "O" to 4
		set bag "L" to 4
		set bag "J" to 4
		set bag "S" to 2
		set bag "Z" to 1
		shuffle 0
		set pf.d9 to 1.4
	}
}

Level
{
	Name "Level #7"
	LevelStartScript
	{
		set bag "I" to 4
		set bag "O" to 4
		set bag "L" to 4
		set bag "J" to 4
		set bag "S" to 4
		set bag "Z" to 2
		set bag "T" to 1
		shuffle 0
		set pf.d9 to 1.2
	}
}

Level
{
	Name "Level #8"
	LevelStartScript
	{
		set bag "I" to 4
		set bag "O" to 4
		set bag "L" to 4
		set bag "J" to 4
		set bag "S" to 4
		set bag "Z" to 4
		set bag "T" to 2
		shuffle 0
		set pf.d9 to 1
	}
}

Level
{
	Name "Level #9"
	LevelStartScript
	{
		set bag "I" to 4
		set bag "O" to 4
		set bag "L" to 4
		set bag "J" to 4
		set bag "S" to 4
		set bag "Z" to 4
		set bag "T" to 4
		shuffle 0
		set pf.d9 to 0.8
	}
}

Level
{
	Name "Level #10"
	LevelStartScript
	{
		set bag "I" to 4
		set bag "O" to 4
		set bag "L" to 4
		set bag "J" to 4
		set bag "S" to 4
		set bag "Z" to 4
		set bag "T" to 4
		shuffle 0
		set pf.d9 to 0.6
	}
}

GenerationPhase
{
	GenerationTime ((.8-((level-1)*.007))^(level-1))/20
	PieceStartingLocation (4,0)
	GenerationBeginScript
	{
		set pf.d2 to 1
		set pf.d4 to 0
	}
	GenerationEndScript
	{
		set st0.d4 to st0.d4 + 1
	}
}

FallingPhase
{
	FallSpeed pf.d9
	SoftDropSpeed pf.d9/20
	HardDropSpeed 0.0001
	MoveTolerance 1
}

LockPhase
{
	MovementRestartsClock
	Duration 0.5
}

PatternPhase
{
}

IteratePhase
{
}

EliminatePhase
{
	FallSpeed 0.1
	LineCollapsedScript
	{
		set ph.d0 to ph.d0 + 1
	}
	StartFallingScript
	{
		if ph.d0 = 1
		line color (109,0,23)
		end
		if ph.d0 = 2
		line color (39,0,87)
		end
		if ph.d0 = 3
		line color (116,55,0)
		end
		if ph.d0 = 4
			line color (0,91,56)
		 if pf.d3
				line color (118,119,0)
		 else
		 	set pf.d3 to 1
			end
		end
	}
	GroupLandedScript
	{
		sound "FX_LNE01"
	}
	EliminateEndScript
	{
		set st2.d8 to goal
		if ph.d0 = 1
		 sound "VO_LINE01"
			sound "FX_MTRS1"
		 set goal to goal -1
		set st2.d9  to st2.d8  - goal
			set st0.d0 to st0.d0 + 1
			message st2.d9 "Single +"
		 set pf.d3 to 0
		 if pf.d4
		  set goal to goal -1
		set st2.d9  to st2.d8  - goal
				message st2.d9 "T-spin +"
		 end
		end
		if ph.d0 = 2
		 sound "VO_LINE02"
			sound "FX_MTRS2"
			set goal to goal -3
		set st2.d9  to st2.d8  - goal
			set st0.d1 to st0.d1 + 1
			message st2.d9 "Double +" 
		 set pf.d3 to 0
		 if pf.d4
		  set goal to goal -3
		set st2.d9  to st2.d8  - goal
				message st2.d9 "T-spin +"
		 end
		end
		if ph.d0 = 3
		 sound "VO_LINE03"
			sound "FX_MTRS3"
			set goal to goal -5
		set st2.d9  to st2.d8  - goal
			set st0.d2 to st0.d2 + 1
			message st2.d9 "Triple +"
		 set pf.d3 to 0
		end
		if ph.d0 = 4
		 sound "VO_TETRS"
			sound "FX_MTRS4"
		 if pf.d3
		  set goal to goal -4
		set st2.d9  to st2.d8  - goal
				set st0.d9 to st0.d9 + 1
				message st2.d9 "B2B Tetris!!! +"
		  sound "FX_MTRS5"
		 else
		 	set pf.d3 to 1
				message st2.d9 "Tetris! +"
				end
		 set goal to goal -8
		set st2.d9  to st2.d8  - goal
			set st0.d3 to st0.d3 + 1
		end
		if goal < 0
		 set goal to 0
		end
	}
}

SolidifyPhase
{
}

GravityPhase
{
	FallSpeed 0.1
	GroupLandedScript
	{
		sound "FX_LOCK"
	}
}

CompletionPhase
{
	CompletionBeginScript
	{
		if pl.d8 - goal
		  set pl.d7 to (((pl.d9-goal)/pl.d9)-(level time/120)) * 20
					if pl.d7 > 4
						set pl.d7 to 4
					end
		 mino mood pl.d7
		 set pl.d8 to goal
		end
		if goal <= 0
			next level
			sound "FX_LEVEL"
		 message "LEVEL UP!"
		end
	}
}

EventScripts
{
	GameStartScript
	{
		sound "FX_LEVEL"
		set ghost to 1
		set st0.d0 to 0
		set st0.d1 to 0
		set st0.d2 to 0
		set st0.d3 to 0
		set st0.d4 to 0
		set st0.d5 to 0
		set st0.d7 to 0
		set st0.d8 to 0
		set st0.d9 to 0
		set st1.d0 to 0
	}
	LevelStartScript
	{
		if level < 5
		 mino intensity low
		 else
		 if level < 10
		  mino intensity medium
		  else
		   mino intensity high
		 end
		end
		set goal to 10
		set pl.d9 to goal
		set pl.d8 to goal
	}
	LevelEndScript
	{
		if level > 10
		 sound "VO_EXLNT"
		 win
		end
	}
	MoveSuccessfulScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	MoveFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	RotateSuccessfulScript
	{
		sound "FX_RTA01"
		set st0.d7 to st0.d7 + 1
	}
	RotateFailedScript
	{
		sound "FX_LND01"
		set st0.d7 to st0.d7 + 1
	}
	HardDropStartScript
	{
		sound "FX_HRDDP"
		set st0.d5 to st0.d5 + 1
		set pf.d2 to 0
	}
	SoftDropStepScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	FallStepScript
	{
		sound "FX_FALL"
	}
	TouchdownScript
	{
		if pf.d2
		 sound "FX_LND01"
		end
	}
	LockdownScript
	{
		if pf.d2
			sound "FX_LCK01"
		end
		if piece.id = 1
		 if spin
		  shape "T-spin1" at piece.x, piece.y
		   if result = 1
		    if level < 10
		     sound "VO_TSPIN"
		    else
		     sound "FX_RWD01"
		    end
		   set goal to goal -1 
		   set pf.d4 to 1
				set st1.d0 to st1.d0 + 1
					else
		    shape "T-spin2" at piece.x, piece.y
								if result = 1
						if level < 10
		     sound "VO_TSPIN"
		    else
		     sound "FX_RWD01"
		    end
						set goal to goal -1 
						set pf.d4 to 1
					set st1.d0 to st1.d0 + 1
					end
				end
			end
		end
	}
	GameSecondScript
	{
		set st0.d8 to game time
	}
	LevelSecondScript
	{
		set st0.d7 to level time
	}
}

CustomEvent
{
	Name "Goal of game"
	TriggerType LevelTime 3
	Script
	{
		if level < 6 
		 sound "VO_INT01"
		end
	}
}

MCASCADE.TWS

//   FILE: Ultra Cascade Tetris v7.2DP.tws
// SOURCE: Ultra Cascade Tetris v7.2DP
//   DATE: Wed, Oct 31, 2001  12:37:51 PM


GeneralInfo
{
	PlayfieldColumns 10
	PlayfieldRows 22
	MaxMovementsPerSecond 15
	MaxRotationsPerSecond 5
	GameType Levels
	RemoveFromBagAfterUse
	NextPieceQueueSize 8
}

MinoSticky
{
	NotStickyBetweenPieces
	1: 1
	2: 2
	3: 3
	4: 4
	5: 5
	6: 6
	7: 7
}

Mino
{
	Name "J"
	Tags 0,1
}

Mino
{
	Name "T"
	Tags 0,2
}

Mino
{
	Name "S"
	Tags 0,3
}

Mino
{
	Name "Z"
	Tags 0,4
}

Mino
{
	Name "L"
	Tags 0,5
}

Mino
{
	Name "O"
	Tags 0,6
}

Mino
{
	Name "I"
	Tags 0,7
}

Tetramino
{
	Name "T"
	NumberInBag 1
	ID 1
	MinoList
	{
		"T" (0,1)
		"T" (-1,0)
		"T" (0,0)
		"T" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "J"
	NumberInBag 1
	ID 2
	MinoList
	{
		"J" (-1,1)
		"J" (-1,0)
		"J" (0,0)
		"J" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "L"
	NumberInBag 1
	ID 3
	MinoList
	{
		"L" (1,1)
		"L" (-1,0)
		"L" (0,0)
		"L" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "S"
	NumberInBag 1
	ID 4
	MinoList
	{
		"S" (0,1)
		"S" (1,1)
		"S" (-1,0)
		"S" (0,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "Z"
	NumberInBag 1
	ID 5
	MinoList
	{
		"Z" (-1,1)
		"Z" (0,1)
		"Z" (0,0)
		"Z" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "I"
	NumberInBag 1
	ID 6
	MinoList
	{
		"I" (-1,0)
		"I" (0,0)
		"I" (1,0)
		"I" (2,0)
	}
	Rot0CWOffsetList (0,0),(-1,0),(2,0),(-1,0),(2,0)
	Rot90CWOffsetList (-1,0),(0,0),(0,0),(0,1),(0,-2)
	Rot180CWOffsetList (-1,1),(1,1),(-2,1),(1,0),(-2,0)
	Rot270CWOffsetList (0,1),(0,1),(0,1),(0,-1),(0,2)
}

Tetramino
{
	Name "O"
	NumberInBag 1
	ID 7
	MinoList
	{
		"O" (0,1)
		"O" (1,1)
		"O" (0,0)
		"O" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,-1),(0,-1),(0,-1),(0,-1),(0,-1)
	Rot180CWOffsetList (-1,-1),(-1,-1),(-1,-1),(-1,-1),(-1,-1)
	Rot270CWOffsetList (-1,0),(-1,0),(-1,0),(-1,0),(-1,0)
}

Shape
{
	Name "tspin1"
	Hotspot (7,8)
	ShapeCoords (6,9),(6,7),(8,7)
}

Shape
{
	Name "tspin2"
	Hotspot (7,8)
	ShapeCoords (6,7),(8,9),(8,7)
}

Pattern
{
	Name "line clear"
	Tags 0
	Method Search
	SearchType Horizontal
	SearchCount 10
	PatternMinoScript
	{
		kill mino
		sound "FX_CLR01"
	}
	PatternEndScript
	{
		set st1.d3 to st1.d3 + 1
	}
}

Level
{
	Name "Level #1"
}

Level
{
	Name "Level #2"
}

Level
{
	Name "Level #3"
}

Level
{
	Name "Level #4"
}

Level
{
	Name "Level #5"
}

Level
{
	Name "Level #6"
}

Level
{
	Name "Level #7"
}

Level
{
	Name "Level #8"
}

Level
{
	Name "Level #9"
}

Level
{
	Name "Level #10"
}

Level
{
	Name "Level #11"
}

Level
{
	Name "Level #12"
}

Level
{
	Name "Level #13"
}

Level
{
	Name "Level #14"
}

Level
{
	Name "Level #15"
}

GenerationPhase
{
	GenerationTime ((.8-((level-1)*.007))^(level-1))/20
	PieceStartingLocation (4,0)
	GenerationBeginScript
	{
		set pf.d2 to 1
		set pf.d4 to 0
	}
	GenerationEndScript
	{
		set st0.d4 to st0.d4 + 1
	}
}

FallingPhase
{
	FallSpeed (.8-((level-1)*.007))^(level-1)
	SoftDropSpeed ((.8-((level-1)*.007))^(level-1))/20
	HardDropSpeed 0.0001
	MoveTolerance 1
}

LockPhase
{
	MovementRestartsClock
	Duration 0.5
}

PatternPhase
{
}

IteratePhase
{
}

EliminatePhase
{
	FallSpeed 0.05
	EliminateBeginScript
	{
		set ph.d0 to 0
		set ph.d1 to 0
	}
	LineCollapsedScript
	{
		set ph.d0 to ph.d0 + 1
		set ph.d1 to ph.d1 + 1
	}
	GroupLandedScript
	{
		sound "FX_LNE01"
	}
	EliminateEndScript
	{
		set st2.d8 to goal
		if ph.d0 >= 1
			set goal to goal - (ph.d0 + (ph.d0 - 1))
		end
		if ph.d0>0
			if cascades>1
				set goal to goal - ((cascades-1)*2)
			end
		end
		set st2.d9 to st2.d8 - goal
		if ph.d0 > st1.d6
			set st1.d6 to ph.d0
		end
		if goal < 0
		 set goal to 0
		end
	}
}

SolidifyPhase
{
}

GravityPhase
{
	GravityEnabled
	FallSpeed 0.05
	GroupLandedScript
	{
		sound "FX_LOCK"
	}
}

CompletionPhase
{
	CompletionBeginScript
	{
		if cascades > 0
			set st1.d4 to st1.d4 + (cascades - 1)
		end
		if st1.d4 > 0
			if (cascades - 1) > st1.d5
				set st1.d5 to (cascades - 1)
			end
		end
		if cascades = 2
		message "2 Cascades"
		line color (109,0,23)
		 sound "FX_MTRS1"
		end
		if cascades = 3
		message "3 Cascades"
		line color (39,0,87)
		 sound "FX_MTRS2"
		end
		if cascades = 4
		message "4 Cascades"
		line color (39,0,87)
		 sound "FX_MTRS3"
		end
		if cascades = 5
		message "5 Cascades"
		line color (116,55,0)
		 sound "FX_MTRS4"
		end
		if cascades = 6
		message "6 Cascades"
		line color (116,55,0)
		 sound "FX_MTRS5"
		end
		if cascades = 7
		message "7 Cascades"
		line color (0,91,56)
		 sound "FX_MTRS6"
		end
		if cascades = 8
			message "8 Cascades"
		line color (0,91,56)
		 sound "FX_MTRS6"
		end
		if cascades = 9
			message "9 Cascades"
		line color (118,119,0)
		 sound "FX_MTRS6"
		end
		if cascades = 10
			message "10 Cascades"
		line color (118,119,0)
		 sound "FX_MTRS6"
		end
		if cascades >= 11
			message "Super Cascade!!!"
		line color (0,36,154)
		 sound "FX_MTRS6"
		end
		if goal <= 0
			next level
			if level < 15
				sound "FX_LEVEL"
			end
		end
	}
}

EventScripts
{
	GameStartScript
	{
		set st2.d7 to rank
		sound "FX_LEVEL"
		set ghost to 1
		set st0.d4 to 0
		set st0.d5 to 0
		set st0.d7 to 0
		set st0.d8 to 0
		set st1.d3 to 0
		set st1.d4 to 0
		set st1.d5 to 0
		set st1.d6 to 0
		line color (30,30,30)
	}
	LevelStartScript
	{
		mino intensity high
		set pf.d1 to (5*level)
		set goal to pf.d1
		set st2.d8 to goal
		set pf.d7 to 0
	}
	LevelEndScript
	{
		if level >= 15
		 sound "VO_EXLNT"
		 win
		end
	}
	MoveSuccessfulScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	MoveFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	RotateSuccessfulScript
	{
		sound "FX_RTA01"
		set st0.d5 to st0.d5 + 1
	}
	RotateFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	HardDropStartScript
	{
		sound "FX_HRDDP"
		set st0.d5 to st0.d5 + 1
		set pf.d2 to 0
	}
	SoftDropStepScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	FallStepScript
	{
		sound "FX_FALL"
	}
	TouchdownScript
	{
		if pf.d2
		 sound "FX_LND01"
		end
	}
	LockdownScript
	{
		if pf.d2
		 sound "FX_LCK01"
		end
		if piece.id = 1
			if spin
				shape "T-spin1" at piece.x, piece.y
				if result = 1
		   if level < 6
		    sound "VO_TSPIN"
		   else
		    sound "FX_RWD01"
		   end
		   set goal to goal -1 
					set pf.d4 to 1
				else
					shape "T-spin2" at piece.x, piece.y
					if result = 1
		    if level < 6
		     sound "VO_TSPIN"
		    else
		     sound "FX_RWD01"
		    end
		    set goal to goal -1 
						set pf.d4 to 1
					end
				end
			end
		end
	}
	GameSecondScript
	{
		set st0.d8 to game time
	}
	LevelSecondScript
	{
		set st0.d7 to level time
	}
}

CustomEvent
{
	Name "Countdown"
	TriggerType LevelTime 109
	Script
	{
		message "COUNTDOWN!"
	}
}

CustomEvent
{
	Name "10"
	TriggerType LevelTime 110
	Script
	{
		sound "FX_TIC10"
	}
}

CustomEvent
{
	Name "9"
	TriggerType LevelTime 111
	Script
	{
		sound "FX_TIC09"
	}
}

CustomEvent
{
	Name "8"
	TriggerType LevelTime 112
	Script
	{
		sound "FX_TIC08"
	}
}

CustomEvent
{
	Name "7"
	TriggerType LevelTime 113
	Script
	{
		sound "FX_TIC07"
	}
}

CustomEvent
{
	Name "6"
	TriggerType LevelTime 114
	Script
	{
		sound "FX_TIC06"
	}
}

CustomEvent
{
	Name "5"
	TriggerType LevelTime 115
	Script
	{
		sound "FX_TIC05"
	}
}

CustomEvent
{
	Name "4"
	TriggerType LevelTime 116
	Script
	{
		sound "FX_TIC04"
	}
}

CustomEvent
{
	Name "3"
	TriggerType LevelTime 117
	Script
	{
		sound "FX_TIC03"
	}
}

CustomEvent
{
	Name "2"
	TriggerType LevelTime 118
	Script
	{
		sound "FX_TIC02"
	}
}

CustomEvent
{
	Name "1"
	TriggerType LevelTime 119
	Script
	{
		sound "FX_TIC01"
	}
}

MCONNECT.TWS

//   FILE: Ultra Fusion Tetris v7.2DP.tws
// SOURCE: Ultra Fusion Tetris v7.2DP
//   DATE: Wed, Oct 31, 2001  12:38:02 PM


GeneralInfo
{
	PlayfieldColumns 10
	PlayfieldRows 22
	MaxMovementsPerSecond 15
	MaxRotationsPerSecond 5
	GameType Levels
	RemoveFromBagAfterUse
	NextPieceQueueSize 8
}

MinoSticky
{
	NotStickyBetweenPieces
	1: 1
	2: 2
	3: 3
	4: 4
	5: 5
	6: 6
	7: 7
}

Mino
{
	Name "J"
	Tags 0,1
	MutateMino "Solo Blue"
}

Mino
{
	Name "S"
	Tags 0,2
	MutateMino "Solo Green"
}

Mino
{
	Name "O"
	Tags 0,3
	MutateMino "Solo Yellow"
}

Mino
{
	Name "L"
	Tags 0,4
	MutateMino "Solo Orange"
}

Mino
{
	Name "T"
	Tags 0,5
	MutateMino "Solo Cyan"
}

Mino
{
	Name "I"
	Tags 0,6
	MutateMino "Solo Purple"
}

Mino
{
	Name "Z"
	Tags 0,7
	MutateMino "Solo Red"
}

Mino
{
	Name "Gold"
	Tags 0,10
	MutateMino "Red"
	D0 1
	D1 1
}

Mino
{
	Name "Red"
	Tags 0,11
	D0 1
}

Mino
{
	Name "Garbage"
	Antigravity
	Tags 0,31
}

Mino
{
	Name "Solo Blue"
	Tags 0,20
}

Mino
{
	Name "Solo Green"
	Tags 0,21
}

Mino
{
	Name "Solo Yellow"
	Tags 0,22
}

Mino
{
	Name "Solo Orange"
	Tags 0,23
}

Mino
{
	Name "Solo Cyan"
	Tags 0,24
}

Mino
{
	Name "Solo Purple"
	Tags 0,25
}

Mino
{
	Name "Solo Red"
	Tags 0,26
}

Tetramino
{
	Name "T"
	NumberInBag 1
	ID 1
	MinoList
	{
		"T" (0,1)
		"T" (-1,0)
		"T" (0,0)
		"T" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "J"
	NumberInBag 1
	ID 2
	MinoList
	{
		"J" (-1,1)
		"J" (-1,0)
		"J" (0,0)
		"J" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "L"
	NumberInBag 1
	ID 3
	MinoList
	{
		"L" (1,1)
		"L" (-1,0)
		"L" (0,0)
		"L" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "S"
	NumberInBag 1
	ID 4
	MinoList
	{
		"S" (0,1)
		"S" (1,1)
		"S" (-1,0)
		"S" (0,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "Z"
	NumberInBag 1
	ID 5
	MinoList
	{
		"Z" (-1,1)
		"Z" (0,1)
		"Z" (0,0)
		"Z" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "I"
	NumberInBag 1
	ID 6
	MinoList
	{
		"I" (-1,0)
		"I" (0,0)
		"I" (1,0)
		"I" (2,0)
	}
	Rot0CWOffsetList (0,0),(-1,0),(2,0),(-1,0),(2,0)
	Rot90CWOffsetList (-1,0),(0,0),(0,0),(0,1),(0,-2)
	Rot180CWOffsetList (-1,1),(1,1),(-2,1),(1,0),(-2,0)
	Rot270CWOffsetList (0,1),(0,1),(0,1),(0,-1),(0,2)
}

Tetramino
{
	Name "O"
	NumberInBag 1
	ID 7
	MinoList
	{
		"O" (0,1)
		"O" (1,1)
		"O" (0,0)
		"O" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,-1),(0,-1),(0,-1),(0,-1),(0,-1)
	Rot180CWOffsetList (-1,-1),(-1,-1),(-1,-1),(-1,-1),(-1,-1)
	Rot270CWOffsetList (-1,0),(-1,0),(-1,0),(-1,0),(-1,0)
}

Tetramino
{
	Name "One"
	NumberInBag 3
	ID 8
	MinoList
	{
		"Gold" (0,0)
	}
	Rot0CWOffsetList (0,0)
	Rot90CWOffsetList (0,0)
	Rot180CWOffsetList (0,0)
	Rot270CWOffsetList (0,0)
}

GarbageInfo
{
	NormalMino "Garbage"
	NormalCount 6
}

Shape
{
	Name "tspin1"
	Hotspot (7,8)
	ShapeCoords (6,9),(6,7),(8,7)
}

Shape
{
	Name "tspin2"
	Hotspot (7,8)
	ShapeCoords (6,7),(8,9),(8,7)
}

Pattern
{
	Name "line clear"
	Tags 0
	Method Search
	SearchType Horizontal
	SearchCount 10
	PatternMinoScript
	{
		if mino.d0 = 0
			kill mino
			sound "FX_CLR01"
		else
			set gravity to 1
		line color (136,147,181)
		end
	}
	PatternEndScript
	{
		set st1.d3 to st1.d3 + 1
		set pf.d8 to pf.d8 + 1
		set ph.d0 to 1
	}
}

Pattern
{
	Name "disease"
	Tags 11
	Method Search
	SearchType FloodFill4D
	SearchCount 1
	PatternMinoScript
	{
		pattern "infection" at mino.x, mino.y
	}
}

Pattern
{
	Name "infection"
	Triggered
	Tags 10,11
	Method Search
	SearchType FloodFill4D
	SearchCount 2
	PatternMinoScript
	{
		set st2.d8 to goal
		if mino.d1 = 1
			mutate mino
			sound "FX_FUS02"
		 sound "FX_MTRS4"
			set goal to goal -1
		set st2.d9 to st2.d8 - goal
			set st2.d4 to st2.d4 + 1
			message "Fusion!"
			if level < 6
				sound "VO_FUSION"
			end
			if goal <= 0
				set pf.d0 to 1
			end
		end
	}
}

Pattern
{
	Name "level end"
	Tags 11
	Method Search
	SearchType FloodFill4D
	SearchCount pf.d6 + 1
	PatternMinoScript
	{
	}
	PatternEndScript
	{
		next level
	}
}

Trash
{
	Name "left"
	Height 1
	MinoList
	{
		"Red" (0,0)
		"Garbage" (2,0)
		"Garbage" (4,0)
		"Garbage" (6,0)
		"Garbage" (8,0)
	}
}

Trash
{
	Name "right"
	Height 1
	MinoList
	{
		"Garbage" (1,0)
		"Garbage" (3,0)
		"Garbage" (5,0)
		"Garbage" (7,0)
		"Red" (9,0)
	}
}

Level
{
	Name "Level #1"
}

Level
{
	Name "Level #2"
}

Level
{
	Name "Level #3"
}

Level
{
	Name "Level #4"
}

Level
{
	Name "Level #5"
}

Level
{
	Name "Level #6"
}

Level
{
	Name "Level #7"
}

Level
{
	Name "Level #8"
}

Level
{
	Name "Level #9"
}

Level
{
	Name "Level #10"
}

Level
{
	Name "Level #11"
}

Level
{
	Name "Level #12"
}

Level
{
	Name "Level #13"
}

Level
{
	Name "Level #14"
}

Level
{
	Name "Level #15"
}

GenerationPhase
{
	GenerationTime ((.8-((level-1)*.007))^(level-1))/20
	PieceStartingLocation (4,0)
	GenerationBeginScript
	{
		set pf.d2 to 1
		set pf.d4 to 0
	}
	GenerationEndScript
	{
		set st0.d4 to st0.d4 + 1
		set pf.d9 to 0
	}
}

FallingPhase
{
	FallSpeed (.8-((level-1)*.007))^(level-1)
	SoftDropSpeed ((.8-((level-1)*.007))^(level-1))/20
	HardDropSpeed 0.0001
	MoveTolerance 1
}

LockPhase
{
	MovementRestartsClock
	Duration 0.5
}

PatternPhase
{
	PatternBeginScript
	{
		set pf.d8 to 0
		set pf.d0 to 0
		set ph.d0 to 0
	}
	PatternEndScript
	{
		if ph.d0 = 1
			set pf.d9 to pf.d9 + 1
		end
	}
}

IteratePhase
{
	IterateBeginScript
	{
		set st2.d5 to 0
	}
	SecondaryIterator
	{
		MinoIteratorScript
		{
			if mino.d1 = 1
			 set st2.d5 to st2.d5 + 1
			end
		}
	}
}

EliminatePhase
{
	FallSpeed 0.05
	EliminateBeginScript
	{
		set ph.d0 to pf.d8
	}
	GroupLandedScript
	{
		sound "FX_LNE01"
	}
	EliminateEndScript
	{
		if ph.d0 > st1.d6
			set st1.d6 to ph.d0
		end
		if goal < 0
		 set goal to 0
		end
	}
}

SolidifyPhase
{
}

GravityPhase
{
	FallSpeed 0.05
	GroupLandedScript
	{
		sound "FX_LOCK"
	}
	GravityEndScript
	{
		set gravity to 0
	}
}

CompletionPhase
{
	CompletionBeginScript
	{
			set st1.d4 to st1.d4 + pf.d9
		if st1.d4 > 0
			if pf.d9 > st1.d5
				set st1.d5 to pf.d9
			end
		end
		if pf.d9 > st1.d5
			set st1.d5 to pf.d9
		end
		if pf.d9 = 2
		message "2 Cascades"
		line color (109,0,23)
		end
		if pf.d9 = 3
		message "3 Cascades"
		line color (39,0,87)
		end
		if pf.d9 = 4
		message "4 Cascades"
		line color (39,0,87)
		end
		if pf.d9 = 5
		message "5 Cascades"
		line color (116,55,0)
		end
		if pf.d9 = 6
		message "6 Cascades"
		line color (116,55,0)
		end
		if pf.d9 = 7
		message "7 Cascades"
		line color (0,91,56)
		end
		if pf.d9 = 8
			message "8 Cascades"
		line color (0,91,56)
		end
		if pf.d9 = 9
			message "9 Cascades"
		line color (118,119,0)
		end
		if pf.d9 = 10
			message "10 Cascades"
		line color (118,119,0)
		end
		if pf.d9 >= 11
			message "Super Cascade!!!"
		line color (0,36,154)
		end
		if goal <= 0
			next level
			if level < 15
				sound "FX_LEVEL"
			end
		end
	}
}

EventScripts
{
	GameStartScript
	{
		sound "FX_LEVEL"
		set ghost to 1
		set st2.d4 to 0
		set st2.d5 to 0
		set st0.d4 to 0
		set st0.d5 to 0
		set st0.d7 to 0
		set st0.d8 to 0
		set st1.d3 to 0
		set st1.d4 to 0
		set st1.d5 to 0
		set st1.d6 to 0
		line color (30,30,30)
	}
	LevelStartScript
	{
		mino intensity high
		mixed garbage level
		if ((level/2) - (level\2)) = 0
			trash "left"
		else
			trash "right"
		end
		set pf.d6 to level * 2
		set goal to pf.d6
		set pf.d7 to 0
	}
	LevelEndScript
	{
		if level >= 15
		 sound "VO_EXLNT"
		 win
		end
	}
	MoveSuccessfulScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	MoveFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	RotateSuccessfulScript
	{
		sound "FX_RTA01"
		set st0.d5 to st0.d5 + 1
	}
	RotateFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	HardDropStartScript
	{
		sound "FX_HRDDP"
		set st0.d5 to st0.d5 + 1
		set pf.d2 to 0
	}
	SoftDropStepScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	FallStepScript
	{
		sound "FX_FALL"
	}
	TouchdownScript
	{
		if pf.d2
		 sound "FX_LND01"
		end
	}
	LockdownScript
	{
		if pf.d2
		 sound "FX_LCK01"
		end
		if piece.id = 1
			if spin
				shape "T-spin1" at piece.x, piece.y
				if result = 1
		   if level < 6
		    sound "VO_TSPIN"
		   else
		    sound "FX_RWD01"
		   end 
					set pf.d4 to 1
				else
					shape "T-spin2" at piece.x, piece.y
					if result = 1
		    if level < 6
		     sound "VO_TSPIN"
		    else
		     sound "FX_RWD01"
		    end 
						set pf.d4 to 1
					end
				end
			end
		end
	}
	GameSecondScript
	{
		set st0.d8 to game time
	}
	LevelSecondScript
	{
		set st0.d7 to level time
	}
}

CustomEvent
{
	Name "Countdown"
	TriggerType LevelTime 109
	Script
	{
		message "COUNTDOWN!"
	}
}

CustomEvent
{
	Name "10"
	TriggerType LevelTime 110
	Script
	{
		sound "FX_TIC10"
	}
}

CustomEvent
{
	Name "9"
	TriggerType LevelTime 111
	Script
	{
		sound "FX_TIC09"
	}
}

CustomEvent
{
	Name "8"
	TriggerType LevelTime 112
	Script
	{
		sound "FX_TIC08"
	}
}

CustomEvent
{
	Name "7"
	TriggerType LevelTime 113
	Script
	{
		sound "FX_TIC07"
	}
}

CustomEvent
{
	Name "6"
	TriggerType LevelTime 114
	Script
	{
		sound "FX_TIC06"
	}
}

CustomEvent
{
	Name "5"
	TriggerType LevelTime 115
	Script
	{
		sound "FX_TIC05"
	}
}

CustomEvent
{
	Name "4"
	TriggerType LevelTime 116
	Script
	{
		sound "FX_TIC04"
	}
}

CustomEvent
{
	Name "3"
	TriggerType LevelTime 117
	Script
	{
		sound "FX_TIC03"
	}
}

CustomEvent
{
	Name "2"
	TriggerType LevelTime 118
	Script
	{
		sound "FX_TIC02"
	}
}

CustomEvent
{
	Name "1"
	TriggerType LevelTime 119
	Script
	{
		sound "FX_TIC01"
	}
}

MHOTLINE.TWS

//   FILE: Ultra Hot-Line Tetris v7.2DP.tw
// SOURCE: Ultra Hot-Line Tetris v7.2DP
//   DATE: Wed, Oct 31, 2001  12:38:13 PM


GeneralInfo
{
	PlayfieldColumns 10
	PlayfieldRows 22
	MaxMovementsPerSecond 15
	MaxRotationsPerSecond 5
	GameType Levels
	RemoveFromBagAfterUse
	NextPieceQueueSize 8
}

MinoSticky
{
	NotStickyBetweenPieces
	1: 1
	2: 2
	3: 3
	4: 4
	5: 5
	6: 6
	7: 7
}

Mino
{
	Name "J"
	Tags 0,1
	AltMino "T"
	AltChance 10
}

Mino
{
	Name "S"
	Tags 0,2
	AltMino "J"
	AltChance 10
}

Mino
{
	Name "T"
	Tags 0,3
	AltMino "L"
	AltChance 10
}

Mino
{
	Name "Z"
	Tags 0,4
	AltMino "O"
	AltChance 10
}

Mino
{
	Name "O"
	Tags 0,5
	AltMino "I"
	AltChance 10
}

Mino
{
	Name "I"
	Tags 0,6
	AltMino "S"
	AltChance 10
}

Mino
{
	Name "L"
	Tags 0,7
	AltMino "Z"
	AltChance 10
}

Tetramino
{
	Name "T"
	NumberInBag 1
	ID 1
	MinoList
	{
		"T" (0,1)
		"T" (-1,0)
		"T" (0,0)
		"T" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "S"
	NumberInBag 1
	ID 2
	MinoList
	{
		"S" (0,1)
		"S" (1,1)
		"S" (-1,0)
		"S" (0,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "Z"
	NumberInBag 1
	ID 3
	MinoList
	{
		"Z" (-1,1)
		"Z" (0,1)
		"Z" (0,0)
		"Z" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "L"
	NumberInBag 1
	ID 4
	MinoList
	{
		"L" (1,1)
		"L" (-1,0)
		"L" (0,0)
		"L" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "J"
	NumberInBag 1
	ID 5
	MinoList
	{
		"J" (-1,1)
		"J" (-1,0)
		"J" (0,0)
		"J" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "I"
	NumberInBag 1
	ID 6
	MinoList
	{
		"I" (-1,0)
		"I" (0,0)
		"I" (1,0)
		"I" (2,0)
	}
	Rot0CWOffsetList (0,0),(-1,0),(2,0),(-1,0),(2,0)
	Rot90CWOffsetList (-1,0),(0,0),(0,0),(0,1),(0,-2)
	Rot180CWOffsetList (-1,1),(1,1),(-2,1),(1,0),(-2,0)
	Rot270CWOffsetList (0,1),(0,1),(0,1),(0,-1),(0,2)
}

Tetramino
{
	Name "O"
	NumberInBag 1
	ID 7
	MinoList
	{
		"O" (0,1)
		"O" (1,1)
		"O" (0,0)
		"O" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,-1),(0,-1),(0,-1),(0,-1),(0,-1)
	Rot180CWOffsetList (-1,-1),(-1,-1),(-1,-1),(-1,-1),(-1,-1)
	Rot270CWOffsetList (-1,0),(-1,0),(-1,0),(-1,0),(-1,0)
}

Shape
{
	Name "tspin1"
	Hotspot (7,8)
	ShapeCoords (6,9),(6,7),(8,7)
}

Shape
{
	Name "tspin2"
	Hotspot (7,8)
	ShapeCoords (6,7),(8,9),(8,7)
}

Pattern
{
	Name "line clear"
	Tags 0
	Method Search
	SearchType Horizontal
	SearchCount 10
	PatternMinoScript
	{
		kill mino
		sound "FX_CLR01"
		set ph.d0 to mino.y
	}
	PatternEndScript
	{
		set st2.d8 to goal
		if pf.d0 < 2
			if ph.d0 = 2
				set goal to goal - 6
		set st2.d9 to st2.d8 - goal
		set st2.d3 to st2.d3 + 1
		message "Hotline!!"
				sound "FX_HTLN6"
				sound "FX_MTRS6"
			else
				if ph.d0 = 3
				set goal to goal - 5
		set st2.d9 to st2.d8 - goal
		set st2.d2 to st2.d2 + 1
		message "Hotline!"
				sound "FX_HTLN5"
				sound "FX_MTRS5"
				else
					if ph.d0 = 5
					set goal to goal - 4
		set st2.d9 to st2.d8 - goal
		set st2.d1 to st2.d1 + 1
		message "Hotline"
					sound "FX_HTLN4"
					sound "FX_MTRS4"
					else
						if ph.d0 = 8
						set goal to goal - 3
		set st2.d9 to st2.d8 - goal
		set st2.d0 to st2.d0 + 1
		message "Hotline"
						sound "FX_HTLN3"
						sound "FX_MTRS3"
						else
							if ph.d0 = 12
							set goal to goal - 2
		set st2.d9 to st2.d8 - goal
		set st1.d9 to st1.d9 + 1
		message "Hotline"
							sound "FX_HTLN2"
							sound "FX_MTRS2"
							else
								if ph.d0 = 17
								set goal to goal - 1
		set st2.d9 to st2.d8 - goal
		set st1.d8 to st1.d8 + 1
		message "Hotline"
								sound "FX_HTLN1"
								sound "FX_MTRS1"
								end
							end
						end
					end
				end
			end
			if score >= goal
				set pf.d0 to 1
			end
		end
	}
}

Level
{
	Name "Level #1"
}

Level
{
	Name "Level #2"
}

Level
{
	Name "Level #3"
}

Level
{
	Name "Level #4"
}

Level
{
	Name "Level #5"
}

Level
{
	Name "Level #6"
}

Level
{
	Name "Level #7"
}

Level
{
	Name "Level #8"
}

Level
{
	Name "Level #9"
}

Level
{
	Name "Level #10"
}

Level
{
	Name "Level #11"
}

Level
{
	Name "Level #12"
}

Level
{
	Name "Level #13"
}

Level
{
	Name "Level #14"
}

Level
{
	Name "Level #15"
}

GenerationPhase
{
	GenerationTime ((.8-((level-1)*.007))^(level-1))/20
	PieceStartingLocation (4,0)
	GenerationBeginScript
	{
		set pf.d0 to 0
		set pf.d2 to 1
		set pf.d4 to 0
	}
	GenerationEndScript
	{
		set st0.d4 to st0.d4 + 1
	}
}

FallingPhase
{
	FallSpeed (.8-((level-1)*.007))^(level-1)
	SoftDropSpeed ((.8-((level-1)*.007))^(level-1))/20
	HardDropSpeed 0.0001
	MoveTolerance 1
}

LockPhase
{
	MovementRestartsClock
	Duration 0.5
}

PatternPhase
{
}

IteratePhase
{
	PrimaryIterator
	{
		IteratorExpression pf.d0 = 1
		IteratorTags 1,2,3,4,5,6,7
		MinoIteratorScript
		{
		}
	}
	IterateEndScript
	{
		if pf.d0 = 1
			set pf.d0 to 2
		end
	}
}

EliminatePhase
{
	FallSpeed 0.05
	GroupLandedScript
	{
		sound "FX_LNE01"
	}
	EliminateEndScript
	{
		if goal < 0
		 set goal to 0
		end
	}
}

SolidifyPhase
{
}

GravityPhase
{
	GravityEnabled
	FallSpeed 0.05
	GroupLandedScript
	{
		sound "FX_LOCK"
	}
}

CompletionPhase
{
	CompletionBeginScript
	{
		if goal <= 0
			next level
			if level < 15
				sound "FX_LEVEL"
		 message "LEVEL UP!"
			end
		end
	}
}

EventScripts
{
	GameStartScript
	{
		sound "FX_LEVEL"
		set ghost to 1
		set st0.d4 to 0
		set st0.d5 to 0
		set st0.d7 to 0
		set st0.d8 to 0
		set st1.d8 to 0
		set st1.d9 to 0
		set st2.d0 to 0
		set st2.d1 to 0
		set st2.d2 to 0
		set st2.d3 to 0
		line color (30,30,30)
		line color 2 (0,36,154)
		line color 3 (39,0,87)
		line color 5 (109,0,23)
		line color 8 (116,55,0)
		line color 12 (118,119,0)
		line color 17 (0,91,56)
	}
	LevelStartScript
	{
		mino intensity high
		set pf.d1 to (5*level)
		set goal to pf.d1
		set pf.d7 to 0
	}
	LevelEndScript
	{
		if level >= 15
		 sound "VO_EXLNT"
		 win
		end
	}
	MoveSuccessfulScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	MoveFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	RotateSuccessfulScript
	{
		sound "FX_RTA01"
		set st0.d5 to st0.d5 + 1
	}
	RotateFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	HardDropStartScript
	{
		sound "FX_HRDDP"
		set st0.d5 to st0.d5 + 1
		set pf.d2 to 0
	}
	SoftDropStepScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	FallStepScript
	{
		sound "FX_FALL"
	}
	TouchdownScript
	{
		if pf.d2
		 sound "FX_LND01"
		end
	}
	LockdownScript
	{
		if pf.d2
		 sound "FX_LCK01"
		end
		if piece.id = 1
			if spin
				shape "T-spin1" at piece.x, piece.y
				if result = 1
		   if level < 6
		    sound "VO_TSPIN"
		   else
		    sound "FX_RWD01"
		   end 
					set pf.d4 to 1
				else
					shape "T-spin2" at piece.x, piece.y
					if result = 1
		    if level < 6
		     sound "VO_TSPIN"
		    else
		     sound "FX_RWD01"
		    end
						set pf.d4 to 1
					end
				end
			end
		end
	}
	GameSecondScript
	{
		set st0.d8 to game time
	}
	LevelSecondScript
	{
		set st0.d7 to level time
	}
}

CustomEvent
{
	Name "Countdown"
	TriggerType LevelTime 109
	Script
	{
		message "COUNTDOWN!"
	}
}

CustomEvent
{
	Name "10"
	TriggerType LevelTime 110
	Script
	{
		sound "FX_TIC10"
	}
}

CustomEvent
{
	Name "9"
	TriggerType LevelTime 111
	Script
	{
		sound "FX_TIC09"
	}
}

CustomEvent
{
	Name "8"
	TriggerType LevelTime 112
	Script
	{
		sound "FX_TIC08"
	}
}

CustomEvent
{
	Name "7"
	TriggerType LevelTime 113
	Script
	{
		sound "FX_TIC07"
	}
}

CustomEvent
{
	Name "6"
	TriggerType LevelTime 114
	Script
	{
		sound "FX_TIC06"
	}
}

CustomEvent
{
	Name "5"
	TriggerType LevelTime 115
	Script
	{
		sound "FX_TIC05"
	}
}

CustomEvent
{
	Name "4"
	TriggerType LevelTime 116
	Script
	{
		sound "FX_TIC04"
	}
}

CustomEvent
{
	Name "3"
	TriggerType LevelTime 117
	Script
	{
		sound "FX_TIC03"
	}
}

CustomEvent
{
	Name "2"
	TriggerType LevelTime 118
	Script
	{
		sound "FX_TIC02"
	}
}

CustomEvent
{
	Name "1"
	TriggerType LevelTime 119
	Script
	{
		sound "FX_TIC01"
	}
}

MSQUARE.TWS

//   FILE: Ultra Square Tetris v7.2DP.tws
// SOURCE: Ultra Square Tetris v7.2DP
//   DATE: Wed, Oct 31, 2001  12:38:22 PM


GeneralInfo
{
	PlayfieldColumns 10
	PlayfieldRows 22
	MaxMovementsPerSecond 15
	MaxRotationsPerSecond 5
	GameType Levels
	NextPieceQueueSize 8
}

MinoSticky
{
	NotStickyBetweenPieces
	0: 0
	1: 1
	2: 2
	3: 3
	4: 4
	5: 5
	6: 6
	7: 7
	20: 20
	31: 31
}

Mino
{
	Name "J color"
	Tags 0
	MutateMino "Result J color"
}

Mino
{
	Name "L color"
	Tags 1
	MutateMino "Result L color"
}

Mino
{
	Name "S color"
	Tags 2
	MutateMino "Result S color"
}

Mino
{
	Name "Z color"
	Tags 3
	MutateMino "Result Z color"
}

Mino
{
	Name "O color"
	Tags 4
	MutateMino "Result O color"
}

Mino
{
	Name "T color"
	Tags 5
	MutateMino "Result T color"
}

Mino
{
	Name "I color"
	Tags 6
	MutateMino "Result I color"
}

Mino
{
	Name "Pure Square"
	Tags 31
	MutateMino "Result Pure Square"
	D9 2.5
}

Mino
{
	Name "Combo Square"
	Tags 31
	MutateMino "Result Combo Square"
	D9 1.25
}

Mino
{
	Name "Result J color"
	Tags 24
}

Mino
{
	Name "Result L color"
	Tags 25
}

Mino
{
	Name "Result S color"
	Tags 26
}

Mino
{
	Name "Result Z color"
	Tags 27
}

Mino
{
	Name "Result O color"
	Tags 28
}

Mino
{
	Name "Result T color"
	Tags 29
}

Mino
{
	Name "Result I color"
	Tags 30
}

Mino
{
	Name "Result Pure Square"
	Tags 23
}

Mino
{
	Name "Result Combo Square"
	Tags 22
}

Mino
{
	Name "Garbage"
	Tags 20
}

Tetramino
{
	Name "J Tetrimino"
	NumberInBag 1
	ID 1
	MinoList
	{
		"J color" (-1,1)
		"J color" (-1,0)
		"J color" (0,0)
		"J color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "I Tetrimino"
	NumberInBag 1
	ID 2
	MinoList
	{
		"I color" (-1,0)
		"I color" (0,0)
		"I color" (1,0)
		"I color" (2,0)
	}
	Rot0CWOffsetList (0,0),(-1,0),(2,0),(-1,0),(2,0)
	Rot90CWOffsetList (-1,0),(0,0),(0,0),(0,1),(0,-2)
	Rot180CWOffsetList (-1,1),(1,1),(-2,1),(1,0),(-2,0)
	Rot270CWOffsetList (0,1),(0,1),(0,1),(0,-1),(0,2)
}

Tetramino
{
	Name "O Tetrimino"
	NumberInBag 1
	ID 3
	MinoList
	{
		"O color" (-1,1)
		"O color" (0,1)
		"O color" (-1,0)
		"O color" (0,0)
	}
	Rot0CWOffsetList (-1,0),(-1,0),(-1,0),(-1,0),(-1,0)
	Rot90CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot180CWOffsetList (0,-1),(0,-1),(0,-1),(0,-1),(0,-1)
	Rot270CWOffsetList (-1,-1),(-1,-1),(-1,-1),(-1,-1),(-1,-1)
}

Tetramino
{
	Name "S Tetrimino"
	NumberInBag 1
	ID 4
	MinoList
	{
		"S color" (0,1)
		"S color" (1,1)
		"S color" (-1,0)
		"S color" (0,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "L Tetrimino"
	NumberInBag 1
	ID 5
	MinoList
	{
		"L color" (1,1)
		"L color" (-1,0)
		"L color" (0,0)
		"L color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "Z Tetrimino"
	NumberInBag 1
	ID 6
	MinoList
	{
		"Z color" (-1,1)
		"Z color" (0,1)
		"Z color" (0,0)
		"Z color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "T Tetrimino"
	NumberInBag 1
	ID 7
	MinoList
	{
		"T color" (0,1)
		"T color" (-1,0)
		"T color" (0,0)
		"T color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

GarbageInfo
{
	NormalMino "Garbage"
	NormalCount 9
}

Shape
{
	Name "Perfect Square"
	Hotspot (7,8)
	ShapeCoords (4,11),(4,10),(4,9),(4,8),(5,11),(5,10),(5,9),(5,8),(6,11),(6,10),(6,9),(6,8),(7,11),(7,10),(7,9),(7,8)
}

Shape
{
	Name "T-spin 1"
	Hotspot (7,8)
	ShapeCoords (6,9),(6,7),(8,7)
}

Shape
{
	Name "T-spin 2"
	Hotspot (7,8)
	ShapeCoords (6,7),(8,9),(8,7)
}

Shape
{
	Name "Spin S 1"
	Hotspot (7,8)
	ShapeCoords (5,6),(6,8),(6,7),(8,6),(9,8),(9,7)
}

Shape
{
	Name "Spin S 2"
	Hotspot (7,8)
	ShapeCoords (4,6),(5,8),(5,7),(7,6),(8,8),(8,7)
}

Shape
{
	Name "Spin Z 1"
	Hotspot (7,8)
	ShapeCoords (5,8),(5,7),(6,6),(8,8),(8,7),(9,6)
}

Shape
{
	Name "Spin Z 2"
	Hotspot (7,8)
	ShapeCoords (6,8),(6,7),(7,6),(9,8),(9,7),(10,6)
}

Pattern
{
	Name "t-spin top"
	Triggered
	Tags 0,1,2,3,4,5,6,24,25,26,27,28,29,30,31
	Method Search
	SearchType Horizontal
	SearchCount 10
	PatternBeginScript
	{
		sound "FX_RWD02"
		set pl.d4 to 0
	}
	PatternMinoScript
	{
		set pl.d5 to mino.y
	}
}

Pattern
{
	Name "t-spin bottom"
	Triggered
	Tags 0,1,2,3,4,5,6,24,25,26,27,28,29,30,31
	Method Search
	SearchType Horizontal
	SearchCount 10
	PatternBeginScript
	{
		sound "FX_RWD01"
		set pl.d5 to 21
	}
	PatternMinoScript
	{
		if pl.d4 = -1
			set pl.d4 to mino.y
		end
	}
}

Pattern
{
	Name "J Square"
	Tags 0
	Method Shape
	ShapeName "Perfect Square"
	PatternPieceCount 4
	PatternMinoScript
	{
		set mino to "Pure Square"
		message "Pure Square!!!"
	}
	PatternEndScript
	{
		solidify
		set st1.d2 to st1.d2 + 1
		sound "FX_GOLDF"
	}
}

Pattern
{
	Name "I Square"
	Tags 6
	Method Shape
	ShapeName "Perfect Square"
	PatternPieceCount 4
	PatternMinoScript
	{
		set mino to "Pure Square"
		message "Pure Square!!!"
	}
	PatternEndScript
	{
		solidify
		set st1.d2 to st1.d2 + 1
		sound "FX_GOLDF"
	}
}

Pattern
{
	Name "O Square"
	Tags 4
	Method Shape
	ShapeName "Perfect Square"
	PatternPieceCount 4
	PatternMinoScript
	{
		set mino to "Pure Square"
		message "Pure Square!!!"
	}
	PatternEndScript
	{
		solidify
		set st1.d2 to st1.d2 + 1
		sound "FX_GOLDF"
	}
}

Pattern
{
	Name "T Square"
	Tags 5
	Method Shape
	ShapeName "Perfect Square"
	PatternPieceCount 4
	PatternMinoScript
	{
		set mino to "Pure Square"
		message "Pure Square!!!"
	}
	PatternEndScript
	{
		solidify
		set st1.d2 to st1.d2 + 1
		sound "FX_GOLDF"
	}
}

Pattern
{
	Name "L Square"
	Tags 1
	Method Shape
	ShapeName "Perfect Square"
	PatternPieceCount 4
	PatternMinoScript
	{
		set mino to "Pure Square"
		message "Pure Square!!!"
	}
	PatternEndScript
	{
		solidify
		set st1.d2 to st1.d2 + 1
		sound "FX_GOLDF"
	}
}

Pattern
{
	Name "Combo Square"
	Tags 0,1,2,3,4,5,6
	Method Shape
	ShapeName "Perfect Square"
	PatternPieceCount 4
	PatternMinoScript
	{
		set mino to "Combo Square"
		message "Combo Square!"
	}
	PatternEndScript
	{
		solidify
		set st1.d1 to st1.d1 + 1
		sound "FX_SLVRF"
	}
}

Pattern
{
	Name "Line clear"
	Tags 0,1,2,3,4,5,6,20,22,23,24,25,26,27,28,29,30,31
	Method Search
	SearchType Horizontal
	SearchCount 10
	PatternBeginScript
	{
		if mino.d9 = 2.5
			line color (0,36,154)
		end
		if mino.d9 = 1.25
			line color (118,119,0)
		end
	}
	PatternMinoScript
	{
		set pf.d0 to pf.d0 + mino.d9
		kill mino
		sound "FX_CLR01"
	}
}

Level
{
	Name "Level #1"
}

Level
{
	Name "Level #2"
}

Level
{
	Name "Level #3"
}

Level
{
	Name "Level #4"
}

Level
{
	Name "Level #5"
}

Level
{
	Name "Level #6"
}

Level
{
	Name "Level #7"
}

Level
{
	Name "Level #8"
}

Level
{
	Name "Level #9"
}

Level
{
	Name "Level #10"
}

Level
{
	Name "Level #11"
}

Level
{
	Name "Level #12"
}

Level
{
	Name "Level #13"
}

Level
{
	Name "Level #14"
}

Level
{
	Name "Level #15"
}

GenerationPhase
{
	GenerationTime ((.8-((level-1)*.007))^(level-1))/20
	PieceStartingLocation (4,0)
	GenerationBeginScript
	{
		set pf.d2 to 1
		set pf.d4 to 0
	}
	GenerationEndScript
	{
		set st0.d4 to st0.d4 + 1
	}
}

FallingPhase
{
	FallSpeed (.8-((level-1)*.007))^(level-1)
	SoftDropSpeed ((.8-((level-1)*.007))^(level-1))/20
	HardDropSpeed 0.0001
	MoveTolerance 1
}

LockPhase
{
	MovementRestartsClock
	Duration 0.5
}

PatternPhase
{
	PatternBeginScript
	{
		set pl.d4 to -1
		set pl.d5 to -1
	}
}

IteratePhase
{
	PrimaryIterator
	{
		IteratorExpression pl.d4 != -1
		MinoIteratorScript
		{
			if mino.y > pl.d5
				exit
			end
			if mino.y < pl.d4
				exit
			end
			mutate mino
			sound "FX_LOCK"
		}
	}
	IterateEndScript
	{
		if pl.d4 != -1
			set gravity to 1
		end
		set pl.d6 to 0
	}
}

EliminatePhase
{
	FallSpeed 0.05
	LineCollapsedScript
	{
		set ph.d0 to ph.d0 + 1
	}
	StartFallingScript
	{
		set goal to goal - pf.d0
		set pf.d0 to 0
		if ph.d0 = 1
		line color (109,0,23)
		end
		if ph.d0 = 2
		line color (39,0,87)
		end
		if ph.d0 = 3
		line color (116,55,0)
		end
		if ph.d0 >= 4
		line color (0,91,56)
		end
	}
	GroupLandedScript
	{
		sound "FX_LNE01"
	}
	EliminateEndScript
	{
		set st2.d8 to goal
		if ph.d0 = 1
		 if pf.d4
		  set goal to goal - 1
		set st2.d9 to st2.d8 - goal
				message "T-spin"
		 end
			sound "FX_MTRS1"
		 set goal to goal -1
		set st2.d9 to st2.d8 - goal
		set st0.d0 to st0.d0 + 1
		message "Single"
		end
		if ph.d0 = 2
		 if pf.d4
		  set goal to goal - 3
		set st2.d9 to st2.d8 - goal
				message "T-spin"
		 end
			sound "FX_MTRS2"
			set goal to goal -3
		set st2.d9 to st2.d8 - goal
		set st0.d1 to st0.d1 + 1
		message "Double"
			send "Attack1"
		end
		if ph.d0 = 3
			sound "FX_MTRS3"
			set goal to goal -5
		set st2.d9 to st2.d8 - goal
		set st0.d2 to st0.d2 + 1
		message "Triple"
			send "Attack2"
		end
		if ph.d0 >= 4
			sound "FX_MTRS4"
		 set goal to goal -8
		set st2.d9 to st2.d8 - goal
		set st0.d3 to st0.d3 + 1
		message "Tetris!"
			send "Attack3"
		end
		if goal < 0
		 set goal to 0
		end
	}
}

SolidifyPhase
{
}

GravityPhase
{
	FallSpeed 0.05
	GroupLandedScript
	{
		sound "FX_LOCK"
	}
	GravityEndScript
	{
		set gravity to 0
	}
}

CompletionPhase
{
	CompletionBeginScript
	{
		if goal <= 0
			next level
			if level < 15
				sound "FX_LEVEL"
		 message "LEVEL UP!"
			end
		end
	}
}

EventScripts
{
	GameStartScript
	{
		sound "FX_LEVEL"
		set ghost to 1
		set st0.d0 to 0
		set st0.d1 to 0
		set st0.d2 to 0
		set st0.d3 to 0
		set st0.d4 to 0
		set st0.d5 to 0
		set st0.d7 to 0
		set st0.d8 to 0
		set st1.d1 to 0
		set st1.d2 to 0
		line color (30,30,30)
	}
	LevelStartScript
	{
		mino intensity high
		set pf.d3 to 0
		set goal to (10*level)
		set pf.d7 to 0
	}
	LevelEndScript
	{
		if level >= 15
			win
		end
	}
	MoveSuccessfulScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	MoveFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	RotateSuccessfulScript
	{
		sound "FX_RTA01"
		set st0.d5 to st0.d5 + 1
	}
	RotateFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	HardDropStartScript
	{
		sound "FX_HRDDP"
		set st0.d5 to st0.d5 + 1
		set pf.d2 to 0
	}
	SoftDropStepScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	FallStepScript
	{
		sound "FX_FALL"
	}
	TouchdownScript
	{
		if pf.d2
		 sound "FX_LND01"
		end
	}
	LockdownScript
	{
		if pf.d2
		 sound "FX_LCK01"
		end
		if piece.id = 7
			if spin
				shape "T-spin 1" at piece.x, piece.y
				if result = 1
		  	if piece.dir = 3
			  	pattern "t-spin top" at piece.x,piece.y-1
				  pattern "t-spin bottom" at piece.x,piece.y
			  else
				  pattern "t-spin top" at piece.x,piece.y
				  pattern "t-spin bottom" at piece.x,piece.y+1
			  end
		   if level < 6
		    sound "VO_TSPIN"
		   else
		    sound "FX_RWD01"
		   end
		   set goal to goal -1 
					set pf.d4 to 1
				else
					shape "T-spin 2" at piece.x, piece.y
					if result = 1
		  	if piece.dir = 3
			  	pattern "t-spin top" at piece.x,piece.y-1
				  pattern "t-spin bottom" at piece.x,piece.y
			  else
				  pattern "t-spin top" at piece.x,piece.y
				  pattern "t-spin bottom" at piece.x,piece.y+1
			  end
		    if level < 6
		     sound "VO_TSPIN"
		    else
		     sound "FX_RWD01"
		    end
		    set goal to goal -1 
						set pf.d4 to 1
					end
				end
			end
		end
	}
	GameSecondScript
	{
		set st0.d8 to game time
	}
	LevelSecondScript
	{
		set st0.d7 to level time
	}
}

CustomEvent
{
	Name "Attack1"
	TriggerType Manual
	Script
	{
		set pl.d0 to pl.d0 + 4
		mix garbage
		garbage 1
		sound "FX_GAR01"
	}
}

CustomEvent
{
	Name "Attack2"
	TriggerType Manual
	Script
	{
		set pl.d0 to pl.d0 + 4
		mix garbage
		garbage 2
		sound "FX_GAR02"
	}
}

CustomEvent
{
	Name "Attack3"
	TriggerType Manual
	Script
	{
		set pl.d0 to pl.d0 + 4
		mix garbage
		garbage 4
		sound "FX_GAR03"
	}
}

CustomEvent
{
	Name "Countdown"
	TriggerType LevelTime 109
	Script
	{
		message "COUNTDOWN!"
	}
}

CustomEvent
{
	Name "10"
	TriggerType LevelTime 110
	Script
	{
		sound "FX_TIC10"
	}
}

CustomEvent
{
	Name "9"
	TriggerType LevelTime 111
	Script
	{
		sound "FX_TIC09"
	}
}

CustomEvent
{
	Name "8"
	TriggerType LevelTime 112
	Script
	{
		sound "FX_TIC08"
	}
}

CustomEvent
{
	Name "7"
	TriggerType LevelTime 113
	Script
	{
		sound "FX_TIC07"
	}
}

CustomEvent
{
	Name "6"
	TriggerType LevelTime 114
	Script
	{
		sound "FX_TIC06"
	}
}

CustomEvent
{
	Name "5"
	TriggerType LevelTime 115
	Script
	{
		sound "FX_TIC05"
	}
}

CustomEvent
{
	Name "4"
	TriggerType LevelTime 116
	Script
	{
		sound "FX_TIC04"
	}
}

CustomEvent
{
	Name "3"
	TriggerType LevelTime 117
	Script
	{
		sound "FX_TIC03"
	}
}

CustomEvent
{
	Name "2"
	TriggerType LevelTime 118
	Script
	{
		sound "FX_TIC02"
	}
}

CustomEvent
{
	Name "1"
	TriggerType LevelTime 119
	Script
	{
		sound "FX_TIC01"
	}
}

MTET2001.TWS

//   FILE: Ultra Tetris v7.2DP.tws
// SOURCE: Ultra Tetris v7.2DP
//   DATE: Wed, Oct 31, 2001  12:38:42 PM


GeneralInfo
{
	PlayfieldColumns 10
	PlayfieldRows 22
	MaxMovementsPerSecond 15
	MaxRotationsPerSecond 5
	GameType Levels
	RemoveFromBagAfterUse
	NextPieceQueueSize 8
}

MinoSticky
{
	NotStickyBetweenPieces
	1: 1
	2: 2
	3: 3
	4: 4
	5: 5
	6: 6
	7: 7
	31: 31
}

Mino
{
	Name "J color"
	Tags 0,1
}

Mino
{
	Name "L color"
	Tags 0,2
}

Mino
{
	Name "S color"
	Tags 0,3
}

Mino
{
	Name "Z color"
	Tags 0,4
}

Mino
{
	Name "O color"
	Tags 0,5
}

Mino
{
	Name "T color"
	Tags 0,6
}

Mino
{
	Name "I color"
	Tags 0,7
}

Mino
{
	Name "Garbage"
	Tags 0,31
}

Tetramino
{
	Name "T Tetrimino"
	NumberInBag 1
	ID 1
	MinoList
	{
		"T color" (0,1)
		"T color" (-1,0)
		"T color" (0,0)
		"T color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "J Tetrimino"
	NumberInBag 1
	ID 2
	MinoList
	{
		"J color" (-1,1)
		"J color" (-1,0)
		"J color" (0,0)
		"J color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "L Tetrimino"
	NumberInBag 1
	ID 3
	MinoList
	{
		"L color" (1,1)
		"L color" (-1,0)
		"L color" (0,0)
		"L color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "S Tetrimino"
	NumberInBag 1
	ID 4
	MinoList
	{
		"S color" (0,1)
		"S color" (1,1)
		"S color" (-1,0)
		"S color" (0,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "Z Tetrimino"
	NumberInBag 1
	ID 5
	MinoList
	{
		"Z color" (-1,1)
		"Z color" (0,1)
		"Z color" (0,0)
		"Z color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "I Tetrimino"
	NumberInBag 1
	ID 6
	MinoList
	{
		"I color" (-1,0)
		"I color" (0,0)
		"I color" (1,0)
		"I color" (2,0)
	}
	Rot0CWOffsetList (0,0),(-1,0),(2,0),(-1,0),(2,0)
	Rot90CWOffsetList (-1,0),(0,0),(0,0),(0,1),(0,-2)
	Rot180CWOffsetList (-1,1),(1,1),(-2,1),(1,0),(-2,0)
	Rot270CWOffsetList (0,1),(0,1),(0,1),(0,-1),(0,2)
}

Tetramino
{
	Name "O Tetrimino"
	NumberInBag 1
	ID 7
	MinoList
	{
		"O color" (0,1)
		"O color" (1,1)
		"O color" (0,0)
		"O color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,-1),(0,-1),(0,-1),(0,-1),(0,-1)
	Rot180CWOffsetList (-1,-1),(-1,-1),(-1,-1),(-1,-1),(-1,-1)
	Rot270CWOffsetList (-1,0),(-1,0),(-1,0),(-1,0),(-1,0)
}

GarbageInfo
{
	NormalMino "Garbage"
	NormalCount 9
}

Shape
{
	Name "T-spin1"
	Hotspot (7,8)
	ShapeCoords (6,9),(6,7),(8,7)
}

Shape
{
	Name "T-spin2"
	Hotspot (7,8)
	ShapeCoords (6,7),(8,9),(8,7)
}

Pattern
{
	Name "Line clear"
	Tags 0
	Method Search
	SearchType Horizontal
	SearchCount 10
	PatternMinoScript
	{
		kill mino
	}
	PatternEndScript
	{
		sound "FX_CLR01"
	}
}

Level
{
	Name "Level #1"
}

Level
{
	Name "Level #2"
}

Level
{
	Name "Level #3"
}

Level
{
	Name "Level #4"
}

Level
{
	Name "Level #5"
}

Level
{
	Name "Level #6"
}

Level
{
	Name "Level #7"
}

Level
{
	Name "Level #8"
}

Level
{
	Name "Level #9"
}

Level
{
	Name "Level #10"
}

Level
{
	Name "Level #11"
}

Level
{
	Name "Level #12"
}

Level
{
	Name "Level #13"
}

Level
{
	Name "Level #14"
}

Level
{
	Name "Level #15"
}

GenerationPhase
{
	GenerationTime ((.8-((level-1)*.007))^(level-1))/20
	PieceStartingLocation (4,0)
	GenerationBeginScript
	{
		set pf.d2 to 1
		set pf.d4 to 0
	}
	GenerationEndScript
	{
		set st0.d4 to st0.d4 + 1
	}
}

FallingPhase
{
	FallSpeed (.8-((level-1)*.007))^(level-1)
	SoftDropSpeed ((.8-((level-1)*.007))^(level-1))/20
	HardDropSpeed 0.0001
	MoveTolerance 1
}

LockPhase
{
	MovementRestartsClock
	Duration 0.5
}

PatternPhase
{
}

IteratePhase
{
}

EliminatePhase
{
	FallSpeed 0.1
	LineCollapsedScript
	{
		set ph.d0 to ph.d0 + 1
	}
	StartFallingScript
	{
		if ph.d0 = 1
		line color (109,0,23)
		end
		if ph.d0 = 2
		line color (39,0,87)
		end
		if ph.d0 = 3
		line color (116,55,0)
		end
		if ph.d0 = 4
			line color (0,91,56)
		 if pf.d3
				line color (118,119,0)
		 else
		 	set pf.d3 to 1
			end
		end
	}
	GroupLandedScript
	{
		sound "FX_LNE01"
	}
	EliminateEndScript
	{
		set st2.d8 to goal
		if ph.d0 = 1
			sound "FX_MTRS1"
		 set goal to goal -1
		set st2.d9 to st2.d8 - goal
			set st0.d0 to st0.d0 + 1
			message "Single"
		 set pf.d3 to 0
		 if pf.d4
		  set goal to goal -1
		set st2.d9 to st2.d8 - goal
				message "T-spin"
		 end
		end
		if ph.d0 = 2
			sound "FX_MTRS2"
			set goal to goal -3
		set st2.d9 to st2.d8 - goal
			set st0.d1 to st0.d1 + 1
			message "Double"
		 set pf.d3 to 0
		 if pf.d4
		  set goal to goal -3
		set st2.d9 to st2.d8 - goal
				message "T-spin"
		 end
		send "attack1"
		end
		if ph.d0 = 3
			sound "FX_MTRS3"
			set goal to goal -5
		set st2.d9 to st2.d8 - goal
			set st0.d2 to st0.d2 + 1
			message "Triple"
		 set pf.d3 to 0
		send "attack2"
		end
		if ph.d0 = 4
			sound "FX_MTRS4"
		 if pf.d3
		  set goal to goal -4
		set st2.d9 to st2.d8 - goal
		set st0.d9 to st0.d9 + 1
		message "B2B Tetris!!!"
		  	sound "FX_MTRS5"
		 else
		 set pf.d3 to 1
		message "Tetris!"
			end
		 set goal to goal -8
		set st2.d9 to st2.d8 - goal
		set st0.d3 to st0.d3 + 1
		send "attack3"
		end
		if goal < 0
		 set goal to 0
		end
	}
}

SolidifyPhase
{
}

GravityPhase
{
	FallSpeed 0.1
	GroupLandedScript
	{
		sound "FX_LOCK"
	}
}

CompletionPhase
{
	CompletionBeginScript
	{
		if goal <= 0
			next level
			if level < 15
				sound "FX_LEVEL"
		 message "LEVEL UP!"
			end
		end
	}
}

EventScripts
{
	GameStartScript
	{
		sound "FX_LEVEL"
		set ghost to 1
		set st0.d0 to 0
		set st0.d1 to 0
		set st0.d2 to 0
		set st0.d3 to 0
		set st0.d4 to 0
		set st0.d5 to 0
		set st0.d7 to 0
		set st0.d8 to 0
		set st0.d9 to 0
		set st1.d0 to 0
		line color (30,30,30)
	}
	LevelStartScript
	{
		mino intensity high
		set pf.d3 to 0
		set goal to (5*level)
		set pf.d7 to 0
		set pl.d9 to goal
		set pl.d8 to goal
	}
	LevelEndScript
	{
		if level >= 15
		 sound "VO_EXLNT"
		 win
		end
	}
	MoveSuccessfulScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	MoveFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	RotateSuccessfulScript
	{
		sound "FX_RTA01"
		set st0.d5 to st0.d5 + 1
	}
	RotateFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	HardDropStartScript
	{
		sound "FX_HRDDP"
		set st0.d5 to st0.d5 + 1
		set pf.d2 to 0
	}
	SoftDropStepScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	FallStepScript
	{
		sound "FX_FALL"
	}
	TouchdownScript
	{
		if pf.d2
		 sound "FX_LND01"
		end
	}
	LockdownScript
	{
		if pf.d2
		 sound "FX_LCK01"
		end
		if piece.id = 1
			if spin
				shape "T-spin1" at piece.x, piece.y
				if result = 1
		   if level < 6
		    sound "FX_RWD02"
		   else
		    sound "FX_RWD02"
		   end
		   set goal to goal -1 
					set pf.d4 to 1
					set st1.d0 to st1.d0 + 1
				else
					shape "T-spin2" at piece.x, piece.y
					if result = 1
		    if level < 6
		     sound "FX_RWD02"
		    else
		     sound "FX_RWD02"
		    end
		    set goal to goal -1 
						set pf.d4 to 1
						set st1.d0 to st1.d0 + 1
					end
				end
			end
		end
	}
	GameSecondScript
	{
		set st0.d8 to game time
	}
	LevelSecondScript
	{
		set st0.d7 to level time
	}
}

CustomEvent
{
	Name "Attack1"
	TriggerType Manual
	Script
	{
		set pl.d0 to pl.d0 + 1
		mix garbage
		garbage 1
		sound "FX_GAR01"
	}
}

CustomEvent
{
	Name "Attack2"
	TriggerType Manual
	Script
	{
		set pl.d0 to pl.d0 + 2
		mix garbage
		garbage 2
		sound "FX_GAR02"
	}
}

CustomEvent
{
	Name "Attack3"
	TriggerType Manual
	Script
	{
		set pl.d0 to pl.d0 + 4
		mix garbage
		garbage 4
		sound "FX_GAR03"
	}
}

CustomEvent
{
	Name "Countdown"
	TriggerType LevelTime 109
	Script
	{
		message "COUNTDOWN!"
	}
}

CustomEvent
{
	Name "10"
	TriggerType LevelTime 110
	Script
	{
		sound "FX_TIC10"
	}
}

CustomEvent
{
	Name "9"
	TriggerType LevelTime 111
	Script
	{
		sound "FX_TIC09"
	}
}

CustomEvent
{
	Name "8"
	TriggerType LevelTime 112
	Script
	{
		sound "FX_TIC08"
	}
}

CustomEvent
{
	Name "7"
	TriggerType LevelTime 113
	Script
	{
		sound "FX_TIC07"
	}
}

CustomEvent
{
	Name "6"
	TriggerType LevelTime 114
	Script
	{
		sound "FX_TIC06"
	}
}

CustomEvent
{
	Name "5"
	TriggerType LevelTime 115
	Script
	{
		sound "FX_TIC05"
	}
}

CustomEvent
{
	Name "4"
	TriggerType LevelTime 116
	Script
	{
		sound "FX_TIC04"
	}
}

CustomEvent
{
	Name "3"
	TriggerType LevelTime 117
	Script
	{
		sound "FX_TIC03"
	}
}

CustomEvent
{
	Name "2"
	TriggerType LevelTime 118
	Script
	{
		sound "FX_TIC02"
	}
}

CustomEvent
{
	Name "1"
	TriggerType LevelTime 119
	Script
	{
		sound "FX_TIC01"
	}
}

MTNT.TWS

//   FILE: Ultra Sticky Tetris v7.2DP.tws
// SOURCE: Ultra Sticky Tetris v7.2DP
//   DATE: Wed, Oct 31, 2001  12:38:32 PM


GeneralInfo
{
	PlayfieldColumns 10
	PlayfieldRows 22
	MaxMovementsPerSecond 15
	MaxRotationsPerSecond 5
	GameType Levels
	RemoveFromBagAfterUse
	NextPieceQueueSize 8
}

MinoSticky
{
	1: 1
	2: 2
	3: 3
	4: 4
	5: 5
	6: 6
	7: 7
}

Mino
{
	Name "T"
	Tags 0,1
	AltMino "L"
	AltChance 20
}

Mino
{
	Name "S"
	Tags 0,2
	AltMino "J"
	AltChance 20
}

Mino
{
	Name "Z"
	Tags 0,3
	AltMino "O"
	AltChance 20
}

Mino
{
	Name "O"
	Tags 0,4
	AltMino "I"
	AltChance 20
}

Mino
{
	Name "L"
	Tags 0,5
	AltMino "Z"
	AltChance 20
}

Mino
{
	Name "J"
	Tags 0,6
	AltMino "T"
	AltChance 20
}

Mino
{
	Name "I"
	Tags 0,7
	AltMino "S"
	AltChance 20
}

Mino
{
	Name "special garbage"
	Antigravity
	Tags 0,30
}

Mino
{
	Name "garbage"
	Antigravity
	Tags 31
}

Tetramino
{
	Name "T"
	NumberInBag 1
	ID 1
	MinoList
	{
		"T" (0,1)
		"T" (-1,0)
		"T" (0,0)
		"T" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "J"
	NumberInBag 1
	ID 2
	MinoList
	{
		"J" (-1,1)
		"J" (-1,0)
		"J" (0,0)
		"J" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "L"
	NumberInBag 1
	ID 3
	MinoList
	{
		"L" (1,1)
		"L" (-1,0)
		"L" (0,0)
		"L" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "S"
	NumberInBag 1
	ID 4
	MinoList
	{
		"S" (0,1)
		"S" (1,1)
		"S" (-1,0)
		"S" (0,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "Z"
	NumberInBag 1
	ID 5
	MinoList
	{
		"Z" (-1,1)
		"Z" (0,1)
		"Z" (0,0)
		"Z" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "I"
	NumberInBag 1
	ID 6
	MinoList
	{
		"I" (-1,0)
		"I" (0,0)
		"I" (1,0)
		"I" (2,0)
	}
	Rot0CWOffsetList (0,0),(-1,0),(2,0),(-1,0),(2,0)
	Rot90CWOffsetList (-1,0),(0,0),(0,0),(0,1),(0,-2)
	Rot180CWOffsetList (-1,1),(1,1),(-2,1),(1,0),(-2,0)
	Rot270CWOffsetList (0,1),(0,1),(0,1),(0,-1),(0,2)
}

Tetramino
{
	Name "O"
	NumberInBag 1
	ID 7
	MinoList
	{
		"O" (0,1)
		"O" (1,1)
		"O" (0,0)
		"O" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,-1),(0,-1),(0,-1),(0,-1),(0,-1)
	Rot180CWOffsetList (-1,-1),(-1,-1),(-1,-1),(-1,-1),(-1,-1)
	Rot270CWOffsetList (-1,0),(-1,0),(-1,0),(-1,0),(-1,0)
}

GarbageInfo
{
	NormalMino "garbage"
	NormalCount pf.d9
	SpecialMino "special garbage"
	SpecialCount pf.d8
}

Shape
{
	Name "tspin1"
	Hotspot (7,8)
	ShapeCoords (6,9),(6,7),(8,7)
}

Shape
{
	Name "tspin2"
	Hotspot (7,8)
	ShapeCoords (6,7),(8,9),(8,7)
}

Pattern
{
	Name "line clear"
	Tags 0,1,2,3,4,5,6,7,30,31
	Method Search
	SearchType Horizontal
	SearchCount 10
	PatternMinoScript
	{
		kill mino
		sound "FX_CLR01"
	}
	PatternEndScript
	{
		set st1.d3 to st1.d3 + 1
	}
}

Pattern
{
	Name "Critical Mass Blue"
	Tags 1
	Method Search
	SearchType FloodFill4D
	SearchCount 24
	PatternMinoScript
	{
		kill mino
		message "Critical Mass!"
		sound "FX_MASS1"
	}
	PatternEndScript
	{
		set st1.d7 to ((st1.d7 / 24) + 1)
	}
}

Pattern
{
	Name "Critical Mass Cyan"
	Tags 2
	Method Search
	SearchType FloodFill4D
	SearchCount 24
	PatternMinoScript
	{
		kill mino
		message "Critical Mass!"
		sound "FX_MASS1"
	}
	PatternEndScript
	{
		set st1.d7 to ((st1.d7 / 24) + 1)
	}
}

Pattern
{
	Name "Critical Mass Green"
	Tags 3
	Method Search
	SearchType FloodFill4D
	SearchCount 24
	PatternMinoScript
	{
		kill mino
		message "Critical Mass!"
		sound "FX_MASS1"
	}
	PatternEndScript
	{
		set st1.d7 to ((st1.d7 / 24) + 1)
	}
}

Pattern
{
	Name "Critical Mass Red"
	Tags 4
	Method Search
	SearchType FloodFill4D
	SearchCount 24
	PatternMinoScript
	{
		kill mino
		message "Critical Mass!"
		sound "FX_MASS1"
	}
	PatternEndScript
	{
		set st1.d7 to ((st1.d7 / 24) + 1)
	}
}

Pattern
{
	Name "Critical Mass Maroon"
	Tags 5
	Method Search
	SearchType FloodFill4D
	SearchCount 24
	PatternMinoScript
	{
		kill mino
		message "Critical Mass!"
		sound "FX_MASS1"
	}
	PatternEndScript
	{
		set st1.d7 to ((st1.d7 / 24) + 1)
	}
}

Pattern
{
	Name "Critical Mass Yellow"
	Tags 6
	Method Search
	SearchType FloodFill4D
	SearchCount 24
	PatternMinoScript
	{
		kill mino
		message "Critical Mass!"
		sound "FX_MASS1"
	}
	PatternEndScript
	{
		set st1.d7 to ((st1.d7 / 24) + 1)
	}
}

Pattern
{
	Name "Critical Mass Purple"
	Tags 7
	Method Search
	SearchType FloodFill4D
	SearchCount 24
	PatternMinoScript
	{
		kill mino
		message "Critical Mass!"
		sound "FX_MASS1"
	}
	PatternEndScript
	{
		set st1.d7 to ((st1.d7 / 24) + 1)
	}
}

Level
{
	Name "Level #1"
}

Level
{
	Name "Level #2"
}

Level
{
	Name "Level #3"
}

Level
{
	Name "Level #4"
}

Level
{
	Name "Level #5"
}

Level
{
	Name "Level #6"
}

Level
{
	Name "Level #7"
}

Level
{
	Name "Level #8"
}

Level
{
	Name "Level #9"
}

Level
{
	Name "Level #10"
}

Level
{
	Name "Level #11"
}

Level
{
	Name "Level #12"
}

Level
{
	Name "Level #13"
}

Level
{
	Name "Level #14"
}

Level
{
	Name "Level #15"
}

GenerationPhase
{
	GenerationTime ((.8-((level-1)*.007))^(level-1))/20
	PieceStartingLocation (4,0)
	GenerationBeginScript
	{
		set pf.d2 to 1
		set pf.d4 to 0
	}
	GenerationEndScript
	{
		set st0.d4 to st0.d4 + 1
	}
}

FallingPhase
{
	FallSpeed (.8-((level-1)*.007))^(level-1)
	SoftDropSpeed ((.8-((level-1)*.007))^(level-1))/20
	HardDropSpeed 0.0001
	MoveTolerance 1
}

LockPhase
{
	MovementRestartsClock
	Duration 0.5
}

PatternPhase
{
}

IteratePhase
{
}

EliminatePhase
{
	FallSpeed 0.05
	EliminateBeginScript
	{
		set ph.d0 to 0
	}
	LineCollapsedScript
	{
		set ph.d0 to ph.d0 + 1
	}
	GroupLandedScript
	{
		sound "FX_LNE01"
	}
	EliminateEndScript
	{
		if ph.d0 > 0
		 if cascades = 2
		 set st1.d4 to st1.d4 + 2
		 end
			if cascades > 2
			set st1.d4 to st1.d4 + 1
			end
		end
		if ph.d0 >= st1.d6
			set st1.d6 to ph.d0
		end
	}
}

SolidifyPhase
{
	IteratorTags 30
	MinoIteratorScript
	{
		set ph.d7 to ph.d7+ 1
	}
	SolidifyEndScript
	{
		If ph.d7 = 0
			sound "FX_LEVEL"
			next level
		end
	}
}

GravityPhase
{
	GravityEnabled
	FallSpeed 0.05
	GroupLandedScript
	{
		sound "FX_LOCK"
	}
}

CompletionPhase
{
	CompletionEndScript
	{
		if cascades > st1.d5
			set st1.d5 to cascades
		end
		if cascades = 2
		message "2 Cascade"
		line color (109,0,23)
		 sound "FX_MTRS1"
		end
		if cascades = 3
		message "3 Cascades"
		line color (39,0,87)
		 sound "FX_MTRS2"
		end
		if cascades = 4
		message "4 Cascades"
		line color (39,0,87)
		 sound "FX_MTRS3"
		end
		if cascades = 5
		message "5 Cascades"
		line color (116,55,0)
		 sound "FX_MTRS4"
		end
		if cascades = 6
		message "6 Cascades"
		line color (116,55,0)
		 sound "FX_MTRS5"
		end
		if cascades = 7
		message "7 Cascades"
		line color (0,91,56)
		 sound "FX_MTRS6"
		end
		if cascades = 8
			message "8 Cascades"
		line color (0,91,56)
		 sound "FX_MTRS6"
		end
		if cascades = 9
			message "9 Cascades"
		line color (118,119,0)
		 sound "FX_MTRS6"
		end
		if cascades = 10
			message "10 Cascades"
		line color (118,119,0)
		 sound "FX_MTRS6"
		end
		if cascades >= 11
			message "Super Cascade!!!"
		line color (0,36,154)
		 sound "FX_MTRS6"
		end
	}
}

EventScripts
{
	GameStartScript
	{
		sound "FX_LEVEL"
		set ghost to 1
		set st1.d3 to 0
		set st1.d4 to 0
		set st1.d5 to 0
		set st1.d6 to 0
		set st1.d7 to 0
		set st0.d4 to 0
		set st0.d5 to 0
		set st0.d7 to 0
		set st0.d8 to 0
		line color (30,30,30)
	}
	LevelStartScript
	{
		mino intensity high
		set pf.d0 to 0
		set pf.d8 to 0
		set pf.d9 to 5
		mixed garbage level
		set pf.d9 to 0
		set pf.d8 to 5
		mixed garbage 1
		set pf.d7 to 0
	}
	LevelEndScript
	{
		if level >= 15
		 sound "VO_EXLNT"
		 win
		end
	}
	MoveSuccessfulScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	MoveFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	RotateSuccessfulScript
	{
		sound "FX_RTA01"
		set st0.d5 to st0.d5 + 1
	}
	RotateFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	HardDropStartScript
	{
		sound "FX_HRDDP"
		set st0.d5 to st0.d5 + 1
		set pf.d2 to 0
	}
	SoftDropStepScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	FallStepScript
	{
		sound "FX_FALL"
	}
	TouchdownScript
	{
		if pf.d2
		 sound "FX_LND01"
		end
	}
	LockdownScript
	{
		if pf.d2
		 sound "FX_LCK01"
		end
		if piece.id = 1
			if spin
				shape "T-spin1" at piece.x, piece.y
				if result = 1
		   if level < 6
		    sound "VO_TSPIN"
		   else
		    sound "FX_RWD01"
		   end
					set pf.d4 to 1
				else
					shape "T-spin2" at piece.x, piece.y
					if result = 1
		    if level < 6
		     sound "VO_TSPIN"
		    else
		     sound "FX_RWD01"
		    end
						set pf.d4 to 1
					end
				end
			end
		end
	}
	GameSecondScript
	{
		set st0.d8 to game time
	}
	LevelSecondScript
	{
		set st0.d7 to level time
	}
}

CustomEvent
{
	Name "Countdown"
	TriggerType LevelTime 109
	Script
	{
		message "COUNTDOWN!"
	}
}

CustomEvent
{
	Name "10"
	TriggerType LevelTime 110
	Script
	{
		sound "FX_TIC10"
	}
}

CustomEvent
{
	Name "9"
	TriggerType LevelTime 111
	Script
	{
		sound "FX_TIC09"
	}
}

CustomEvent
{
	Name "8"
	TriggerType LevelTime 112
	Script
	{
		sound "FX_TIC08"
	}
}

CustomEvent
{
	Name "7"
	TriggerType LevelTime 113
	Script
	{
		sound "FX_TIC07"
	}
}

CustomEvent
{
	Name "6"
	TriggerType LevelTime 114
	Script
	{
		sound "FX_TIC06"
	}
}

CustomEvent
{
	Name "5"
	TriggerType LevelTime 115
	Script
	{
		sound "FX_TIC05"
	}
}

CustomEvent
{
	Name "4"
	TriggerType LevelTime 116
	Script
	{
		sound "FX_TIC04"
	}
}

CustomEvent
{
	Name "3"
	TriggerType LevelTime 117
	Script
	{
		sound "FX_TIC03"
	}
}

CustomEvent
{
	Name "2"
	TriggerType LevelTime 118
	Script
	{
		sound "FX_TIC02"
	}
}

CustomEvent
{
	Name "1"
	TriggerType LevelTime 119
	Script
	{
		sound "FX_TIC01"
	}
}

ORIGINAL.TWS

//   FILE: Original Tetris v7.2DP.tws
// SOURCE: Original Tetris v7.2DP
//   DATE: Wed, Oct 31, 2001  12:37:05 PM


GeneralInfo
{
	PlayfieldColumns 10
	PlayfieldRows 20
	MaxMovementsPerSecond 10
	MaxRotationsPerSecond 5
	GameType Marathon
	RemoveFromBagAfterUse
	NextPieceQueueSize 8
}

MinoSticky
{
	NotStickyBetweenPieces
	1: 1
	2: 2
	3: 3
	4: 4
	5: 5
	6: 6
	7: 7
}

Mino
{
	Name "Brackets"
	Tags 0,1
}

Tetramino
{
	Name "T Tetrimino"
	NumberInBag 1
	ID 1
	MinoList
	{
		"Brackets" (-1,0)
		"Brackets" (0,0)
		"Brackets" (1,0)
		"Brackets" (0,-1)
	}
	Rot0CWOffsetList (0,0)
	Rot90CWOffsetList (0,0)
	Rot180CWOffsetList (0,0)
	Rot270CWOffsetList (0,0)
}

Tetramino
{
	Name "J Tetrimino"
	NumberInBag 1
	ID 2
	MinoList
	{
		"Brackets" (-1,0)
		"Brackets" (0,0)
		"Brackets" (1,0)
		"Brackets" (1,-1)
	}
	Rot0CWOffsetList (0,0)
	Rot90CWOffsetList (0,0)
	Rot180CWOffsetList (0,0)
	Rot270CWOffsetList (0,0)
}

Tetramino
{
	Name "L Tetrimino"
	NumberInBag 1
	ID 3
	MinoList
	{
		"Brackets" (-1,0)
		"Brackets" (0,0)
		"Brackets" (1,0)
		"Brackets" (-1,-1)
	}
	Rot0CWOffsetList (0,0)
	Rot90CWOffsetList (0,0)
	Rot180CWOffsetList (0,0)
	Rot270CWOffsetList (0,0)
}

Tetramino
{
	Name "S Tetrimino"
	NumberInBag 1
	ID 4
	MinoList
	{
		"Brackets" (0,1)
		"Brackets" (1,1)
		"Brackets" (-1,0)
		"Brackets" (0,0)
	}
	Rot0CWOffsetList (0,1)
	Rot90CWOffsetList (1,0)
	Rot180CWOffsetList (0,0)
	Rot270CWOffsetList (0,0)
}

Tetramino
{
	Name "Z Tetrimino"
	NumberInBag 1
	ID 5
	MinoList
	{
		"Brackets" (-1,1)
		"Brackets" (0,1)
		"Brackets" (0,0)
		"Brackets" (1,0)
	}
	Rot0CWOffsetList (0,1)
	Rot90CWOffsetList (0,0)
	Rot180CWOffsetList (0,0)
	Rot270CWOffsetList (-1,0)
}

Tetramino
{
	Name "I Tetrimino"
	NumberInBag 1
	ID 6
	MinoList
	{
		"Brackets" (-1,0)
		"Brackets" (0,0)
		"Brackets" (1,0)
		"Brackets" (2,0)
	}
	Rot0CWOffsetList (0,0)
	Rot90CWOffsetList (0,0)
	Rot180CWOffsetList (0,0)
	Rot270CWOffsetList (0,0)
}

Tetramino
{
	Name "O Tetrimino"
	NumberInBag 1
	ID 7
	MinoList
	{
		"Brackets" (0,0)
		"Brackets" (1,0)
		"Brackets" (0,-1)
		"Brackets" (1,-1)
	}
	Rot0CWOffsetList (0,0)
	Rot90CWOffsetList (-1,0)
	Rot180CWOffsetList (-1,1)
	Rot270CWOffsetList (0,1)
}

Pattern
{
	Name "Line clear"
	Tags 0
	Method Search
	SearchType Horizontal
	SearchCount 10
	PatternMinoScript
	{
		kill mino
	}
}

Level
{
	Name "Level #1"
}

Level
{
	Name "Level #2"
}

Level
{
	Name "Level #3"
}

Level
{
	Name "Level #4"
}

Level
{
	Name "Level #5"
}

Level
{
	Name "Level #6"
}

Level
{
	Name "Level #7"
}

Level
{
	Name "Level #8"
}

Level
{
	Name "Level #9"
}

Level
{
	Name "Level #10"
}

Level
{
	Name "Level #11"
}

Level
{
	Name "Level #12"
}

Level
{
	Name "Level #13"
}

Level
{
	Name "Level #14"
}

Level
{
	Name "Level #15"
}

GenerationPhase
{
	GenerationTime 0.22 - (level-1) *.017
	PieceStartingLocation (4,0)
	GenerationBeginScript
	{
		set pf.d0 to 24 + (level -1) * 3
	}
	GenerationEndScript
	{
		set st0.d4 to st0.d4 + 1
	}
}

FallingPhase
{
	FallSpeed 0.22 - (level-1) *.017
	SoftDropSpeed 0
	HardDropSpeed 0.0001
	MoveTolerance 1
}

LockPhase
{
	Duration .5
}

PatternPhase
{
}

IteratePhase
{
}

EliminatePhase
{
	FallSpeed 0
	LineCollapsedScript
	{
		set ph.d0 to ph.d0 + 1
	}
	EliminateEndScript
	{
		if ph.d0 = 1
			set st0.d0 to st0.d0 + 1
		end
		if ph.d0 = 2
			set st0.d1 to st0.d1 + 1
		end
		if ph.d0 = 3
			set st0.d2 to st0.d2 + 1
		end
		if ph.d0 = 4
			set st0.d3 to st0.d3 + 1
		end
	}
}

SolidifyPhase
{
}

GravityPhase
{
	FallSpeed 0
}

CompletionPhase
{
	CompletionBeginScript
	{
		score pf.d0
		if lines >= goal
			next level
		end
	}
	CompletionEndScript
	{
		set st0.d6 to score
	}
}

EventScripts
{
	GameStartScript
	{
		set st0.d0 to 0
		set st0.d1 to 0
		set st0.d2 to 0
		set st0.d3 to 0
		set st0.d4 to 0
		set st0.d5 to 0
		set st0.d6 to 0
		set st0.d8 to 0
	}
	LevelStartScript
	{
		set pf.d3 to 0
		set goal to goal + 10
	}
	LevelEndScript
	{
		if level >= 11
		 win
		end
	}
	MoveSuccessfulScript
	{
		set st0.d5 to st0.d5 + 1
	}
	MoveFailedScript
	{
		set st0.d5 to st0.d5 + 1
	}
	RotateSuccessfulScript
	{
		set st0.d5 to st0.d5 + 1
	}
	RotateFailedScript
	{
		set st0.d5 to st0.d5 + 1
	}
	HardDropStartScript
	{
		set st0.d5 to st0.d5 + 1
	}
	SoftDropStepScript
	{
		set st0.d5 to st0.d5 + 1
	}
	FallStepScript
	{
		set pf.d0 to pf.d0 - 1
	}
	GameSecondScript
	{
		set st0.d8 to game time
	}
}

RIBBON.TWS

//////////////////////////////////////////////////////////////////////
// FILE NAME   : TET2001.TWS
// AUTHOR      : $Author: Cstewart $
// VERSION     : $Revision: 3 $
// DATE        : $Date: 10/26/01 6:41p $
// DESCRIPTION : Tetris WRATH
//               
//               
// (c) 2000-2001 Blue Planet Software.  All rights reserved.
//////////////////////////////////////////////////////////////////////


//
// Possible solutions
//
// - piece acceleration
// - multicolored pieces
// - garbage on sides
// - prevent overhangs by 'severing' centre
// - 

GeneralInfo
{
	PlayfieldColumns		10
	PlayfieldRows			22
	MaxMovementsPerSecond	10
	MaxRotationsPerSecond	5
	GameType				Levels
	RemoveFromBagAfterUse
	NextPieceQueueSize		8
}

MinoSticky
{
	0:	0
	1:	1
	2:	2
	3:	3
	4:	4
	5:	5
	6:	6
}

Mino
{
	Name	"Blue"
	Tags	0
}

Mino
{
	Name	"Turquoise"
	Tags	1
}

Mino
{
	Name	"Gray"
	Tags	2
}

Mino
{
	Name	"Green"
	Tags	3
}

Mino
{
	Name	"Orange"
	Tags	4
}

Mino
{
	Name	"Purple"
	Tags	5
}

Mino
{
	Name	"Red"
	Tags	6
}

Tetramino
{
	Name "T_BLUE"
	NumberInBag 1
	ID 1
	MinoList
	{
		"Blue"			(-1,0)
		"Blue"			(0,0)
		"Blue"			(1,0)
		"Blue"			(0,-1)
	}
	Rot0CWOffsetList	(0,0),(-1,0),(1,0),(0,-1)
	Rot90CWOffsetList	(0,0),(0,1),(0,-1),(-1,0)
	Rot180CWOffsetList	(0,0),(1,0),(-1,0),(0,1)
	Rot270CWOffsetList	(0,0),(0,-1),(0,1),(1,0)
}

Tetramino
{
	Name "T_Orange"
	NumberInBag 1
	ID 2
	MinoList
	{
		"Orange"			(-1,0)
		"Orange"			(0,0)
		"Orange"			(1,0)
		"Orange"			(0,-1)
	}
	Rot0CWOffsetList	(0,0),(-1,0),(1,0),(0,-1)
	Rot90CWOffsetList	(0,0),(0,1),(0,-1),(-1,0)
	Rot180CWOffsetList	(0,0),(1,0),(-1,0),(0,1)
	Rot270CWOffsetList	(0,0),(0,-1),(0,1),(1,0)
}

Tetramino
{
	Name "T_GRAY"
	NumberInBag 1
	ID 3
	MinoList
	{
		"Gray"			(-1,0)
		"Gray"			(0,0)
		"Gray"			(1,0)
		"Gray"			(0,-1)
	}
	Rot0CWOffsetList	(0,0),(-1,0),(1,0),(0,-1)
	Rot90CWOffsetList	(0,0),(0,1),(0,-1),(-1,0)
	Rot180CWOffsetList	(0,0),(1,0),(-1,0),(0,1)
	Rot270CWOffsetList	(0,0),(0,-1),(0,1),(1,0)
}

Tetramino
{
	Name "T_RED"
	NumberInBag 1
	ID 4
	MinoList
	{
		"Red"			(-1,0)
		"Red"			(0,0)
		"Red"			(1,0)
		"Red"			(0,-1)
	}
	Rot0CWOffsetList	(0,0),(-1,0),(1,0),(0,-1)
	Rot90CWOffsetList	(0,0),(0,1),(0,-1),(-1,0)
	Rot180CWOffsetList	(0,0),(1,0),(-1,0),(0,1)
	Rot270CWOffsetList	(0,0),(0,-1),(0,1),(1,0)
}





Tetramino
{
	Name "S_BLUE"
	NumberInBag 1
	ID 8
	MinoList
	{
		"Blue"		(0,0)
		"Blue"		(1,0)
		"Blue"		(-1,-1)
		"Blue"		(0,-1)
	}
	Rot0CWOffsetList	(0,0),(1,0),(-1,-1),(0,-1)
	Rot90CWOffsetList	(0,0),(0,-1),(-1,1),(-1,0)
	Rot180CWOffsetList	(0,0),(-1,0),(1,1),(0,1)
	Rot270CWOffsetList	(0,0),(0,1),(1,-1),(1,0)
}

Tetramino
{
	Name "S_Orange"
	NumberInBag 1
	ID 9
	MinoList
	{
		"Orange"		(0,0)
		"Orange"		(1,0)
		"Orange"		(-1,-1)
		"Orange"		(0,-1)
	}
	Rot0CWOffsetList	(0,0),(1,0),(-1,-1),(0,-1)
	Rot90CWOffsetList	(0,0),(0,-1),(-1,1),(-1,0)
	Rot180CWOffsetList	(0,0),(-1,0),(1,1),(0,1)
	Rot270CWOffsetList	(0,0),(0,1),(1,-1),(1,0)
}

Tetramino
{
	Name "S_GRAY"
	NumberInBag 1
	ID 10
	MinoList
	{
		"Gray"		(0,0)
		"Gray"		(1,0)
		"Gray"		(-1,-1)
		"Gray"		(0,-1)
	}
	Rot0CWOffsetList	(0,0),(1,0),(-1,-1),(0,-1)
	Rot90CWOffsetList	(0,0),(0,-1),(-1,1),(-1,0)
	Rot180CWOffsetList	(0,0),(-1,0),(1,1),(0,1)
	Rot270CWOffsetList	(0,0),(0,1),(1,-1),(1,0)
}

Tetramino
{
	Name "S_RED"
	NumberInBag 1
	ID 11
	MinoList
	{
		"Red"		(0,0)
		"Red"		(1,0)
		"Red"		(-1,-1)
		"Red"		(0,-1)
	}
	Rot0CWOffsetList	(0,0),(1,0),(-1,-1),(0,-1)
	Rot90CWOffsetList	(0,0),(0,-1),(-1,1),(-1,0)
	Rot180CWOffsetList	(0,0),(-1,0),(1,1),(0,1)
	Rot270CWOffsetList	(0,0),(0,1),(1,-1),(1,0)
}


Tetramino
{
	Name "Z_BLUE"
	NumberInBag 1
	ID 12
	MinoList
	{
		"Blue"		(-1,0)
		"Blue"		(0,0)
		"Blue"		(0,-1)
		"Blue"		(1,-1)
	}
	Rot0CWOffsetList	(0,0),(-1,0),(0,-1),(1,-1)
	Rot90CWOffsetList	(0,0),(0,1),(-1,0),(-1,-1)
	Rot180CWOffsetList	(0,0),(1,0),(0,1),(-1,1)
	Rot270CWOffsetList	(0,0),(0,-1),(1,0),(1,1)
}
Tetramino
{
	Name "Z_Orange"
	NumberInBag 1
	ID 13
	MinoList
	{
		"Orange"		(-1,0)
		"Orange"		(0,0)
		"Orange"		(0,-1)
		"Orange"		(1,-1)
	}
	Rot0CWOffsetList	(0,0),(-1,0),(0,-1),(1,-1)
	Rot90CWOffsetList	(0,0),(0,1),(-1,0),(-1,-1)
	Rot180CWOffsetList	(0,0),(1,0),(0,1),(-1,1)
	Rot270CWOffsetList	(0,0),(0,-1),(1,0),(1,1)
}
Tetramino
{
	Name "Z_GRAY"
	NumberInBag 1
	ID 14
	MinoList
	{
		"Gray"		(-1,0)
		"Gray"		(0,0)
		"Gray"		(0,-1)
		"Gray"		(1,-1)
	}
	Rot0CWOffsetList	(0,0),(-1,0),(0,-1),(1,-1)
	Rot90CWOffsetList	(0,0),(0,1),(-1,0),(-1,-1)
	Rot180CWOffsetList	(0,0),(1,0),(0,1),(-1,1)
	Rot270CWOffsetList	(0,0),(0,-1),(1,0),(1,1)
}

Tetramino
{
	Name "Z_RED"
	NumberInBag 1
	ID 15
	MinoList
	{
		"Red"		(-1,0)
		"Red"		(0,0)
		"Red"		(0,-1)
		"Red"		(1,-1)
	}
	Rot0CWOffsetList	(0,0),(-1,0),(0,-1),(1,-1)
	Rot90CWOffsetList	(0,0),(0,1),(-1,0),(-1,-1)
	Rot180CWOffsetList	(0,0),(1,0),(0,1),(-1,1)
	Rot270CWOffsetList	(0,0),(0,-1),(1,0),(1,1)
}


Tetramino
{
	Name "L_Blue"
	NumberInBag 1
	ID 16
	MinoList
	{
		"Blue"	(0,1)
		"Blue"	(0,0)
		"Blue"	(0,-1)
		"Blue"	(1,-1)
	}
	Rot0CWOffsetList	(0,0),(0,1),(0,-1),(1,-1)
	Rot90CWOffsetList	(0,0),(1,0),(-1,0),(-1,-1)
	Rot180CWOffsetList	(0,0),(0,-1),(0,1),(-1,1)
	Rot270CWOffsetList	(0,0),(-1,0),(1,0),(1,1)
}
Tetramino
{
	Name "L_Orange"
	NumberInBag 1
	ID 17
	MinoList
	{
		"Orange"	(0,1)
		"Orange"	(0,0)
		"Orange"	(0,-1)
		"Orange"	(1,-1)
	}
	Rot0CWOffsetList	(0,0),(0,1),(0,-1),(1,-1)
	Rot90CWOffsetList	(0,0),(1,0),(-1,0),(-1,-1)
	Rot180CWOffsetList	(0,0),(0,-1),(0,1),(-1,1)
	Rot270CWOffsetList	(0,0),(-1,0),(1,0),(1,1)
}
Tetramino
{
	Name "L_Gray"
	NumberInBag 1
	ID 18
	MinoList
	{
		"Gray"	(0,1)
		"Gray"	(0,0)
		"Gray"	(0,-1)
		"Gray"	(1,-1)
	}
	Rot0CWOffsetList	(0,0),(0,1),(0,-1),(1,-1)
	Rot90CWOffsetList	(0,0),(1,0),(-1,0),(-1,-1)
	Rot180CWOffsetList	(0,0),(0,-1),(0,1),(-1,1)
	Rot270CWOffsetList	(0,0),(-1,0),(1,0),(1,1)
}
Tetramino
{
	Name "L_RED"
	NumberInBag 1
	ID 19
	MinoList
	{
		"Red"	(0,1)
		"Red"	(0,0)
		"Red"	(0,-1)
		"Red"	(1,-1)
	}
	Rot0CWOffsetList	(0,0),(0,1),(0,-1),(1,-1)
	Rot90CWOffsetList	(0,0),(1,0),(-1,0),(-1,-1)
	Rot180CWOffsetList	(0,0),(0,-1),(0,1),(-1,1)
	Rot270CWOffsetList	(0,0),(-1,0),(1,0),(1,1)
}


Tetramino
{
	Name "J_BLUE"
	NumberInBag 1
	ID 20
	MinoList
	{
		"Blue"	(0,1)
		"Blue"	(0,0)
		"Blue"	(0,-1)
		"Blue"	(-1,-1)
	}
	Rot0CWOffsetList	(0,0),(0,1),(-1,-1),(0,-1)
	Rot90CWOffsetList	(0,0),(1,0),(-1,1),(-1,0)
	Rot180CWOffsetList	(0,0),(0,-1),(1,1),(0,1)
	Rot270CWOffsetList	(0,0),(-1,0),(1,-1),(1,0)
}
Tetramino
{
	Name "J_Orange"
	NumberInBag 1
	ID 21
	MinoList
	{
		"Orange"	(0,1)
		"Orange"	(0,0)
		"Orange"	(0,-1)
		"Orange"	(-1,-1)
	}
	Rot0CWOffsetList	(0,0),(0,1),(-1,-1),(0,-1)
	Rot90CWOffsetList	(0,0),(1,0),(-1,1),(-1,0)
	Rot180CWOffsetList	(0,0),(0,-1),(1,1),(0,1)
	Rot270CWOffsetList	(0,0),(-1,0),(1,-1),(1,0)
}
Tetramino
{
	Name "J_Gray"
	NumberInBag 1
	ID 22
	MinoList
	{
		"Gray"	(0,1)
		"Gray"	(0,0)
		"Gray"	(0,-1)
		"Gray"	(-1,-1)
	}
	Rot0CWOffsetList	(0,0),(0,1),(-1,-1),(0,-1)
	Rot90CWOffsetList	(0,0),(1,0),(-1,1),(-1,0)
	Rot180CWOffsetList	(0,0),(0,-1),(1,1),(0,1)
	Rot270CWOffsetList	(0,0),(-1,0),(1,-1),(1,0)
}
Tetramino
{
	Name "J_RED"
	NumberInBag 1
	ID 23
	MinoList
	{
		"Red"	(0,1)
		"Red"	(0,0)
		"Red"	(0,-1)
		"Red"	(-1,-1)
	}
	Rot0CWOffsetList	(0,0),(0,1),(-1,-1),(0,-1)
	Rot90CWOffsetList	(0,0),(1,0),(-1,1),(-1,0)
	Rot180CWOffsetList	(0,0),(0,-1),(1,1),(0,1)
	Rot270CWOffsetList	(0,0),(-1,0),(1,-1),(1,0)
}


Tetramino
{
	Name "O_BLUE"
	NumberInBag 1
	ID 24
	MinoList
	{
		"Blue"		(0,0)
		"Blue"		(1,0)
		"Blue"		(0,-1)
		"Blue"		(1,-1)
	}
	Rot0CWOffsetList	(0,0)
	Rot90CWOffsetList	(-1,0)
	Rot180CWOffsetList	(-1,1)
	Rot270CWOffsetList	(0,1)
}
Tetramino
{
	Name "O_Orange"
	NumberInBag 1
	ID 25
	MinoList
	{
		"Orange"		(0,0)
		"Orange"		(1,0)
		"Orange"		(0,-1)
		"Orange"		(1,-1)
	}
	Rot0CWOffsetList	(0,0)
	Rot90CWOffsetList	(-1,0)
	Rot180CWOffsetList	(-1,1)
	Rot270CWOffsetList	(0,1)
}
Tetramino
{
	Name "O_Gray"
	NumberInBag 1
	ID 26
	MinoList
	{
		"Gray"		(0,0)
		"Gray"		(1,0)
		"Gray"		(0,-1)
		"Gray"		(1,-1)
	}
	Rot0CWOffsetList	(0,0)
	Rot90CWOffsetList	(-1,0)
	Rot180CWOffsetList	(-1,1)
	Rot270CWOffsetList	(0,1)
}

Tetramino
{
	Name "O_Red"
	NumberInBag 1
	ID 27
	MinoList
	{
		"Red"		(0,0)
		"Red"		(1,0)
		"Red"		(0,-1)
		"Red"		(1,-1)
	}
	Rot0CWOffsetList	(0,0)
	Rot90CWOffsetList	(-1,0)
	Rot180CWOffsetList	(-1,1)
	Rot270CWOffsetList	(0,1)
}



Tetramino
{
	Name "I_Blue"
	NumberInBag 1
	ID 28
	MinoList
	{
		"Blue"	(0,1)
		"Blue"	(0,0)
		"Blue"	(0,-1)
		"Blue"	(0,-2)
	}
	Rot0CWOffsetList	(0,0),(0,1),(0,-1),(0,-2)
	Rot90CWOffsetList	(0,0),(1,0),(-1,0),(-2,0)
	Rot180CWOffsetList	(0,0),(0,-1),(0,1),(0,2)
	Rot270CWOffsetList	(0,0),(-1,0),(1,0),(2,0)
}
Tetramino
{
	Name "I_Orange"
	NumberInBag 1
	ID 29
	MinoList
	{
		"Orange"	(0,1)
		"Orange"	(0,0)
		"Orange"	(0,-1)
		"Orange"	(0,-2)
	}
	Rot0CWOffsetList	(0,0),(0,1),(0,-1),(0,-2)
	Rot90CWOffsetList	(0,0),(1,0),(-1,0),(-2,0)
	Rot180CWOffsetList	(0,0),(0,-1),(0,1),(0,2)
	Rot270CWOffsetList	(0,0),(-1,0),(1,0),(2,0)
}
Tetramino
{
	Name "I_Gray"
	NumberInBag 1
	ID 30
	MinoList
	{
		"Gray"	(0,1)
		"Gray"	(0,0)
		"Gray"	(0,-1)
		"Gray"	(0,-2)
	}
	Rot0CWOffsetList	(0,0),(0,1),(0,-1),(0,-2)
	Rot90CWOffsetList	(0,0),(1,0),(-1,0),(-2,0)
	Rot180CWOffsetList	(0,0),(0,-1),(0,1),(0,2)
	Rot270CWOffsetList	(0,0),(-1,0),(1,0),(2,0)
}
Tetramino
{
	Name "I_RED"
	NumberInBag 1
	ID 31
	MinoList
	{
		"Red"	(0,1)
		"Red"	(0,0)
		"Red"	(0,-1)
		"Red"	(0,-2)
	}
	Rot0CWOffsetList	(0,0),(0,1),(0,-1),(0,-2)
	Rot90CWOffsetList	(0,0),(1,0),(-1,0),(-2,0)
	Rot180CWOffsetList	(0,0),(0,-1),(0,1),(0,2)
	Rot270CWOffsetList	(0,0),(-1,0),(1,0),(2,0)
}



Pattern
{
	Name			"BlueClear"
	Tags			0
	Method			Search
	SearchType		Ribbon
	SearchCount		3
	PatternMinoScript
	{
		* Patterns: line clear: Mino
		kill mino
	}
}

Pattern
{
	Name			"OrangeClear"
	Tags			4
	Method			Search
	SearchType		Ribbon
	SearchCount		3
	PatternMinoScript
	{
		* Patterns: line clear: Mino
		kill mino
	}
}

Pattern
{
	Name			"GrayClear"
	Tags			2
	Method			Search
	SearchType		Ribbon
	SearchCount		3
	PatternMinoScript
	{
		* Patterns: line clear: Mino
		kill mino
	}
}

Pattern
{
	Name			"RedClear"
	Tags			6
	Method			Search
	SearchType		Ribbon
	SearchCount		3
	PatternMinoScript
	{
		* Patterns: line clear: Mino
		kill mino
	}
}

Pattern
{
	Name			"GoalClear"
	Tags			1
	Method			Search
	SearchType		FloodFill4D
	SearchCount		12
	PatternMinoScript
	{
		* Patterns: line clear: Mino
		kill mino
		set pl.d9 to 1
	}
}




Trash
{
	Name	"OneTrash"	
	Height	5
	MinoList		
	{
		"Turquoise" (0,0)
		"Turquoise" (1,0)
		"Turquoise" (2,0)
		"Turquoise" (3,0)
		"Turquoise" (4,0)
		"Turquoise" (5,0)
		"Turquoise" (6,0)
		"Turquoise" (7,0)
		"Turquoise" (8,0)
		"Turquoise" (9,0)

		"Red" (0,1)
		"Red" (0,2)
		"Red" (0,3)

		"Turquoise" (0,4)
		"Turquoise" (9,1)

	}
}


Trash
{
	Name	"TwoTrash"	
	Height	5
	MinoList		
	{
		"Turquoise" (0,0)
		"Turquoise" (1,0)
		"Turquoise" (2,0)
		"Turquoise" (3,0)
		"Turquoise" (4,0)
		"Turquoise" (5,0)
		"Turquoise" (6,0)
		"Turquoise" (7,0)
		"Turquoise" (8,0)
		"Turquoise" (9,0)

		"Blue" (9,1)
		"Blue" (9,2)
		"Blue" (9,3)

		"Turquoise" (0,1)
		"Turquoise" (9,4)

	}
}



Trash
{
	Name	"ThreeTrash"	
	Height	4		
	MinoList		
	{
		"Turquoise" (0,0)
		"Turquoise" (1,0)
		"Turquoise" (2,0)
		"Turquoise" (3,0)
		"Turquoise" (4,0)
		"Turquoise" (5,0)
		"Turquoise" (6,0)
		"Turquoise" (7,0)
		"Turquoise" (8,0)
		"Turquoise" (9,0)

		"Orange" (0,1)
		"Orange" (0,2)
		"Orange" (9,1)
		"Orange" (9,2)

		"Turquoise" (0,3)
		"Turquoise" (9,3)

	}
}


	
Trash
{
	Name	"FourTrash"	
	Height	4
	MinoList		
	{
		"Turquoise" (0,0)
		"Turquoise" (1,0)
		"Turquoise" (2,0)
		"Turquoise" (3,0)
		"Turquoise" (4,0)
		"Turquoise" (5,0)
		"Turquoise" (6,0)
		"Turquoise" (7,0)
		"Turquoise" (8,0)
		"Turquoise" (9,0)

		"Gray" (0,1)
		"Gray" (0,2)
		"Blue" (9,1)
		"Blue" (9,2)

		"Turquoise" (0,3)
		"Turquoise" (9,3)

	}
}


Trash
{
	Name	"FiveTrash"	
	Height	5
	MinoList		
	{
		"Turquoise" (0,0)
		"Turquoise" (1,0)
		"Turquoise" (2,0)
		"Turquoise" (3,0)
		"Turquoise" (4,0)
		"Turquoise" (5,0)
		"Turquoise" (6,0)
		"Turquoise" (7,0)
		"Turquoise" (8,0)
		"Turquoise" (9,0)

		"Red" (0,1)
		"Red" (0,2)
		"Orange" (0,3)
		"Orange" (0,4)

		"Red" (9,1)
		"Red" (9,2)
		"Orange" (9,3)
		"Orange" (9,4)

		"Turquoise" (0,4)
		"Turquoise" (9,4)

	}
}


Trash
{
	Name	"SixTrash"	
	Height	3		
	MinoList		
	{
		"Turquoise" (0,0)
		"Turquoise" (1,0)
		"Turquoise" (2,0)
		"Turquoise" (3,0)
		"Turquoise" (4,0)
		"Turquoise" (5,0)
		"Turquoise" (6,0)
		"Turquoise" (7,0)
		"Turquoise" (8,0)
		"Turquoise" (9,0)

		"Blue" (0,1)
		"Gray" (0,2)

		"Gray" (9,1)
		"Blue" (9,2)

		"Turquoise" (0,3)
		"Turquoise" (9,3)

	}
}


Trash
{
	Name	"SevenTrash"	
	Height	4		
	MinoList		
	{
		"Turquoise" (0,0)
		"Turquoise" (1,0)
		"Turquoise" (2,0)
		"Turquoise" (3,0)
		"Turquoise" (4,0)
		"Turquoise" (5,0)
		"Turquoise" (6,0)
		"Turquoise" (7,0)
		"Turquoise" (8,0)
		"Turquoise" (9,0)

		"Orange" (0,1)
		"Red"   (0,2)

		"Red"  (9,1)
		"Gray"  (9,2)

		"Turquoise" (0,3)
		"Turquoise" (9,3)

	}
}


Trash
{
	Name	"EightTrash"	
	Height	5
	MinoList		
	{
		"Turquoise" (0,0)
		"Turquoise" (1,0)
		"Turquoise" (2,0)
		"Turquoise" (3,0)
		"Turquoise" (4,0)
		"Turquoise" (5,0)
		"Turquoise" (6,0)
		"Turquoise" (7,0)
		"Turquoise" (8,0)
		"Turquoise" (9,0)

		"Gray" (0,1)
		"Orange" (0,2)
		"Gray" (0,3)

		"Orange" (9,1)
		"Gray" (9,2)
		"Orange" (9,3)

		"Turquoise" (0,4)
		"Turquoise" (9,4)

	}
}

Trash
{
	Name	"NineTrash"	
	Height	5
	MinoList		
	{
		"Turquoise" (0,0)
		"Turquoise" (1,0)
		"Turquoise" (2,0)
		"Turquoise" (3,0)
		"Turquoise" (4,0)
		"Turquoise" (5,0)
		"Turquoise" (6,0)
		"Turquoise" (7,0)
		"Turquoise" (8,0)
		"Turquoise" (9,0)

		"Red" (0,1)
		"Orange" (0,2)
		"Orange" (0,3)

		"Gray" (9,1)
		"Blue" (9,2)
		"Red" (9,3)

		"Turquoise" (0,4)
		"Turquoise" (9,4)

	}
}


Trash
{
	Name	"TenTrash"	
	Height	5
	MinoList		
	{
		"Turquoise" (0,0)
		"Turquoise" (1,0)
		"Turquoise" (2,0)
		"Turquoise" (3,0)
		"Turquoise" (4,0)
		"Turquoise" (5,0)
		"Turquoise" (6,0)
		"Turquoise" (7,0)
		"Turquoise" (8,0)
		"Turquoise" (9,0)

		"Red"  (0,1)
		"Gray"  (0,2)
		"Orange" (0,3)

		"Orange" (9,1)
		"Blue"  (9,2)
		"Red"   (9,3)

		"Turquoise" (0,4)
		"Turquoise" (9,4)

	}
}


Trash
{
	Name	"ElevenTrash"	
	Height	6
	MinoList		
	{
		"Turquoise" (0,0)
		"Turquoise" (1,0)
		"Turquoise" (2,0)
		"Turquoise" (3,0)
		"Turquoise" (4,0)
		"Turquoise" (5,0)
		"Turquoise" (6,0)
		"Turquoise" (7,0)
		"Turquoise" (8,0)
		"Turquoise" (9,0)

		"Gray"  (0,1)
		"Orange"  (0,2)
		"Orange" (0,3)
		"Red" (0,4)

		"Orange" (9,1)
		"Blue"  (9,2)
		"Red"   (9,3)
		"Gray"   (9,4)

		"Turquoise" (0,5)
		"Turquoise" (9,5)

	}
}


Trash
{
	Name	"TwelveTrash"	
	Height	6
	MinoList		
	{
		"Turquoise" (0,0)
		"Turquoise" (1,0)
		"Turquoise" (2,0)
		"Turquoise" (3,0)
		"Turquoise" (4,0)
		"Turquoise" (5,0)
		"Turquoise" (6,0)
		"Turquoise" (7,0)
		"Turquoise" (8,0)
		"Turquoise" (9,0)

		"Red"  (0,1)
		"Gray"  (0,2)
		"Orange" (0,3)
		"Red" (0,4)

		"Gray" (9,1)
		"Blue"  (9,2)
		"Orange"   (9,3)
		"Red"   (9,4)

		"Turquoise" (0,5)
		"Turquoise" (9,5)

	}
}


Trash
{
	Name	"ThirteenTrash"	
	Height	6
	MinoList		
	{
		"Turquoise" (0,0)
		"Turquoise" (1,0)
		"Turquoise" (2,0)
		"Turquoise" (3,0)
		"Turquoise" (4,0)
		"Turquoise" (5,0)
		"Turquoise" (6,0)
		"Turquoise" (7,0)
		"Turquoise" (8,0)
		"Turquoise" (9,0)

		"Blue"  (0,1)
		"Orange"  (0,2)
		"Gray" (0,3)
		"Red" (0,4)

		"Gray" (9,1)
		"Blue"  (9,2)
		"Orange"   (9,3)
		"Red"   (9,4)

		"Turquoise" (0,5)
		"Turquoise" (9,5)

	}
}



Trash
{
	Name	"FourteenTrash"	
	Height	7
	MinoList		
	{
		"Turquoise" (0,0)
		"Turquoise" (1,0)
		"Turquoise" (2,0)
		"Turquoise" (3,0)
		"Turquoise" (4,0)
		"Turquoise" (5,0)
		"Turquoise" (6,0)
		"Turquoise" (7,0)
		"Turquoise" (8,0)
		"Turquoise" (9,0)

		"Blue"  (0,1)
		"Red"  (0,2)
		"Blue" (0,3)
		"Orange" (0,4)
		"Gray" (0,5)

		"Orange" (9,1)
		"Red"  (9,2)
		"Gray"   (9,3)
		"Gray"   (9,4)
		"Blue"   (9,5)

		"Turquoise" (0,6)
		"Turquoise" (9,6)

	}
}


Trash
{
	Name	"FifteenTrash"	
	Height	7
	MinoList		
	{
		"Turquoise" (0,0)
		"Turquoise" (1,0)
		"Turquoise" (2,0)
		"Turquoise" (3,0)
		"Turquoise" (4,0)
		"Turquoise" (5,0)
		"Turquoise" (6,0)
		"Turquoise" (7,0)
		"Turquoise" (8,0)
		"Turquoise" (9,0)

		"Gray"  (0,1)
		"Orange"  (0,2)
		"Red" (0,3)
		"Blue" (0,4)
		"Gray" (0,5)

		"Blue" (9,1)
		"Orange"  (9,2)
		"Red"   (9,3)
		"Gray"   (9,4)
		"Blue"   (9,5)

		"Turquoise" (0,6)
		"Turquoise" (9,6)

	}
}


Level
{
	Name "Level #1"
	LevelTrash "OneTrash"
	LevelEndScript
	{
		sound "EVOLMT01"
	}
}

Level
{
	Name "Level #2"
	LevelTrash "TwoTrash"
	LevelEndScript
	{
		sound "EVOLMT01"
	}
}

Level
{
	Name "Level #3"
	LevelTrash "ThreeTrash"
	LevelEndScript
	{
		sound "EVOLMT01"
	}
}

Level
{
	Name "Level #4"
	LevelTrash "FourTrash"
	LevelEndScript
	{
		sound "EVOLMT01"
	}
}

Level
{
	Name "Level #5"
	LevelTrash "FiveTrash"
	LevelEndScript
	{
		sound "EVOLMT01"
	}
}

Level
{
	Name "Level #6"
	LevelTrash "SixTrash"
	LevelEndScript
	{
		sound "EVOLMT01"
	}
}

Level
{
	Name "Level #7"
	LevelTrash "SevenTrash"
	LevelEndScript
	{
		sound "EVOLMT01"
	}
}

Level
{
	Name "Level #8"
	LevelTrash "EightTrash"
	LevelEndScript
	{
		sound "EVOLMT01"
	}
}

Level
{
	Name "Level #9"
	LevelTrash "NineTrash"
	LevelEndScript
	{
		sound "EVOLMT09"
	}
}

Level
{
	Name "Level #10"
	LevelTrash "TenTrash"
	LevelEndScript
	{
		sound "EVOLMT10"
	}
}

Level
{
	Name "Level #11"
	LevelTrash "ElevenTrash"
	LevelEndScript
	{
		sound "EVOLMT01"
	}
}

Level
{
	Name "Level #12"
	LevelTrash "TwelveTrash"
	LevelEndScript
	{
		sound "EVOLMT01"
	}
}

Level
{
	Name "Level #13"
	LevelTrash "ThirteenTrash"
	LevelEndScript
	{
		sound "EVOLMT01"
	}
}

Level
{
	Name "Level #14"
	LevelTrash "FourteenTrash"
	LevelEndScript
	{
		sound "EVOLMT01"
	}
}

Level
{
	Name "Level #15"
	LevelTrash "FifteenTrash"
	LevelEndScript
	{
		sound "EVOLMT01"
	}
}

GenerationPhase
{
	GenerationTime			0.0
	PieceStartingLocation	(4,0)
	GenerationBeginScript
	{
		* Phase: Generation Begin

		set pf.d3 to 0

		set pf.d6 to pf.d9 * 120 / level time

		if pf.d6 > pf.d5
		  set pf.d5 to pf.d6
		end

		if pf.d5 > pf.d4
		  set pf.d4 to pf.d5
		  set pf.d3 to 1
		end


	}
}

FallingPhase
{
	FallSpeed		1/(pf.d9/10 + 1) - 1/15
	SoftDropSpeed	0.05
	HardDropSpeed	0.0001
	MoveTolerance	0.2
}

LockPhase
{
	MovementRestartsClock
	Duration		0.5
}

PatternPhase
{
}

IteratePhase
{
}

EliminatePhase
{
	FallSpeed		0.05
	EliminateBeginScript
	{
		* Phase: Eliminate Begin

		* Reset the line clear counter for this phase

		set phase.d0 to 0

		* Reset level win script

		* set pl.d9 to 0
	}
	LineCollapsedScript
	{
		* Phase: Eliminate Line Collapsed

		* "Clear line" counter for this phase
		set phase.d0 to phase.d0 + 1
	}
	EliminateEndScript
	{
		* Phase: Eliminate End

		* if you find a single, add it to the score and flag single

		if phase.d0 = 1
    	  set pf.d9 to pf.d9 + 1
		  set pf.d0 to pf.d8 - pf.d9
		  set pl.d5 to 1
		  sound "FX_LNE01"
		  mino mood 2
		end

		* if you find a double, add it to the score and flag double

		if phase.d0 = 2
		  set pf.d9 to pf.d9 + 1
		  set pf.d0 to pf.d8 - pf.d9
		  set pl.d5 to 1
		  sound "FX_LNE02"
		  mino mood 3
		end

		* if you find a triple, add it to the score and flag triple

		if phase.d0 = 3
		  set pf.d9 to pf.d9 + 1
		  set pf.d0 to pf.d8 - pf.d9
		  set pl.d5 to 1
		  sound "FX_LNE03"
		  mino mood 5
		end

		* if you find a tetris, add it to the score and flag tetris

		if phase.d0 = 4
		  set pf.d9 to pf.d9 + 8
		  set pf.d9 to pf.d9 + pl.d5 - 1
		  set pf.d0 to pf.d8 - pf.d9
		  sound "FX_MTRIS"
		  sound "FX_LNE04"
		  set pl.d5 to pl.d5 * 2
		  mino mood 5
		end

		* check if reached goal conditions

		if pl.d9 = 1
		  set pl.d9 to 0
		  mino mood 5
		  next level
		end

	}
}

SolidifyPhase
{
}

GravityPhase
{
	// Gravity is enabled
	GravityEnabled				
	FallSpeed		0.1
}

CompletionPhase
{
}

EventScripts
{
	GameStartScript
	{
		* Game Events: Game Start

		set pf.d4 to 30
	}

	LevelStartScript
	{
		* Level Scripts: Level Start

		sound "TWM_BGIN"

		* set ghost to 1
		score 0
		set pf.d9 to 0
		set pf.d8 to level * 5
		set pf.d0 to pf.d8
		set pf.d6 to 0
		set pf.d5 to 0

		* if level is less than three say "go for a tetris"
		* else just play the one minute music
		
		if level < 3
		  set pl.d0 to 115
		else
		  set pl.d0 to 60
		end

		set pl.d5 to 1

		mino intensity high
	}

	LevelEndScript
	{
		* Level Scripts: Level End

		sound "TWM_END"
	}

	PieceGenerationScript
	{
		* Generation: Generated

		set pf.d2 to 0

		set pl.d6 to 0.1
	}

	MoveSuccessfulScript
	{
		* Move: Success

		* This clears the rotate flag.

		set pf.d1 to 0

		sound "FX_SLDEL"

	}

	MoveFailedScript
	{
		* Move: Fail

		sound "FX_UNMVE"
	}

	RotateSuccessfulScript
	{
		* Rotate: Success

		* This sets the rotate flag.

		set pf.d1 to 1

		sound "FX_RTATL"
	}

	RotateFailedScript
	{
		* Rotate: Fail

		sound "FX_UNMVE"
	}

	HardDropStartScript
	{
		* Hard Drop: Start

		set pf.d2 to 9
	}

	HardDropStepScript
	{
		* Hard Drop: Step

		* This clears the rotate flag.

		set pf.d1 to 0
	}

	SoftDropStepScript
	{
		* Soft Drop: Step

		* This clears the rotate flag.

		set pf.d1 to 0

		sound "FX_SFTDP"
	}

	FallStepScript
	{
		* Fall: Step

		* This clears the rotate flag.

		set pf.d1 to 0

		sound "FX_FALL"
	}

	TouchdownScript
	{
		* Touch: Touchdown

		* Clear the rotate flag (pf.d1)

		set pf.d1 to 0

	}

	LockdownScript
	{
		* Touch: Lock

		* Checks for a spin.

		if pf.d2 = 1 & pf.d1 = 1
		  set pf.d7 to 1
		  * add a 1 bonus for a t-spin
		  set pf.d9 to pf.d9 + 1
		  set pf.d0 to pf.d8 - pf.d9
		  sound "VO_TSPIN"
		end

		if pf.d2 = 9
		  sound "FX_HRDDP"
		else
		  sound "FX_LOCK"
		end
	}

	LevelSecondScript
	{
		* Time Events: Level Second

		if level time >= 3 & phase.d0 = 115
		  sound "VO_INT01"
		  set player.d0 to 60
		end

		if level time >= 60 & player.d0 = 60
		  sound "TWM_MIDL"
		  set player.d0 to 30
		  mino intensity high
		end

		if level time >= 90 & player.d0 = 30
		  sound "VO_30TIC"
		  set player.d0 to 20
		end

		if level time >= 100 & player.d0 = 20
		  sound "VO_20TIC"
		  set player.d0 to 10
		  mino intensity high
		end

		if level time >= 290 & player.d0 = 10
		  sound "VO_10TIC"
		  set player.d0 to 9
		end

		if level time >= 291 & player.d0 = 9
		  sound "VO_09TIC"
		  set player.d0 to 8
		end

		if level time >= 292 & player.d0 = 8
		  sound "VO_08TIC"
		  set player.d0 to 7
		end

		if level time >= 293 & player.d0 = 7
		  sound "VO_07TIC"
		  set player.d0 to 6
		end

		if level time >= 294 & player.d0 = 6
		  sound "VO_06TIC"
		  set player.d0 to 5
		end

		if level time >= 295 & player.d0 = 5
		  sound "VO_05TIC"
		  set player.d0 to 4
		end

		if level time >= 296 & player.d0 = 4
		  sound "VO_04TIC"
		  set player.d0 to 3
		end

		if level time >= 297 & player.d0 = 3
		  sound "VO_03TIC"
		  set player.d0 to 2
		end

		if level time >= 298 & player.d0 = 2
		  sound "VO_02TIC"
		  set player.d0 to 1
		end

		if level time >= 299 & player.d0 = 1
		  sound "VO_01TIC"
		  set player.d0 to 0
		end

		if level time >= 300 & player.d0 = 0
		  sound "VO_TIME"
		  * CJG change: game does not stop running upon loss, gotta do this to kill the VO.
		  set player.d0 to -1
		  lose
		end
	}
}

SAMPLE.TWS

//////////////////////////////////////////////////////////////////////
// FILE NAME   : SAMPLE.TWS
// AUTHOR      : Chris J. Gullette
// VERSION     : $Revision: 15 $
// DATE        : $Date: 8/23/01 7:01p $
// DESCRIPTION : This is a sample TWS (Tetris Worlds Script) game
//               definition file.  Note that each section is heavily
//               commented, and all sections must appear in the order
//               given in this file.
//               
//               
// (c) 2000-2001 Blue Planet Software.  All rights reserved.
//////////////////////////////////////////////////////////////////////

// As the name implies, this section contains general information about the game and is mandatory.
GeneralInfo
{
	PlayfieldColumns		10		// range 1-32 columns
	PlayfieldRows			20		// range 1-48 rows
	MaxMovementsPerSecond	10		// How many times can a Tetrimino move per second? Integer only!
	MaxRotationsPerSecond	5		// How many times can a Tetrimino rotate per second? Integer only!
	GameType				Levels	// Game type can be Marathon or Levels
	RemoveFromBagAfterUse			// OPTIONAL: Set this flag to remove a Tetrimino from the "bag" after
									// it has been used.  When the bag count for all Tetriminos reaches
									// zero, they will be reset to their starting values.
	NextPieceQueueSize		8		// How large is the next piece queue?
}

// The MinoSticky section defines which mino tags stick to each other.  Note that this defines
// LOGICAL stickiness.  The TWS format does not currently support visual stickiness, this may be
// added later.  This section is mandatory.
MinoSticky
{
	NotStickyBetweenPieces		// OPTIONAL: This flag prevents stickiness between tetriminos.
	0:	0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
	1:	1
	2:	2,3,4,5
	3:	3
	4:	4,5
	5:	5
	6:	6
	7:	7
	8:	8
	9:	9
	10:	10
	11:	11
	12:	12
	13:	13
	14:	14
	15:	15
}

// The Mino section defines each mino type.  At least one Mino is required, but you
// may define any number as long as each has a Name unique among Minos.
Mino
{
	Name		"Mino0"		// Name can be any string, should be unique
	Antigravity				// OPTIONAL: Set this flag to turn gravity off for this mino type.
	Tags		0			// The mino ID number ("tags") can be 0-31.  Multiple tags can be used
							// in the same Mino definition.
	AltMino		"Mino1"		// OPTIONAL: Each mino can have an alternate mino type.
	AltChance	50			// OPTIONAL: If AltMino is defined, you must also define a % chance from 0-50.
	MutateMino	"Mino1"		// OPTIONAL: Each mino can have a "mutate" mino type, switched by the "mutate
							// mino" script command.
	D0	20					// OPTIONAL: Datafields D0-D9 can be any integer (0 by default)
	D1	50
	D2	70
	D3	25
	D6	15
	D7	100
}

Mino
{
	Name "Mino1"
	Tags	1,2,3
	D1	50
	D4	75
}

// The Tetramino section defines a single tetramino type.  At least one Tetramino is required,
// but you may define any number as long as each has a Name unique among Tetraminos.
Tetramino
{
	Name "Tetramino0"	// Name can be any string, must be unique.
	NumberInBag	20		// Number in bag defines probability of appearance, range 0-25.
	ID 0				// This value is returned by the PIECE.ID property.

	// List each mino by name with its location on the 7x7 grid.
	// The center square of the grid is (0,0) by definition.
	MinoList
	{
		"Mino0" (0,0)
		"Mino0" (0,1)
		"Mino0" (0,2)
		"Mino1" (1,2)
	}
	Rot0CWOffsetList		(0,0)			// List offsets for 0 degree CW rotation
	Rot90CWOffsetList		(0,0)			// List offsets for 90 degree CW rotation
	Rot180CWOffsetList		(0,0),(1,1)		// List offsets for 180 degree CW rotation
	Rot270CWOffsetList		(0,0)			// List offsets for 270 degree CW rotation
}

// The GarbageInfo section defines both normal and special garbage.  This section is OPTIONAL.
GarbageInfo
{
	NormalMino		"Mino0"			// Which Mino is used for normal garbage?
	NormalCount		7				// How many Minos for a row of normal garbage?  Expression OK.
	SpecialMino		"Mino1"			// Which Mino is used for special garbage?		
	SpecialCount	pf.d8			// How many Minos for a row of special garbage?  Expression OK.
}

// A Sequence section defines a single sequence of Tetraminos.  Sequences are OPTIONAL,
// but you may define any number as long as each has a Name unique among Sequences.
Sequence
{
	Name			"Sequence0"								// Name of the sequence.
	TetraminoList	"Tetramino0","Tetramino0","Tetramino0"	// A list of Tetramino names.
}

// A Shape section contains a user-defined shape, up to 16x16 in size.  Shapes are OPTIONAL,
// but you may define any number as long as each has a Name unique among Shapes.  Note that
// the points in a Shape are in a 16x16 grid where the lower left corner of the grid is (0,0)
// and the upper right is (15,15).
Shape
{
	Name		"Shape0"				// Name of the shape, any string.
	Hotspot		(7,7)					// Location of the shape hotspot (which is not part of the
										// shape unless included in the ShapeCoords list).
	ShapeCoords	(7,7),(8,7),(9,7),(9,8)	// ShapeCoords contains a list of x,y coordinates for each
										// mino in a shape.
}

// A Pattern section is used to define a matchable pattern based on either pre-defined search
// types or user-defined shapes.  Examples for each follow.  You must have at least one Pattern,
// but you may define as many as you like as long as each has a Name unique among Patterns.  Also
// note that you should not use Search-specific fields in a Shape-based Pattern, and vice versa.
Pattern		// Search pattern
{
	Name				"Pattern0"		// Name of the pattern, any string.
	Triggered							// OPTIONAL:  Patterns execute automatically during the
										// Pattern phase by default.  Set this flag if the Pattern
										// should only execute when triggered by a run-time script.
	Tags				0,1,2,3			// OPTIONAL: Which Mino tags can match in this pattern?  If
										// this list is not present, all tags can match this pattern.
										// If "Tags" is present, you must list at least one tag value.
	Method				Search			// For a search pattern, set Method to Search.
	SearchType			Horizontal		// SEARCH-SPECIFIC: SearchType can be Horizontal, Vertical,
										// DiagNESW, DiagNWSE, Square, FloodFill4D, FloodFill8D, or
										// Ribbon.
	SearchCount			10				// SEARCH-SPECIFIC: Defines the minimum number of Minos required
										// for a successful match.  Any expression is OK.
	PatternPieceCount	5				// OPTIONAL: PatternPieceCount must be a positive integer.  When
										// a potential match is found, the number of unique piece IDs
										// in that pattern is counted.  If it matches this number, then
										// (and only then) the pattern is a match.
	PatternBeginScript	{}				// OPTIONAL: This script runs when a pattern is matched.
	PatternMinoScript	{}				// OPTIONAL: This script runs on each Mino after the BeginScript.
	PatternEndScript	{}				// OPTIONAL: This script runs after all MinoScripts have finished.
}

// This is an example of a shape pattern.  Note: no "Triggered" keyword means automatic execution,
// and no "Tags" list means ALL tags may be part of this pattern.
Pattern
{
	Name				"Pattern1"
	Method				Shape			// For a shape pattern, set Method to Shape.
	ShapeName			"Shape0"		// SHAPE-SPECIFIC: What Shape should be used for this pattern?
	PatternPieceCount	3				// OPTIONAL
	PatternBeginScript	{}				// OPTIONAL
	PatternMinoScript	{}				// OPTIONAL
	PatternEndScript	{}				// OPTIONAL
}

// A Trash section contains an instance of user-defined trash.  Trash is OPTIONAL, but you may define
// any number of Trash sections as long as each has a name unique among Trash.
Trash
{
	Name	"Trash0"					// The name of this Trash, any string.
	Height	2							// How tall is the trash?  Must be an integer > 0.
	MinoList							// A list of minos in the trash.  We need coords and type.
	{									// For each coordinate pair, X < Height (trash height) and
		"Mino0" (0,0)					// Y < well width.
		"Mino0" (0,1)
		"Mino0" (0,2)
		"Mino1" (1,2)
	}
}

// A Level section contains script and trash info for a single level.  Levels are OPTIONAL, but you
// may define any number of them as long as each has a unique Name among Levels.  Note that Levels
// will be used in the order that you define them here, no matter what the name.
Level
{
	Name				"Level #1"	// The name of this Level, any string.
	LevelTrash			"Trash0"	// OPTIONAL: What Trash should be inserted at level start?
	LevelStartScript	{}			// OPTIONAL: Execute this script at level start.
	LevelEndScript		{}			// OPTIONAL: Execute this script at level end.
}

// All info for the Generation Phase.  Mandatory, only one instance of this section.
GenerationPhase
{
	GenerationTime			1		// Generation time in seconds, expression OK.
	PieceStartingLocation	(0,0)	// Where is a new piece placed on the playfield?
	GenerationBeginScript	{}		// OPTIONAL: Begin phase script.
	GenerationEndScript		{}		// OPTIONAL: End phase script.
}

// All info for the Falling Phase.  Mandatory, only one instance of this section.
FallingPhase
{
	PiecesFallSmoothly				// OPTIONAL: If set, pieces fall smoothly (visually).
	FallSpeed				1		// Normal fall speed in sec/line, expression OK
	SoftDropSpeed			1		// Soft drop speed in sec/line, expression OK
	HardDropSpeed			1		// Hard drop speed in sec/line, expression OK
	MoveTolerance			0		// Expression OK, not currently in use!
	FallingBeginScript		{}		// OPTIONAL: Begin phase script.
	FallingEndScript		{}		// OPTIONAL: End phase script.
}

// All info for the Lock Phase.  Mandatory, only one instance of this section.
LockPhase
{
	MovementRestartsClock			// OPTIONAL: Set this flag to restart the lock phase
									// if the active piece moves.
	Duration				5		// Seconds before lockdown occurs, expression OK
	LockBeginScript			{}		// OPTIONAL: Begin phase script.
	LockEndScript			{}		// OPTIONAL: End phase script.
}

// All info for the Pattern Phase.  Mandatory, only one instance of this section.
PatternPhase
{
	PatternBeginScript		{}		// OPTIONAL: Begin phase script.
	PatternEndScript		{}		// OPTIONAL: End phase script.
}

// All info for the Iterate Phase.  Mandatory, only one instance of this section.
IteratePhase
{
	IterateBeginScript		{}		// OPTIONAL: Begin phase script.
	PrimaryIterator					// OPTIONAL: Defines the primary iterator.
	{
		IteratorExpression	pf.d1	// OPTIONAL: If this expression exists, it must evaluate
									// to non-zero in order to execute this iterator.
		IteratorTags		0,1,2,3	// OPTIONAL: Only Minos that match this tag list are iterated.
		MinoIteratorScript	{}		// The iteration script run for each matching Mino.
	}
	SecondaryIterator				// OPTIONAL: Defines the secondary iterator.
	{
		IteratorExpression	3
		IteratorTags		0,1,2,3
		MinoIteratorScript	{}
	}
	IterateEndScript		{}		// OPTIONAL: End phase script.
}

// All info for the Eliminate Phase.  Mandatory, only one instance of this section.
EliminatePhase
{
	FallSpeed				1		// Seconds per line, expression OK
	DontCollapseEmptyLines			// OPTIONAL: If this tag is set, empty lines will not be collapsed.
	EliminateBeginScript	{}		// OPTIONAL: Begin phase script.
	LineCollapsedScript		{}		// OPTIONAL: Execute this script after a line is collapsed.
	StartFallingScript		{}		// OPTIONAL: Executed when pieces start falling due to a line collapse.
	GroupLandedScript		{}		// OPTIONAL: Fired when a group of pieces lands.
	EliminateEndScript		{}		// OPTIONAL: End phase script.
}

// All info for the Solidify Phase.  Mandatory, only one instance of this section.
SolidifyPhase
{
	IteratorTags			0,1,2	// OPTIONAL: The MinoIteratorScript will be executed for each mino
									// with a tag that is in this list.  If you leave out IteratorTags,
									// the script will be run on ALL minos.
	SolidifyBeginScript		{}		// OPTIONAL: Begin phase script.
	MinoIteratorScript		{}		// OPTIONAL: This script is run on each Mino that matches the
									// IteratorTags (or all Minos if IteratorTags does not exist).
	SolidifyEndScript		{}		// OPTIONAL: End phase script.
}

// All info for the Gravity Phase.  Mandatory, only one instance of this section.
GravityPhase
{
	GravityEnabled					// OPTIONAL: Set this flag to turn gravity on by default.
	FallSpeed				1.0		// Seconds per line, expression OK.
	GravityBeginScript		{}		// OPTIONAL: Begin phase script.
	GroupLandedScript		{}		// OPTIONAL: Fired when a group of pieces lands.
	GravityEndScript		{}		// OPTIONAL: End phase script.
}

// All info for the Completion Phase.  Mandatory, only one instance of this section.
CompletionPhase
{
	CompletionBeginScript	{}		// OPTIONAL: Begin phase script.
	CompletionEndScript		{}		// OPTIONAL: End phase script.
}

// This section contains a number of scripts that are executed when certain events occur on the
// active piece.  All scripts are optional (though the EventScripts section itself is not), and
// scripts may appear in any order within the section.  The name of each script should be self-
// explanatory.
EventScripts
{
	GameStartScript			{}
	MinosPushedOffTopScript	{}
	LevelStartScript		{}
	LevelEndScript			{}
	PieceGenerationScript	{}
	MoveSuccessfulScript	{}
	MoveFailedScript		{}
	RotateSuccessfulScript	{}
	RotateFailedScript		{}
	HardDropStartScript		{}
	HardDropStepScript		{}
	SoftDropStartScript		{}
	SoftDropStepScript		{}
	FallStepScript			{}
	TouchdownScript			{}
	LockdownScript			{}
	GameSecondScript		{}
	LevelSecondScript
	{
		* this is a comment

		score level+5
		kill mino

		if playfield.d1 = 0
			if phase.d1 = 2
				exit
			end
			next level
			game win
			reset bag "tetramino0"
		end

		set playfield.d2 to phase.d0

		if phase.d0 = 1
			score level+2
			game lose
		else
			set phase.d0 to phase.d0 + 1
			kill mino
			set bag "tetramino0" to 0
			set playfield.d0 to playfield.d0 + 1
		end

		reset bag "tetramino0"
		send "BigGarbage"
		game win
	}

	// I've used the last script to show you what a run-time script looks like.  This isn't a
	// real script that you would use, and it probably doesn't do anything useful, it just shows
	// script syntax.  For a complete listing of all commands that are available, start with the
	// Tetrion Editor documentation.  Note the following differences apply when writing run-time
	// scripts in the TWS format:
	//
	// - All strings (e.g. names) must be quoted.
	// - C++ style comments (such as this one) or *-type comments may be used anywhere in the file,
	//   not just within run-time scripts.
	// - All run-time script commands as listed in version 2.0d58 (4/27/01) of the Editor document
	//   have been implemented with the following exceptions: HEIGHT, TOUCH, PHASE TIME, ITERATE,
	//   MINO.MARK, MINO.MARK2, MINO.FRESH, MINO.ID, SET MINO USING STICKY, SET MINO USING "shape",
	//   KILL MINO USING STICKY, KILL MINO USING "shape", MARK MINO USING STICKY, MARK MINO USING
	//   "shape", MARK MINO2 USING STICKY, MARK MINO2 USING "shape", SET BAG, RESET BAG.  I will
	//   implement these as time permits and on an as-needed basis.
	// - I have added the following run-time script commands to the TWS format:
	//     stop sound "name"	-	If the named sound is playing, this command stops it.
	//     stop all sounds		-	Stop all currently playing sounds.
	//     preload sound "name"	-	Preload the named sound, but don't start playing it.
	//     unload sound "name"	-	Unload the named sound, let it finish playing if needed.
	//     unload all sounds	-	Unload all preloaded sounds.
	//     mino mood <exp>		-	Set the mino character mood to the value of the expression.
	//     mino intensity X		-	Set the mino character intensity to X ("low", "medium" or "high").
	//     trace "string"		-	Print any string to the debug output.
	//     trace <exp> "string"	-	Print the value of the given expression, followed by the string,
	//								to debug output.
}

// The CustomEvent section contains (you guessed it) a custom game event.  This section is OPTIONAL,
// but you may define as many custom events as you like, provided each has a name unique among custom
// events.
CustomEvent
{
	Name		"BigGarbage"			// What is the name of the custom event?
	TriggerType	GameTime	30			// Custom events can be triggered in three ways:
										// Manual - fires by manual trigger only
										// GameTime <exp> - fires once when the game time equals the expression
										// LevelTime <exp> - fires once when the level time equals the expression
	Script								// This is the script triggered when the event occurs.
	{
		mix garbage 3*level
	}
}

SQUARE.TWS

//   FILE: Square Tetris v7.2DP.tws
// SOURCE: Square Tetris v7.2DP
//   DATE: Wed, Oct 31, 2001  12:37:16 PM


GeneralInfo
{
	PlayfieldColumns 10
	PlayfieldRows 22
	MaxMovementsPerSecond 15
	MaxRotationsPerSecond 5
	GameType Marathon
	NextPieceQueueSize 8
}

MinoSticky
{
	NotStickyBetweenPieces
	0: 0
	1: 1
	2: 2
	3: 3
	4: 4
	5: 5
	6: 6
	7: 7
	31: 31
}

Mino
{
	Name "J color"
	Tags 0
	MutateMino "Result J color"
}

Mino
{
	Name "L color"
	Tags 1
	MutateMino "Result L color"
}

Mino
{
	Name "S color"
	Tags 2
	MutateMino "Result S color"
}

Mino
{
	Name "Z color"
	Tags 3
	MutateMino "Result Z color"
}

Mino
{
	Name "O color"
	Tags 4
	MutateMino "Result O color"
}

Mino
{
	Name "T color"
	Tags 5
	MutateMino "Result T color"
}

Mino
{
	Name "I color"
	Tags 6
	MutateMino "Result I color"
}

Mino
{
	Name "Pure Square"
	Tags 31
	MutateMino "Result Pure Square"
	D9 2.5
}

Mino
{
	Name "Combo Square"
	Tags 31
	MutateMino "Result Combo Square"
	D9 1.25
}

Mino
{
	Name "Result J color"
	Tags 24
}

Mino
{
	Name "Result L color"
	Tags 25
}

Mino
{
	Name "Result S color"
	Tags 26
}

Mino
{
	Name "Result Z color"
	Tags 27
}

Mino
{
	Name "Result O color"
	Tags 28
}

Mino
{
	Name "Result T color"
	Tags 29
}

Mino
{
	Name "Result I color"
	Tags 30
}

Mino
{
	Name "Result Pure Square"
	Tags 23
}

Mino
{
	Name "Result Combo Square"
	Tags 22
}

Mino
{
	Name "Garbage"
	Antigravity
	Tags 20
}

Tetramino
{
	Name "J Tetrimino"
	NumberInBag 3
	ID 1
	MinoList
	{
		"J color" (-1,1)
		"J color" (-1,0)
		"J color" (0,0)
		"J color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "I Tetrimino"
	NumberInBag 3
	ID 2
	MinoList
	{
		"I color" (-1,0)
		"I color" (0,0)
		"I color" (1,0)
		"I color" (2,0)
	}
	Rot0CWOffsetList (0,0),(-1,0),(2,0),(-1,0),(2,0)
	Rot90CWOffsetList (-1,0),(0,0),(0,0),(0,1),(0,-2)
	Rot180CWOffsetList (-1,1),(1,1),(-2,1),(1,0),(-2,0)
	Rot270CWOffsetList (0,1),(0,1),(0,1),(0,-1),(0,2)
}

Tetramino
{
	Name "O Tetrimino"
	NumberInBag 3
	ID 3
	MinoList
	{
		"O color" (-1,1)
		"O color" (0,1)
		"O color" (-1,0)
		"O color" (0,0)
	}
	Rot0CWOffsetList (-1,0),(-1,0),(-1,0),(-1,0),(-1,0)
	Rot90CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot180CWOffsetList (0,-1),(0,-1),(0,-1),(0,-1),(0,-1)
	Rot270CWOffsetList (-1,-1),(-1,-1),(-1,-1),(-1,-1),(-1,-1)
}

Tetramino
{
	Name "S Tetrimino"
	NumberInBag 2
	ID 4
	MinoList
	{
		"S color" (0,1)
		"S color" (1,1)
		"S color" (-1,0)
		"S color" (0,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "L Tetrimino"
	NumberInBag 3
	ID 5
	MinoList
	{
		"L color" (1,1)
		"L color" (-1,0)
		"L color" (0,0)
		"L color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "Z Tetrimino"
	NumberInBag 2
	ID 6
	MinoList
	{
		"Z color" (-1,1)
		"Z color" (0,1)
		"Z color" (0,0)
		"Z color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "T Tetrimino"
	NumberInBag 3
	ID 7
	MinoList
	{
		"T color" (0,1)
		"T color" (-1,0)
		"T color" (0,0)
		"T color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

GarbageInfo
{
	NormalMino "Garbage"
	NormalCount 9
}

Shape
{
	Name "Perfect Square"
	Hotspot (7,8)
	ShapeCoords (4,11),(4,10),(4,9),(4,8),(5,11),(5,10),(5,9),(5,8),(6,11),(6,10),(6,9),(6,8),(7,11),(7,10),(7,9),(7,8)
}

Shape
{
	Name "T-spin 1"
	Hotspot (7,8)
	ShapeCoords (6,9),(6,7),(8,7)
}

Shape
{
	Name "T-spin 2"
	Hotspot (7,8)
	ShapeCoords (6,7),(8,9),(8,7)
}

Shape
{
	Name "Spin S 1"
	Hotspot (7,8)
	ShapeCoords (5,6),(6,8),(6,7),(8,6),(9,8),(9,7)
}

Shape
{
	Name "Spin S 2"
	Hotspot (7,8)
	ShapeCoords (4,6),(5,8),(5,7),(7,6),(8,8),(8,7)
}

Shape
{
	Name "Spin Z 1"
	Hotspot (7,8)
	ShapeCoords (5,8),(5,7),(6,6),(8,8),(8,7),(9,6)
}

Shape
{
	Name "Spin Z 2"
	Hotspot (7,8)
	ShapeCoords (6,8),(6,7),(7,6),(9,8),(9,7),(10,6)
}

Pattern
{
	Name "t-spin top"
	Triggered
	Tags 0,1,2,3,4,5,6,24,25,26,27,28,29,30,31
	Method Search
	SearchType Horizontal
	SearchCount 10
	PatternBeginScript
	{
		sound "FX_RWD02"
		set pl.d4 to 0
	}
	PatternMinoScript
	{
		set pl.d5 to mino.y
	}
}

Pattern
{
	Name "t-spin bottom"
	Triggered
	Tags 0,1,2,3,4,5,6,24,25,26,27,28,29,30,31
	Method Search
	SearchType Horizontal
	SearchCount 10
	PatternBeginScript
	{
		sound "FX_RWD01"
		set pl.d5 to 21
	}
	PatternMinoScript
	{
		if pl.d4 = -1
			set pl.d4 to mino.y
		end
	}
}

Pattern
{
	Name "J Square"
	Tags 0
	Method Shape
	ShapeName "Perfect Square"
	PatternPieceCount 4
	PatternBeginScript
	{
		sound "FX_GOLDF"
	}
	PatternMinoScript
	{
		set mino to "Pure Square"
		message "Pure Square!!!"
	}
	PatternEndScript
	{
		solidify
		set st1.d2 to st1.d2 + 1
		sound "VO_PURE"
	}
}

Pattern
{
	Name "I Square"
	Tags 6
	Method Shape
	ShapeName "Perfect Square"
	PatternPieceCount 4
	PatternBeginScript
	{
		sound "FX_GOLDF"
	}
	PatternMinoScript
	{
		set mino to "Pure Square"
		message "Pure Square!!!"
	}
	PatternEndScript
	{
		solidify
		set st1.d2 to st1.d2 + 1
		sound "VO_PURE"
	}
}

Pattern
{
	Name "O Square"
	Tags 4
	Method Shape
	ShapeName "Perfect Square"
	PatternPieceCount 4
	PatternBeginScript
	{
		sound "FX_GOLDF"
	}
	PatternMinoScript
	{
		set mino to "Pure Square"
		message "Pure Square!!!"
	}
	PatternEndScript
	{
		solidify
		set st1.d2 to st1.d2 + 1
		sound "VO_PURE"
	}
}

Pattern
{
	Name "T Square"
	Tags 5
	Method Shape
	ShapeName "Perfect Square"
	PatternPieceCount 4
	PatternBeginScript
	{
		sound "FX_GOLDF"
	}
	PatternMinoScript
	{
		set mino to "Pure Square"
		message "Pure Square!!!"
	}
	PatternEndScript
	{
		solidify
		set st1.d2 to st1.d2 + 1
		sound "VO_PURE"
	}
}

Pattern
{
	Name "L Square"
	Tags 1
	Method Shape
	ShapeName "Perfect Square"
	PatternPieceCount 4
	PatternBeginScript
	{
		sound "FX_GOLDF"
	}
	PatternMinoScript
	{
		set mino to "Pure Square"
		message "Pure Square!!!"
	}
	PatternEndScript
	{
		solidify
		set st1.d2 to st1.d2 + 1
		sound "VO_PURE"
	}
}

Pattern
{
	Name "Combo Square"
	Tags 0,1,2,3,4,5,6
	Method Shape
	ShapeName "Perfect Square"
	PatternPieceCount 4
	PatternBeginScript
	{
		sound "FX_SLVRF"
	}
	PatternMinoScript
	{
		set mino to "Combo Square"
		message "Combo Square!"
	}
	PatternEndScript
	{
		solidify
		set st1.d1 to st1.d1 + 1
		sound "VO_COMBO"
	}
}

Pattern
{
	Name "Line clear"
	Tags 0,1,2,3,4,5,6,22,23,24,25,26,27,28,29,30,31
	Method Search
	SearchType Horizontal
	SearchCount 10
	PatternBeginScript
	{
		if mino.d9 = 2.5
			line color (0,36,154)
		end
		if mino.d9 = 1.25
			line color (118,119,0)
		end
	}
	PatternMinoScript
	{
		set pf.d0 to pf.d0 + mino.d9
		kill mino
		sound "FX_CLR01"
	}
}

Level
{
	Name "Level #1"
}

Level
{
	Name "Level #2"
}

Level
{
	Name "Level #3"
}

Level
{
	Name "Level #4"
}

Level
{
	Name "Level #5"
}

Level
{
	Name "Level #6"
}

Level
{
	Name "Level #7"
}

Level
{
	Name "Level #8"
}

Level
{
	Name "Level #9"
}

Level
{
	Name "Level #10"
}

Level
{
	Name "Level #11"
}

Level
{
	Name "Level #12"
}

Level
{
	Name "Level #13"
}

Level
{
	Name "Level #14"
}

Level
{
	Name "Level #15"
}

GenerationPhase
{
	GenerationTime ((.8-((level-1)*.007))^(level-1))/20
	PieceStartingLocation (4,0)
	GenerationBeginScript
	{
		set pf.d2 to 1
		set pf.d4 to 0
	}
	GenerationEndScript
	{
		set st0.d4 to st0.d4 + 1
	}
}

FallingPhase
{
	FallSpeed (.8-((level-1)*.007))^(level-1)
	SoftDropSpeed ((.8-((level-1)*.007))^(level-1))/20
	HardDropSpeed 0.0001
	MoveTolerance 1
}

LockPhase
{
	MovementRestartsClock
	Duration 0.5
}

PatternPhase
{
	PatternBeginScript
	{
		set pl.d4 to -1
		set pl.d5 to -1
	}
}

IteratePhase
{
	PrimaryIterator
	{
		IteratorExpression pl.d4 != -1
		MinoIteratorScript
		{
			if mino.y > pl.d5
				exit
			end
			if mino.y < pl.d4
				exit
			end
			mutate mino
			sound "FX_LOCK"
		}
	}
	IterateEndScript
	{
		if pl.d4 != -1
			set gravity to 1
		end
		set pl.d6 to 0
	}
}

EliminatePhase
{
	FallSpeed 0.05
	LineCollapsedScript
	{
		set ph.d0 to ph.d0 + 1
	}
	StartFallingScript
	{
		set goal to goal - pf.d0
		set pf.d0 to 0
		if ph.d0 = 1
		line color (109,0,23)
		end
		if ph.d0 = 2
		line color (39,0,87)
		end
		if ph.d0 = 3
		line color (116,55,0)
		end
		if ph.d0 >= 4
		line color (0,91,56)
		end
	}
	GroupLandedScript
	{
		sound "FX_LNE01"
	}
	EliminateEndScript
	{
		set st2.d8 to goal
		if ph.d0 = 1
		 sound "VO_LINE01"
		 if pf.d4
		  set goal to goal - 1
		set st2.d9 to st2.d8 - goal
				message "T-spin"
		 end
			sound "FX_MTRS1"
		 set goal to goal -1
		set st2.d9 to st2.d8 - goal
		set st0.d0 to st0.d0 + 1
		message "Single"
		end
		if ph.d0 = 2
		 sound "VO_LINE02"
		 if pf.d4
		  set goal to goal - 3
		set st2.d9 to st2.d8 - goal
				message "T-spin"
		 end
			sound "FX_MTRS2"
			set goal to goal -3
		set st2.d9 to st2.d8 - goal
		set st0.d1 to st0.d1 + 1
		message "Double"
		end
		if ph.d0 = 3
		 sound "VO_LINE03"
			sound "FX_MTRS3"
			set goal to goal -5
		set st2.d9 to st2.d8 - goal
		set st0.d2 to st0.d2 + 1
		message "Triple"
		end
		if ph.d0 >= 4
		 sound "VO_TETRS"
			sound "FX_MTRS4"
		 set goal to goal -8
		set st2.d9 to st2.d8 - goal
		set st0.d3 to st0.d3 + 1
		message "Tetris!"
		end
		if goal < 0
		 set goal to 0
		end
	}
}

SolidifyPhase
{
}

GravityPhase
{
	FallSpeed 0.05
	GroupLandedScript
	{
		sound "FX_LOCK"
	}
	GravityEndScript
	{
		set gravity to 0
	}
}

CompletionPhase
{
	CompletionBeginScript
	{
		if pl.d8 - goal
		  set pl.d7 to (((pl.d9-goal)/pl.d9)-(level time/120)) * 20
					if pl.d7 > 4
						set pl.d7 to 4
					end
		 mino mood pl.d7
		 set pl.d8 to goal
		end
		if goal <= 0
			next level
			if level < 15
				sound "FX_LEVEL"
		 message "LEVEL UP!"
			end
		end
	}
}

EventScripts
{
	GameStartScript
	{
		set st2.d7 to rank
		sound "FX_LEVEL"
		set ghost to 1
		set st0.d0 to 0
		set st0.d1 to 0
		set st0.d2 to 0
		set st0.d3 to 0
		set st0.d4 to 0
		set st0.d5 to 0
		set st0.d7 to 0
		set st0.d8 to 0
		set st1.d1 to 0
		set st1.d2 to 0
		line color (30,30,30)
	}
	LevelStartScript
	{
		if level < 5
		 mino intensity low
		 else
		 if level < 10
		  mino intensity medium
		  else
		   mino intensity high
		 end
		end
		set pf.d3 to 0
		set goal to (10*level)
		set pf.d7 to 0
		set pl.d9 to goal
		set pl.d8 to goal
	}
	LevelEndScript
	{
		if level >= 15
			win
		end
	}
	MoveSuccessfulScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	MoveFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	RotateSuccessfulScript
	{
		sound "FX_RTA01"
		set st0.d5 to st0.d5 + 1
	}
	RotateFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	HardDropStartScript
	{
		sound "FX_HRDDP"
		set st0.d5 to st0.d5 + 1
		set pf.d2 to 0
	}
	SoftDropStepScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	FallStepScript
	{
		sound "FX_FALL"
	}
	TouchdownScript
	{
		if pf.d2
		 sound "FX_LND01"
		end
	}
	LockdownScript
	{
		if pf.d2
		 sound "FX_LCK01"
		end
		if piece.id = 7
			if spin
				shape "T-spin 1" at piece.x, piece.y
				if result = 1
		  	if piece.dir = 3
			  	pattern "t-spin top" at piece.x,piece.y-1
				  pattern "t-spin bottom" at piece.x,piece.y
			  else
				  pattern "t-spin top" at piece.x,piece.y
				  pattern "t-spin bottom" at piece.x,piece.y+1
			  end
		   if level < 6
		    sound "VO_TSPIN"
		   else
		    sound "FX_RWD01"
		   end
		   set goal to goal -1 
					set pf.d4 to 1
				else
					shape "T-spin 2" at piece.x, piece.y
					if result = 1
		  	if piece.dir = 3
			  	pattern "t-spin top" at piece.x,piece.y-1
				  pattern "t-spin bottom" at piece.x,piece.y
			  else
				  pattern "t-spin top" at piece.x,piece.y
				  pattern "t-spin bottom" at piece.x,piece.y+1
			  end
		    if level < 6
		     sound "VO_TSPIN"
		    else
		     sound "FX_RWD01"
		    end
		    set goal to goal -1 
						set pf.d4 to 1
					end
				end
			end
		end
	}
	GameSecondScript
	{
		if pl.d0 > 0
			mix garbage
			garbage pl.d0
			set pl.d0 to 0
		end
		set st0.d8 to game time
	}
	LevelSecondScript
	{
		set st0.d7 to level time
	}
}

CustomEvent
{
	Name "30 seconds"
	TriggerType LevelTime 90
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_30TIC"
				end
			end
		end
	}
}

CustomEvent
{
	Name "20 seconds"
	TriggerType LevelTime 100
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_20TIC"
				end
			end
		end
	}
}

CustomEvent
{
	Name "10 seconds"
	TriggerType LevelTime 110
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_10TIC"
				end
			end
		end
		sound "FX_TIC10"
	}
}

CustomEvent
{
	Name "9 seconds"
	TriggerType LevelTime 111
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_09TIC"
				end
			end
		end
		sound "FX_TIC09"
	}
}

CustomEvent
{
	Name "8 seconds"
	TriggerType LevelTime 112
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_08TIC"
				end
			end
		end
		sound "FX_TIC08"
	}
}

CustomEvent
{
	Name "7 seconds"
	TriggerType LevelTime 113
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_07TIC"
				end
			end
		end
		sound "FX_TIC07"
	}
}

CustomEvent
{
	Name "6 seconds"
	TriggerType LevelTime 114
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_06TIC"
				end
			end
		end
		sound "FX_TIC06"
	}
}

CustomEvent
{
	Name "5 seconds"
	TriggerType LevelTime 115
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_05TIC"
				end
			end
		end
		sound "FX_TIC05"
	}
}

CustomEvent
{
	Name "4 seconds"
	TriggerType LevelTime 116
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_04TIC"
				end
			end
		end
		sound "FX_TIC04"
	}
}

CustomEvent
{
	Name "3 seoncds"
	TriggerType LevelTime 117
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_03TIC"
				end
			end
		end
		sound "FX_TIC03"
	}
}

CustomEvent
{
	Name "2 seconds"
	TriggerType LevelTime 118
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_02TIC"
				end
			end
		end
		sound "FX_TIC02"
	}
}

CustomEvent
{
	Name "1 second"
	TriggerType LevelTime 119
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_01TIC"
				end
			end
		end
		sound "FX_TIC01"
	}
}

CustomEvent
{
	Name "Time up"
	TriggerType LevelTime 120
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
			 	sound "VO_OVRTIME"
				end
			end
		end
	}
}

CustomEvent
{
	Name "Intro"
	TriggerType LevelTime 3
	Script
	{
		if level < 4
			sound "VO_INT05"
		end
	}
}

CustomEvent
{
	Name "Countdown"
	TriggerType LevelTime 108
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
			 	sound "VO_COUNTDWN"
				end
			end
		end
	}
}

CustomEvent
{
	Name "Go for a Rank Up"
	TriggerType LevelTime 1
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
		 		message "GO FOR A RANK UP!!!"
				end
			end
		end
	}
}

TEST.TWS

// Tetris game definition file
//
// By Chris J. Gullette
// Last Modified $Date: 10/27/01 8:22p $
//
// This is a test game for development purposes.
// It is a VERY easy version of tetris, I pieces only, clear one line to level up,
// no time out.

GeneralInfo
{
	PlayfieldColumns		10
	PlayfieldRows			22
	MaxMovementsPerSecond	10
	MaxRotationsPerSecond	5
	GameType				Marathon
	RemoveFromBagAfterUse
	NextPieceQueueSize		8
}

MinoSticky
{
	NotStickyBetweenPieces
	0:	0
}

Mino
{
	Name	"Gray"
	Tags	0
}

Tetramino
{
	Name "I"
	NumberInBag 1
	ID 0
	MinoList
	{
		"Gray"	(0,1)
		"Gray"	(0,0)
		"Gray"	(0,-1)
		"Gray"	(0,-2)
	}
	Rot0CWOffsetList	(0,0),(0,1),(0,-1),(0,-2)
	Rot90CWOffsetList	(0,0),(1,0),(-1,0),(-2,0)
	Rot180CWOffsetList	(0,0),(0,-1),(0,1),(0,2)
	Rot270CWOffsetList	(0,0),(-1,0),(1,0),(2,0)
}

Pattern
{
	Name			"line clear"
	Tags			0
	Method			Search
	SearchType		Horizontal
	SearchCount		10
	PatternMinoScript
	{
		kill mino
	}
}

Level
{
	Name "Level #1"
}

Level
{
	Name "Level #2"
}

Level
{
	Name "Level #3"
}

Level
{
	Name "Level #4"
}

Level
{
	Name "Level #5"
}

Level
{
	Name "Level #6"
}

Level
{
	Name "Level #7"
}

Level
{
	Name "Level #8"
}

Level
{
	Name "Level #9"
}

Level
{
	Name "Level #10"
}

Level
{
	Name "Level #11"
}

Level
{
	Name "Level #12"
}

Level
{
	Name "Level #13"
}

Level
{
	Name "Level #14"
}

Level
{
	Name "Level #15"
}

GenerationPhase
{
	GenerationTime			0.0
	PieceStartingLocation	(4,0)
}

FallingPhase
{
	FallSpeed		1
	SoftDropSpeed	0.05
	HardDropSpeed	0.0001
	MoveTolerance	0.2
}

LockPhase
{
	MovementRestartsClock
	Duration		0.5
}

PatternPhase
{
}

IteratePhase
{
}

EliminatePhase
{
	FallSpeed		0.05
	LineCollapsedScript
	{
		* Count total lines cleared
		set playfield.d0 to playfield.d0 + 1
	}
	EliminateEndScript
	{
		if playfield.d0 >= 1
		  next level
		end
	}
}

SolidifyPhase
{
}

GravityPhase
{
	// No gravity
	FallSpeed		0
}

CompletionPhase
{
}

EventScripts
{
	LevelStartScript
	{
		set playfield.d0 to 0
	}

	LevelEndScript
	{
		if level >= 15
		 sound "VO_EXLNT"
		 win
		end
	}

	HardDropStartScript
	{
		next level
	}
}

TET2001.TWS

//   FILE: Tetris v7.2DP.tws
// SOURCE: Tetris v7.2DP
//   DATE: Wed, Oct 31, 2001  12:37:41 PM


GeneralInfo
{
	PlayfieldColumns 10
	PlayfieldRows 22
	MaxMovementsPerSecond 15
	MaxRotationsPerSecond 5
	GameType Marathon
	RemoveFromBagAfterUse
	NextPieceQueueSize 8
}

MinoSticky
{
	NotStickyBetweenPieces
	1: 1
	2: 2
	3: 3
	4: 4
	5: 5
	6: 6
	7: 7
}

Mino
{
	Name "J color"
	Tags 0,1
}

Mino
{
	Name "L color"
	Tags 0,2
}

Mino
{
	Name "S color"
	Tags 0,3
}

Mino
{
	Name "Z color"
	Tags 0,4
}

Mino
{
	Name "O color"
	Tags 0,5
}

Mino
{
	Name "T color"
	Tags 0,6
}

Mino
{
	Name "I color"
	Tags 0,7
}

Mino
{
	Name "Garbage"
	Tags 0,31
}

Tetramino
{
	Name "T Tetrimino"
	NumberInBag 1
	ID 1
	MinoList
	{
		"T color" (0,1)
		"T color" (-1,0)
		"T color" (0,0)
		"T color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "J Tetrimino"
	NumberInBag 1
	ID 2
	MinoList
	{
		"J color" (-1,1)
		"J color" (-1,0)
		"J color" (0,0)
		"J color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "L Tetrimino"
	NumberInBag 1
	ID 3
	MinoList
	{
		"L color" (1,1)
		"L color" (-1,0)
		"L color" (0,0)
		"L color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "S Tetrimino"
	NumberInBag 1
	ID 4
	MinoList
	{
		"S color" (0,1)
		"S color" (1,1)
		"S color" (-1,0)
		"S color" (0,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "Z Tetrimino"
	NumberInBag 1
	ID 5
	MinoList
	{
		"Z color" (-1,1)
		"Z color" (0,1)
		"Z color" (0,0)
		"Z color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "I Tetrimino"
	NumberInBag 1
	ID 6
	MinoList
	{
		"I color" (-1,0)
		"I color" (0,0)
		"I color" (1,0)
		"I color" (2,0)
	}
	Rot0CWOffsetList (0,0),(-1,0),(2,0),(-1,0),(2,0)
	Rot90CWOffsetList (-1,0),(0,0),(0,0),(0,1),(0,-2)
	Rot180CWOffsetList (-1,1),(1,1),(-2,1),(1,0),(-2,0)
	Rot270CWOffsetList (0,1),(0,1),(0,1),(0,-1),(0,2)
}

Tetramino
{
	Name "O Tetrimino"
	NumberInBag 1
	ID 7
	MinoList
	{
		"O color" (0,1)
		"O color" (1,1)
		"O color" (0,0)
		"O color" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,-1),(0,-1),(0,-1),(0,-1),(0,-1)
	Rot180CWOffsetList (-1,-1),(-1,-1),(-1,-1),(-1,-1),(-1,-1)
	Rot270CWOffsetList (-1,0),(-1,0),(-1,0),(-1,0),(-1,0)
}

GarbageInfo
{
	NormalMino "Garbage"
	NormalCount 9
}

Shape
{
	Name "T-spin1"
	Hotspot (7,8)
	ShapeCoords (6,9),(6,7),(8,7)
}

Shape
{
	Name "T-spin2"
	Hotspot (7,8)
	ShapeCoords (6,7),(8,9),(8,7)
}

Pattern
{
	Name "Line clear"
	Tags 0
	Method Search
	SearchType Horizontal
	SearchCount 10
	PatternMinoScript
	{
		kill mino
		sound "FX_CLR01"
	}
}

Level
{
	Name "Level #1"
}

Level
{
	Name "Level #2"
}

Level
{
	Name "Level #3"
}

Level
{
	Name "Level #4"
}

Level
{
	Name "Level #5"
}

Level
{
	Name "Level #6"
}

Level
{
	Name "Level #7"
}

Level
{
	Name "Level #8"
}

Level
{
	Name "Level #9"
}

Level
{
	Name "Level #10"
}

Level
{
	Name "Level #11"
}

Level
{
	Name "Level #12"
}

Level
{
	Name "Level #13"
}

Level
{
	Name "Level #14"
}

Level
{
	Name "Level #15"
}

GenerationPhase
{
	GenerationTime ((.8-((level-1)*.007))^(level-1))/20
	PieceStartingLocation (4,0)
	GenerationBeginScript
	{
		set pf.d2 to 1
		set pf.d4 to 0
	}
	GenerationEndScript
	{
		set st0.d4 to st0.d4 + 1
	}
}

FallingPhase
{
	FallSpeed (.8-((level-1)*.007))^(level-1)
	SoftDropSpeed ((.8-((level-1)*.007))^(level-1))/20
	HardDropSpeed 0.0001
	MoveTolerance 1
}

LockPhase
{
	MovementRestartsClock
	Duration 0.5
}

PatternPhase
{
}

IteratePhase
{
}

EliminatePhase
{
	FallSpeed 0.05
	LineCollapsedScript
	{
		set ph.d0 to ph.d0 + 1
	}
	StartFallingScript
	{
		if ph.d0 = 1
		line color (109,0,23)
		end
		if ph.d0 = 2
		line color (39,0,87)
		end
		if ph.d0 = 3
		line color (116,55,0)
		end
		if ph.d0 = 4
			line color (0,91,56)
		 if pf.d3
				line color (118,119,0)
		 else
		 	set pf.d3 to 1
			end
		end
	}
	GroupLandedScript
	{
		sound "FX_LNE01"
	}
	EliminateEndScript
	{
		set st2.d8 to goal
		if ph.d0 = 1
		 sound "VO_LINE01"
			sound "FX_MTRS1"
		 set goal to goal -1
		set st2.d9 to st2.d8 - goal
			set st0.d0 to st0.d0 + 1
			message "Single"
		 set pf.d3 to 0
		 if pf.d4
		  set goal to goal -1
		set st2.d9 to st2.d8 - goal
				message "T-spin"
		 end
		end
		if ph.d0 = 2
		 sound "VO_LINE02"
			sound "FX_MTRS2"
			set goal to goal -3
		set st2.d9 to st2.d8 - goal
			set st0.d1 to st0.d1 + 1
			message "Double" 
		 set pf.d3 to 0
		 if pf.d4
		  set goal to goal -3
		set st2.d9 to st2.d8 - goal
				message "T-spin"
		 end
		end
		if ph.d0 = 3
		 sound "VO_LINE03"
			sound "FX_MTRS3"
			set goal to goal -5
		set st2.d9 to st2.d8 - goal
			set st0.d2 to st0.d2 + 1
			message "Triple"
		 set pf.d3 to 0
		end
		if ph.d0 = 4
		 sound "VO_TETRS"
			sound "FX_MTRS5"
		 if pf.d3
		  set goal to goal -4
		set st2.d9 to st2.d8 - goal
		set st0.d9 to st0.d9 + 1
		message "B2B Tetris!!!"
		  sound "FX_MTRS6"
				sound "VO_B2B"
		 else
		 set pf.d3 to 1
		message "Tetris!"
			end
		 set goal to goal -8
		set st2.d9 to st2.d8 - goal
		set st0.d3 to st0.d3 + 1
		end
		if goal < 0
		 set goal to 0
		end
	}
}

SolidifyPhase
{
}

GravityPhase
{
	FallSpeed 0.05
	GroupLandedScript
	{
		sound "FX_LOCK"
	}
}

CompletionPhase
{
	CompletionBeginScript
	{
		if pl.d8 - goal
		  set pl.d7 to (((pl.d9-goal)/pl.d9)-(level time/120)) * 20
					if pl.d7 > 4
						set pl.d7 to 4
					end
		 mino mood pl.d7
		 set pl.d8 to goal
		end
		if goal <= 0
			next level
			if level < 15
				sound "FX_LEVEL"
		 message "LEVEL UP!"
			end
		end
	}
}

EventScripts
{
	GameStartScript
	{
		set st2.d7 to rank
		sound "FX_LEVEL"
		set ghost to 1
		set st0.d0 to 0
		set st0.d1 to 0
		set st0.d2 to 0
		set st0.d3 to 0
		set st0.d4 to 0
		set st0.d5 to 0
		set st0.d7 to 0
		set st0.d8 to 0
		set st0.d9 to 0
		set st1.d0 to 0
		line color (30,30,30)
	}
	LevelStartScript
	{
		if level < 5
		 mino intensity low
		 else
		 if level < 10
		  mino intensity medium
		  else
		   mino intensity high
		 end
		end
		set pf.d1 to (5*level)
		set goal to pf.d1
		set pf.d7 to 0
		set pl.d9 to goal
		set pl.d8 to goal
	}
	LevelEndScript
	{
		if level >= 15
		 sound "VO_EXLNT"
		 win
		end
	}
	MoveSuccessfulScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	MoveFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	RotateSuccessfulScript
	{
		sound "FX_RTA01"
		set st0.d5 to st0.d5 + 1
	}
	RotateFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	HardDropStartScript
	{
		sound "FX_HRDDP"
		set st0.d5 to st0.d5 + 1
		set pf.d2 to 0
	}
	SoftDropStepScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	FallStepScript
	{
		sound "FX_FALL"
	}
	TouchdownScript
	{
		if pf.d2
		 sound "FX_LND01"
		end
	}
	LockdownScript
	{
		if pf.d2
			sound "FX_LCK01"
		end
		if piece.id = 1
		 if spin
		  shape "T-spin1" at piece.x, piece.y
		   if result = 1
		    if level < 10
		     sound "VO_TSPIN"
		    else
		     sound "FX_RWD01"
		    end
		   set goal to goal -1 
		   set pf.d4 to 1
				set st1.d0 to st1.d0 + 1
					else
		    shape "T-spin2" at piece.x, piece.y
								if result = 1
						if level < 10
		     sound "VO_TSPIN"
		    else
		     sound "FX_RWD01"
		    end
						set goal to goal -1 
						set pf.d4 to 1
					set st1.d0 to st1.d0 + 1
					end
				end
			end
		end
	}
	GameSecondScript
	{
		if pl.d0 > 0
			mix garbage
			garbage pl.d0
			set pl.d0 to 0
		end
		set st0.d8 to game time
	}
	LevelSecondScript
	{
		set st0.d7 to level time
	}
}

CustomEvent
{
	Name "30 seconds"
	TriggerType LevelTime 90
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_30TIC"
				end
			end
		end
	}
}

CustomEvent
{
	Name "20 seconds"
	TriggerType LevelTime 100
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_20TIC"
				end
			end
		end
	}
}

CustomEvent
{
	Name "10 seconds"
	TriggerType LevelTime 110
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_10TIC"
				end
			end
		end
		sound "FX_TIC10"
	}
}

CustomEvent
{
	Name "9 seconds"
	TriggerType LevelTime 111
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_09TIC"
				end
			end
		end
		sound "FX_TIC09"
	}
}

CustomEvent
{
	Name "8 seconds"
	TriggerType LevelTime 112
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_08TIC"
				end
			end
		end
		sound "FX_TIC08"
	}
}

CustomEvent
{
	Name "7 seconds"
	TriggerType LevelTime 113
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_07TIC"
				end
			end
		end
		sound "FX_TIC07"
	}
}

CustomEvent
{
	Name "6 seconds"
	TriggerType LevelTime 114
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_06TIC"
				end
			end
		end
		sound "FX_TIC06"
	}
}

CustomEvent
{
	Name "5 seconds"
	TriggerType LevelTime 115
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_05TIC"
				end
			end
		end
		sound "FX_TIC05"
	}
}

CustomEvent
{
	Name "4 seconds"
	TriggerType LevelTime 116
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_04TIC"
				end
			end
		end
		sound "FX_TIC04"
	}
}

CustomEvent
{
	Name "3 seconds"
	TriggerType LevelTime 117
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_03TIC"
				end
			end
		end
		sound "FX_TIC03"
	}
}

CustomEvent
{
	Name "2 seconds"
	TriggerType LevelTime 118
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_02TIC"
				end
			end
		end
		sound "FX_TIC02"
	}
}

CustomEvent
{
	Name "1 second"
	TriggerType LevelTime 119
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_01TIC"
				end
			end
		end
		sound "FX_TIC01"
	}
}

CustomEvent
{
	Name "Time up"
	TriggerType LevelTime 120
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
		 		sound "VO_OVRTIME"
				end
			end
		end
	}
}

CustomEvent
{
	Name "Go for a Tetris"
	TriggerType GameTime 3
	Script
	{
		if level < 4
			sound "VO_INT01"
		end
	}
}

CustomEvent
{
	Name "Countdown"
	TriggerType LevelTime 108
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
				 sound "VO_COUNTDWN"
				end
			end
		end
	}
}

CustomEvent
{
	Name "Go for a Rank Up"
	TriggerType LevelTime 1
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
			 	message "GO FOR A RANK UP!!!"
				end
			end
		end
	}
}

TNT.TWS

//   FILE: Sticky Tetris v7.2DP.tws
// SOURCE: Sticky Tetris v7.2DP
//   DATE: Wed, Oct 31, 2001  12:37:27 PM


GeneralInfo
{
	PlayfieldColumns 10
	PlayfieldRows 22
	MaxMovementsPerSecond 15
	MaxRotationsPerSecond 5
	GameType Marathon
	RemoveFromBagAfterUse
	NextPieceQueueSize 8
}

MinoSticky
{
	1: 1
	2: 2
	3: 3
	4: 4
	5: 5
	6: 6
	7: 7
}

Mino
{
	Name "T"
	Tags 0,1
	AltMino "L"
	AltChance 20
}

Mino
{
	Name "S"
	Tags 0,2
	AltMino "J"
	AltChance 20
}

Mino
{
	Name "Z"
	Tags 0,3
	AltMino "O"
	AltChance 20
}

Mino
{
	Name "L"
	Tags 0,4
	AltMino "Z"
	AltChance 20
}

Mino
{
	Name "O"
	Tags 0,5
	AltMino "I"
	AltChance 20
}

Mino
{
	Name "I"
	Tags 0,6
	AltMino "S"
	AltChance 20
}

Mino
{
	Name "J"
	Tags 0,7
	AltMino "T"
	AltChance 20
}

Mino
{
	Name "garbage"
	Antigravity
	Tags 0,30
}

Mino
{
	Name "special garbage"
	Antigravity
	Tags 31
}

Tetramino
{
	Name "T"
	NumberInBag 1
	ID 1
	MinoList
	{
		"T" (0,1)
		"T" (-1,0)
		"T" (0,0)
		"T" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "J"
	NumberInBag 1
	ID 2
	MinoList
	{
		"J" (-1,1)
		"J" (-1,0)
		"J" (0,0)
		"J" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "L"
	NumberInBag 1
	ID 3
	MinoList
	{
		"L" (1,1)
		"L" (-1,0)
		"L" (0,0)
		"L" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "S"
	NumberInBag 1
	ID 4
	MinoList
	{
		"S" (0,1)
		"S" (1,1)
		"S" (-1,0)
		"S" (0,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "Z"
	NumberInBag 1
	ID 5
	MinoList
	{
		"Z" (-1,1)
		"Z" (0,1)
		"Z" (0,0)
		"Z" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,0),(1,0),(1,-1),(0,2),(1,2)
	Rot180CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot270CWOffsetList (0,0),(-1,0),(-1,-1),(0,2),(-1,2)
}

Tetramino
{
	Name "I"
	NumberInBag 1
	ID 6
	MinoList
	{
		"I" (-1,0)
		"I" (0,0)
		"I" (1,0)
		"I" (2,0)
	}
	Rot0CWOffsetList (0,0),(-1,0),(2,0),(-1,0),(2,0)
	Rot90CWOffsetList (-1,0),(0,0),(0,0),(0,1),(0,-2)
	Rot180CWOffsetList (-1,1),(1,1),(-2,1),(1,0),(-2,0)
	Rot270CWOffsetList (0,1),(0,1),(0,1),(0,-1),(0,2)
}

Tetramino
{
	Name "O"
	NumberInBag 1
	ID 7
	MinoList
	{
		"O" (0,1)
		"O" (1,1)
		"O" (0,0)
		"O" (1,0)
	}
	Rot0CWOffsetList (0,0),(0,0),(0,0),(0,0),(0,0)
	Rot90CWOffsetList (0,-1),(0,-1),(0,-1),(0,-1),(0,-1)
	Rot180CWOffsetList (-1,-1),(-1,-1),(-1,-1),(-1,-1),(-1,-1)
	Rot270CWOffsetList (-1,0),(-1,0),(-1,0),(-1,0),(-1,0)
}

GarbageInfo
{
	NormalMino "garbage"
	NormalCount pf.d9
	SpecialMino "special garbage"
	SpecialCount pf.d8
}

Shape
{
	Name "tspin1"
	Hotspot (7,8)
	ShapeCoords (6,9),(6,7),(8,7)
}

Shape
{
	Name "tspin2"
	Hotspot (7,8)
	ShapeCoords (6,7),(8,9),(8,7)
}

Pattern
{
	Name "line clear"
	Tags 0,30,31
	Method Search
	SearchType Horizontal
	SearchCount 10
	PatternMinoScript
	{
		kill mino
		sound "FX_CLR01"
	}
	PatternEndScript
	{
		set st1.d3 to st1.d3 + 1
	}
}

Pattern
{
	Name "Critical Mass Blue"
	Tags 1
	Method Search
	SearchType FloodFill4D
	SearchCount 24
	PatternMinoScript
	{
		kill mino
		message "Critical Mass!"
		sound "FX_MASS1"
	}
	PatternEndScript
	{
		set st1.d7 to ((st1.d7 / 24) + 1)
		if level < 6
			sound "VO_MASS"
		end
	}
}

Pattern
{
	Name "Critical Mass Cyan"
	Tags 2
	Method Search
	SearchType FloodFill4D
	SearchCount 24
	PatternMinoScript
	{
		kill mino
		message "Critical Mass!"
		sound "FX_MASS1"
	}
	PatternEndScript
	{
		set st1.d7 to ((st1.d7 / 24) + 1)
		if level < 6
			sound "VO_MASS"
		end
	}
}

Pattern
{
	Name "Critical Mass Green"
	Tags 3
	Method Search
	SearchType FloodFill4D
	SearchCount 24
	PatternMinoScript
	{
		kill mino
		message "Critical Mass!"
		sound "FX_MASS1"
	}
	PatternEndScript
	{
		set st1.d7 to ((st1.d7 / 24) + 1)
		if level < 6
			sound "VO_MASS"
		end
	}
}

Pattern
{
	Name "Critical Mass Red"
	Tags 4
	Method Search
	SearchType FloodFill4D
	SearchCount 24
	PatternMinoScript
	{
		kill mino
		message "Critical Mass!"
		sound "FX_MASS1"
	}
	PatternEndScript
	{
		set st1.d7 to ((st1.d7 / 24) + 1)
		if level < 6
			sound "VO_MASS"
		end
	}
}

Pattern
{
	Name "Critical Mass Maroon"
	Tags 5
	Method Search
	SearchType FloodFill4D
	SearchCount 24
	PatternMinoScript
	{
		kill mino
		message "Critical Mass!"
		sound "FX_MASS1"
	}
	PatternEndScript
	{
		set st1.d7 to ((st1.d7 / 24) + 1)
		if level < 6
			sound "VO_MASS"
		end
	}
}

Pattern
{
	Name "Critical Mass Yellow"
	Tags 6
	Method Search
	SearchType FloodFill4D
	SearchCount 24
	PatternMinoScript
	{
		kill mino
		message "Critical Mass!"
		sound "FX_MASS1"
	}
	PatternEndScript
	{
		set st1.d7 to ((st1.d7 / 24) + 1)
		if level < 6
			sound "VO_MASS"
		end
	}
}

Pattern
{
	Name "Critical Mass Purple"
	Tags 7
	Method Search
	SearchType FloodFill4D
	SearchCount 24
	PatternMinoScript
	{
		kill mino
		message "Critical Mass!"
		sound "FX_MASS1"
	}
	PatternEndScript
	{
		set st1.d7 to ((st1.d7 / 24) + 1)
		if level < 6
			sound "VO_MASS"
		end
	}
}

GenerationPhase
{
	GenerationTime ((.8-((level-1)*.007))^(level-1))/20
	PieceStartingLocation (4,0)
	GenerationBeginScript
	{
		set pf.d2 to 1
		set pf.d4 to 0
	}
	GenerationEndScript
	{
		set st0.d4 to st0.d4 + 1
	}
}

FallingPhase
{
	FallSpeed (.8-((level-1)*.007))^(level-1)
	SoftDropSpeed ((.8-((level-1)*.007))^(level-1))/20
	HardDropSpeed 0.0001
	MoveTolerance 1
}

LockPhase
{
	MovementRestartsClock
	Duration 0.5
}

PatternPhase
{
	PatternBeginScript
	{
		set ph.d0 to 0
	}
	PatternEndScript
	{
		if ph.d0 = 1
			set pf.d6 to pf.d6 + 1
		end
	}
}

IteratePhase
{
	PrimaryIterator
	{
		IteratorExpression pf.d3=1
		MinoIteratorScript
		{
			kill mino
			if level < 15
				sound "FX_LEVEL"
			message "LEVEL UP!"
			end
			set pf.d3 to pf.d3+1
		}
	}
}

EliminatePhase
{
	FallSpeed 0.05
	EliminateBeginScript
	{
		set ph.d0 to 0
	}
	LineCollapsedScript
	{
		set ph.d0 to ph.d0 + 1
	}
	GroupLandedScript
	{
		sound "FX_LNE01"
	}
	EliminateEndScript
	{
		if ph.d0 > 0
		 if cascades = 2
		 set st1.d4 to st1.d4 + 2
		 end
			if cascades > 2
			set st1.d4 to st1.d4 + 1
			end
		end
		if ph.d0 >= st1.d6
			set st1.d6 to ph.d0
		end
	}
}

SolidifyPhase
{
	IteratorTags 31
	MinoIteratorScript
	{
		set ph.d0 to ph.d0+ 1
	}
	SolidifyEndScript
	{
		if ph.d0 = 0
			set pf.d3 to pf.d3 + 1
		 	if pf.d3 = 1
		 		touch
		 	end
			next level
		end
	}
}

GravityPhase
{
	GravityEnabled
	FallSpeed 0.05
	GroupLandedScript
	{
		sound "FX_LOCK"
	}
}

CompletionPhase
{
	CompletionBeginScript
	{
		if pl.d8 - goal
		  set pl.d7 to (((pl.d9-goal)/pl.d9)-(level time/120)) * 20
					if pl.d7 > 4
						set pl.d7 to 4
					end
		 mino mood pl.d7
		 set pl.d8 to goal
		end
	}
	CompletionEndScript
	{
		if cascades > st1.d5
			set st1.d5 to cascades
		end
		if cascades = 2
		message "2 Cascade"
		line color (109,0,23)
		 sound "FX_MTRS1"
		 sound "VO_CAS02"
		end
		if cascades = 3
		message "3 Cascades"
		line color (39,0,87)
		 sound "FX_MTRS2"
		 sound "VO_CAS03"
		end
		if cascades = 4
		message "4 Cascades"
		line color (39,0,87)
		 sound "FX_MTRS3"
		 sound "VO_CAS04"
		end
		if cascades = 5
		message "5 Cascades"
		line color (116,55,0)
		 sound "FX_MTRS4"
		 sound "VO_CAS05"
		end
		if cascades = 6
		message "6 Cascades"
		line color (116,55,0)
		 sound "FX_MTRS5"
		 sound "VO_CAS06"
		end
		if cascades = 7
		message "7 Cascades"
		line color (0,91,56)
		 sound "FX_MTRS6"
		 sound "VO_CAS07"
		end
		if cascades = 8
			message "8 Cascades"
		line color (0,91,56)
		 sound "FX_MTRS6"
		 sound "VO_CAS08"
		end
		if cascades = 9
			message "9 Cascades"
		line color (118,119,0)
		 sound "FX_MTRS6"
		 sound "VO_CAS09"
		end
		if cascades = 10
			message "10 Cascades"
		line color (118,119,0)
		 sound "FX_MTRS6"
		 sound "VO_CAS10"
		end
		if cascades >= 11
			message "Super Cascade!!!"
		line color (0,36,154)
			sound "VO_AMAZING"
		 sound "FX_MTRS6"
		end
	}
}

EventScripts
{
	GameStartScript
	{
		set st2.d7 to rank
		sound "FX_LEVEL"
		set ghost to 1
		set st1.d3 to 0
		set st1.d4 to 0
		set st1.d5 to 0
		set st1.d6 to 0
		set st1.d7 to 0
		set st0.d4 to 0
		set st0.d5 to 0
		set st0.d7 to 0
		set st0.d8 to 0
		line color (30,30,30)
	}
	LevelStartScript
	{
		if level < 5
		 mino intensity low
		 else
		 if level < 10
		  mino intensity medium
		  else
		   mino intensity high
		 end
		end
		set pf.d0 to 0
		set pf.d8 to 0
		set pf.d9 to 5
		mixed garbage level
		set pf.d9 to 0
		set pf.d8 to 5
		mixed garbage 1
		set pf.d3 to 0
		set pf.d7 to 0
		set pl.d9 to goal
		set pl.d8 to goal
	}
	LevelEndScript
	{
		if level >= 15
		 sound "VO_EXLNT"
		 win
		end
	}
	MoveSuccessfulScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	MoveFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	RotateSuccessfulScript
	{
		sound "FX_RTA01"
		set st0.d5 to st0.d5 + 1
	}
	RotateFailedScript
	{
		sound "FX_LND01"
		set st0.d5 to st0.d5 + 1
	}
	HardDropStartScript
	{
		sound "FX_HRDDP"
		set st0.d5 to st0.d5 + 1
		set pf.d2 to 0
	}
	SoftDropStepScript
	{
		sound "FX_FALL"
		set st0.d5 to st0.d5 + 1
	}
	FallStepScript
	{
		sound "FX_FALL"
	}
	TouchdownScript
	{
		if pf.d2
		 sound "FX_LND01"
		end
	}
	LockdownScript
	{
		if pf.d2
		 sound "FX_LCK01"
		end
		if piece.id = 1
			if spin
				shape "T-spin1" at piece.x, piece.y
				if result = 1
		   if level < 6
		    sound "VO_TSPIN"
		   else
		    sound "FX_RWD01"
		   end
					set pf.d4 to 1
				else
					shape "T-spin2" at piece.x, piece.y
					if result = 1
		    if level < 6
		     sound "VO_TSPIN"
		    else
		     sound "FX_RWD01"
		    end
						set pf.d4 to 1
					end
				end
			end
		end
	}
	GameSecondScript
	{
		set st0.d8 to game time
	}
	LevelSecondScript
	{
		set st0.d7 to level time
	}
}

CustomEvent
{
	Name "Intro"
	TriggerType LevelTime 3
	Script
	{
		if level < 4
			sound "VO_INT06"
		end
	}
}

CustomEvent
{
	Name "Time Up"
	TriggerType LevelTime 120
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
		 		sound "VO_OVRTIME"
				end
			end
		end
	}
}

CustomEvent
{
	Name "30"
	TriggerType LevelTime 90
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_30TIC"
				end
			end
		end
	}
}

CustomEvent
{
	Name "20"
	TriggerType LevelTime 100
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_20TIC"
				end
			end
		end
	}
}

CustomEvent
{
	Name "10"
	TriggerType LevelTime 110
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_10TIC"
				end
			end
		end
		sound "FX_TIC10"
	}
}

CustomEvent
{
	Name "9"
	TriggerType LevelTime 111
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_09TIC"
				end
			end
		end
		sound "FX_TIC09"
	}
}

CustomEvent
{
	Name "8"
	TriggerType LevelTime 112
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_08TIC"
				end
			end
		end
		sound "FX_TIC08"
	}
}

CustomEvent
{
	Name "7"
	TriggerType LevelTime 113
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_07TIC"
				end
			end
		end
		sound "FX_TIC07"
	}
}

CustomEvent
{
	Name "6"
	TriggerType LevelTime 114
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_06TIC"
				end
			end
		end
		sound "FX_TIC06"
	}
}

CustomEvent
{
	Name "5"
	TriggerType LevelTime 115
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_05TIC"
				end
			end
		end
		sound "FX_TIC05"
	}
}

CustomEvent
{
	Name "4"
	TriggerType LevelTime 116
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_04TIC"
				end
			end
		end
		sound "FX_TIC04"
	}
}

CustomEvent
{
	Name "3"
	TriggerType LevelTime 117
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_03TIC"
				end
			end
		end
		sound "FX_TIC03"
	}
}

CustomEvent
{
	Name "2"
	TriggerType LevelTime 118
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_02TIC"
				end
			end
		end
		sound "FX_TIC02"
	}
}

CustomEvent
{
	Name "1"
	TriggerType LevelTime 119
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
					sound "VO_01TIC"
				end
			end
		end
		sound "FX_TIC01"
	}
}

CustomEvent
{
	Name "Countdown"
	TriggerType LevelTime 108
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
		 		sound "VO_COUNTDWN"
				end
			end
		end
	}
}

CustomEvent
{
	Name "Go for a Rank Up"
	TriggerType LevelTime 1
	Script
	{
		if rank = st2.d7
			if level >= rank
				if rank < 15
				 message "GO FOR A RANK UP!!!"
				end
			end
		end
	}
}