--[[

PROGRAM NAME:	LUA SINGE ENGINE
VERSION:		3.32
AUTHOR:			KARIS (2021)

This file is part of LUA SINGE ENGINE.

	LUA SINGE ENGINE is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation.

	LUA SINGE ENGINE is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

	Thanks to Scott Duensing, RDG.

]]--

dofile("Singe/Framework.singe")		
dofile("KarisFramework/Script/main.singe")
dofile("KarisFramework/Script/hscore.singe")
dofile("KarisFramework/Script/service.singe")
dofile("KarisFramework/Script/toolbox.singe")
dofile(MYDIR .. "/Script/addons.singe")

lfs = require("lfs")

--Framework.singe....

p1UP = false		
p1DOWN = false		
p1LEFT = false
p1RIGHT = false
p1BUTTON1 = false
p1BUTTON2 = false
p1BUTTON3 = false
p1COIN1 = false
p1COIN2 = false
p1SERVICE = false
p1START1 = false
p1START2 = false
p1PAUSE = false
p1CONSOLE = false

--End Framework

bPause = false
bResetContinue = false
bAct = false
bShowCredits = false
bShowAction = false
bShowLives = false
bShowScore = false
bShowLvl = false
bShowSkip = false
bShowGet = false
bShowTop = false
bShowDisk = false
bSkipIntroClip = false
bLevelComplete = false
bCheckForCredits = false
bPlayPrompt = false
bIgnoreJoy = false
bExtendedPlay = false
bLCDLineWait = false
bGOAlt = false
bTestMash = false
bTestRunL = false
bTestRunR = false
bTestHold = false
bAllowSave = false
bSave = false
bCheckMove = false
bShuffleOrder = true
bRes = true
bFlip = false
bPath = false
bCalc = true
bOneDiff = true
bSwap = false
bInPlayExit = false
bScan = false
bGR = false
ForceRewind = false
altCfg = false
bTime = true
b1PStart = false 
b2PStart = false
b1PEnd = false
b2PEnd = false 

dip_Loadsave = 0
dip_Slot = 1

DOPT_FREEPLAY = 0
DOPT_INFINITE_CONTINUES = 4
t1 = 0
t2 = 0
t3 = 0
t4 = 0
t1l = 0
t2l = 0
t3l = 0
t4l = 0


gameflow = 0
flow_VLDPStart = 0
flow_GameInit = 1
flow_GameRunning = 2

lvlState = 0
lvlSetup = 0
lvlRunning = 1
lvlEnd = 2
lvlPlayDeath = 3
lvlPlayRest = 4
branch01 = 10
branch02 = 11
branch03 = 12
branch04 = 13
branch05 = 14
branch06 = 15
branch07 = 16
branch08 = 17
branch09 = 18
branch10 = 19
branch11 = 20
branch12 = 21

sceneStart = 0
sceneEnd = 0
currentFrame = 0
currentLevel = 0
currentMove = 0
levelIntro = 0
levelContinue = 100
levelGameOver = 101
levelChoose = 102
levelNormal = 103
levelService = 104
levelMap = 105
levelHighScore = 106
levelMovie = 107
levelSave = 108
levelDiffScreen = 109
levelFinish = 110
levelTrophy = 111
levelExit = 112
levelGraphic = 113
levelPerf = 114
level2P = 115
level2PEnd = 116
levelSecret = 1000

offsetIntroGame = 0			
offsetIntroGameend = 0

iCoins = 0
iCredits = 0
iScore = 0
iScoreTemp = 0
iScoreSave = 0
iLiveSave = 5
iBonus = 0
iLives = 0
iLevelStart = 0
iLevelEnd = 0
iTempLevel = 0
iStageIndex = 0
iContinues = 0
iLastFiller = 1
iChoice = 0
iLevel = 1
iPauseFrame = 0
iDeathCount = 0
iRoll = 0
curPath = 0
iPath = 0
iPathA = 0
iPathAend = 0
iPathAjmp = 0
iPathB = 0
thisMove = 0
altState = 0
altState2 = 0
diffState = 0
totalMoves = 0
iMash = 0
mashCounter = 5
lenCounter = 8
iMulti = 0
iMovie = 1
iPenal = 0
iTop = 0
iLenHold = 0
yscopos = 0
ylivpos = 0
ycoinpos = 0
ylvlpos = 0
ydskpos = 0
numChoice = 3
numTrophy = 0
lastHold = 0
fontSize = 0
fontSizeNew = 0
iRightMv = 0
iWrongMv = 0
iExtraLife = 0
iLifeBar = 10
iScPlayed = 1
iScDeath = 0
iTotDeath = 0
BarSize = 10
BarMin = 2
BarBonus = 3
Tlimit = 0
posGauge = 0
Hit = 0
i2P = 0
i1PScore = 0
i2PScore = 0
iLoopStep = 0
iLoopPrev = 0

NOMOVE = -1
MOVEPENDING = -2
MOVEFAIL = -3

UP = 1
DOWN = 2
LEFT = 3
RIGHT = 4
BUTTON1 = 5
BUTTON2 = 6
BUTTON3 = 7
BUTTON4 = 8
UPLEFT = 9
UPRIGHT = 10
DOWNLEFT = 11
DOWNRIGHT = 12
ACTUP = 13
ACTDOWN = 14
ACTLEFT = 15
ACTRIGHT = 16
MASH = 17
MASHMIN = 18
MASHMAX = 19 
LETGO = 20
HOLDUP = 21
HOLDDOWN = 22
HOLDLEFT = 23
HOLDRIGHT = 24
HOLDBUT = 25
DOUBLE = 26
RUN = 27
RUNMIN = 28
RUNMAX = 29
MASH2 = 30
MASH2MIN = 31
MASH2MAX = 32
MULTI = 33
DOUBLE = 34
LOOPLEFT = 35
LOOPRIGHT = 36
CHOOSE = 50
PATH = 51
YESNO = 52
TIMED = 53
WAY = 98
WAYOUT = 99
SKIP = 100

INSERTCOIN = 101
CREDIT	   = 102
LIVES	   = 103
LEVEL      = 104
SKIPINTRO  = 105
SCENES     = 106
SCORE      = 107
BONUS      = 108
SELMAP	   = 109
OKMAP      = 110 
D1         = 111  
D2         = 112
D3         = 113  
DA         = 114
ARROWSELL  = 115
ARROWSELR  = 116
FREEPLAY   = 117
GETREADY   = 118
TOPSCORE   = 119
SECRET     = 120
PW0 	   = 121
PW1 	   = 122
PW2 	   = 123
PW3 	   = 124
PW4 	   = 125
PW5 	   = 126
PW6 	   = 127
PW7		   = 128
PWFULL 	   = 129
MOVE 	   = 130
HOLD 	   = 131
NOMOVES    = 132
BUTTONS	   = 133
STICK 	   = 134
SPECIALS   = 135
TN 		   = 136
TB 		   = 137
TS 		   = 138
TG 		   = 139
TP 		   = 140
DEATH      = 141
TOTAL      = 142
MINUS      = 143
PERFECT    = 144
BARFULL    = 145
BARNONE    = 146
SCAN       = 147
TIME       = 148

inputFrmStart = 1
inputFrmEnd = 2
correctMove = 3
moveDeath = 4
moveFrmStart = 7
moveFrmEnd = 8

curDeathStart = 1
curDeathEnd = 2

segID = 0
iScene = 0

WHITE = 1
RED = 2
BLUE = 3
YELLOW = 4
GREEN = 5
ORANGE = 6	
PINK = 7
PURPLE = 8
LIGHTBLUE = 9
GREY = 10
BLACK = 11
MISC = 12

TOP = 1
BOTTOM = 2
MIDDLE = 3

Level = nil;
Level = {}

TITLE = 1
INTROCLIP = 2
INTROCLIPEND = 3
TOTALSCENES = 4 
MIRROR = 5
DTHMIRROR = 6
LVLREPLAY = 7

LEVELSTARTED = 1
BEATSTATUS = 2
DEATHCOUNT = 3

SCENEID = 1
SCENECOMPLETE = 2

NODEATH = -1
NODEATHSCORE = -2

OUT = 1000

sLCD = ""
iLCDline = 1; iLCDpointer = 1; iLCDx = 0; iLCDwait = 0.250
bShowLCD = true

choice = nil 
optorder = nil
path = nil
path = {}
timed = nil
timed = {}
LvlMap = nil 
LvlMap = {}
PlayOrder = nil 
PlayOrder = {}
LvlOrder= nil
LvlOrder = {}
Tiers = nil 
Tiers = {}
sprite = nil
sprNUM = nil
sprArrow = nil
Death = nil 
Death = {}
Group1 = {}
Group2 = {}
Group3 = {}
Group4 = {}

dip_StartLevel = 1
dip_StartScene = 1

--fontQuality(FONT_QUALITY_BLENDED)

sndright   = soundLoad(MYDIR.."/Sounds/right.wav")
sndwrong   = soundLoad(MYDIR.."/Sounds/wrong.wav")
snddeath   = soundLoad(MYDIR.."/Sounds/death.wav")
sndvictory = soundLoad(MYDIR.."/Sounds/victory.wav")
sndcoin    = soundLoad(MYDIR.."/Sounds/coin.wav")
sndcredit  = soundLoad(MYDIR.."/Sounds/credit.wav")
sndclear   = soundLoad(MYDIR.."/Sounds/clear.wav")
sndroll   = soundLoad(MYDIR.."/Sounds/roll.wav")

