Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- setRoundTime(999 * 6)--frames
- setLifeMul(1.0)
- setTeam1VS2Life(1.0)
- setTurnsRecoveryRate(1.0 / 300.0)
- setZoom(false)
- setZoomMin(0.25)
- setZoomMax(1.0)
- setZoomSpeed(1.0)
- loadLifebar('data/HyperDBZ_Lifebar/fight.def')
- loadDebugFont('data/HyperDBZ_Lifebar/lifebar_font/NAME2.fnt')
- setDebugScript('script/debug.lua')
- aiLevel = 8
- require('script.randomtest')
- function addWithRefresh(addFn, text)
- local nextRefresh = os.clock() + 0.02
- for i, c
- in ipairs(script.randomtest.strsplit('\n',
- text:gsub('^%s*(.-)%s*$', '%1')))
- do
- addFn(c)
- if os.clock() >= nextRefresh then
- refresh()
- nextRefresh = os.clock() + 0.02
- end
- end
- end
- --shuffle by Uradamus
- --https://gist.github.com/Uradamus/10323382
- function shuffle(tbl)
- size = #tbl
- for i = size, 1, -1 do
- local rand = math.random(size)
- tbl[i], tbl[rand] = tbl[rand], tbl[i]
- end
- return tbl
- end
- orgAddChar = addChar
- orgAddStage = addStage
- function addChar(text)
- addWithRefresh(orgAddChar, text)
- end
- function addStage(text)
- addWithRefresh(orgAddStage, text)
- end
- assert(loadfile('script/select.lua'))()
- math.randomseed(os.time())
- ------------------------------------------------------------
- sysSff = sffNew('script/system.sff')
- sysSnd = sndNew('script/system.snd')
- jgFnt = fontNew('data/HyperDBZ_Lifebar/lifebar_font/NAME2.fnt')
- bgm = 'script/MENU.mp3'
- vs = 'script/VS.mp3'
- playBGM(bgm)
- ------------------------------------------------------------
- function setCommand(c)
- commandAdd(c, 'u', '$U')
- commandAdd(c, 'd', '$D')
- commandAdd(c, 'l', '$B')
- commandAdd(c, 'r', '$F')
- commandAdd(c, 'a', 'a')
- commandAdd(c, 'b', 'b')
- commandAdd(c, 'c', 'c')
- commandAdd(c, 'x', 'x')
- commandAdd(c, 'y', 'y')
- commandAdd(c, 'z', 'z')
- commandAdd(c, 's', 's')
- commandAdd(c, 'holds', '/s')
- commandAdd(c, 'su', '/s, U')
- commandAdd(c, 'sd', '/s, D')
- end
- p1Cmd = commandNew()
- setCommand(p1Cmd)
- p1Cmdd = commandNew()
- setCommand(p1Cmdd)
- p2Cmd = commandNew()
- setCommand(p2Cmd)
- ------------------------------------------------------------
- selectColumns = 3
- selectRows = 4
- setRandomSpr(sysSff, 151, 0, 3.0/selectColumns, 3.0/selectColumns)
- setSelColRow(selectColumns, selectRows)
- setSelCellSize(29*3.0/selectColumns, 29*3.0/selectColumns)
- setSelCellScale(3.0/selectColumns, 3.0/selectColumns)
- function init()
- p1TeamMode = 0
- p1NumTurns = 2
- p1SelOffset = 0
- p1SelX = 0
- p1SelY = 0
- p1Portrait = nil
- p2TeamMode = 0
- p2NumTurns = 2
- p2SelOffset = 0
- p2SelX = 0
- p2SelY = 0
- p2Portrait = nil
- stageNo = 0
- setStage(0)
- end
- init()
- function noTask()
- end
- function animPosDraw(a, x, y)
- animSetPos(a, x, y)
- animDraw(a)
- end
- function textImgPosDraw(ti, x, y)
- textImgSetPos(ti, x, y)
- textImgDraw(ti)
- end
- function createTextImg(font, bank, aline, text, x, y)
- local ti = textImgNew()
- textImgSetFont(ti, font)
- textImgSetBank(ti, bank)
- textImgSetAlign(ti, aline)
- textImgSetText(ti, text)
- textImgSetPos(ti, x, y)
- return ti
- end
- function btnPalNo(cmd)
- local s = 0
- if commandGetState(cmd, 'holds') then s = 6 end
- if commandGetState(cmd, 'a') then return 1 + s end
- if commandGetState(cmd, 'b') then return 2 + s end
- if commandGetState(cmd, 'c') then return 3 + s end
- if commandGetState(cmd, 'x') then return 4 + s end
- if commandGetState(cmd, 'y') then return 5 + s end
- if commandGetState(cmd, 'z') then return 6 + s end
- return 0
- end
- ------------------------------------------------------------
- p1SelTmTxt = createTextImg(jgFnt, 0, 1, 'Player 1', 20, 30)
- p1SingleTxt = createTextImg(jgFnt, 0, 1, 'Single', 20, 50)
- p1SimulTxt = createTextImg(jgFnt, 0, 1, 'Simul', 20, 65)
- p1TurnsTxt = createTextImg(jgFnt, 0, 1, 'Turns', 20, 80)
- textImgSetScale(p1SelTmTxt, 0.7, 0.5)
- textImgSetScale(p1SingleTxt, 0.5, 0.5)
- textImgSetScale(p1SimulTxt, 0.5, 0.5)
- textImgSetScale(p1TurnsTxt, 0.5, 0.5)
- p1TmCursor = animNew(sysSff, [[
- 180,0, 0,0, -1
- ]])
- p1TmIcon = animNew(sysSff, [[
- 181,0, 0,0, -1
- ]])
- function p1TmSub()
- if commandGetState(p1Cmd, 'u') then
- sndPlay(sysSnd, 100, 0)
- p1TeamMode = p1TeamMode - 1
- if p1TeamMode < 0 then p1TeamMode = 2 end
- elseif commandGetState(p1Cmd, 'd') then
- sndPlay(sysSnd, 100, 0)
- p1TeamMode = p1TeamMode + 1
- if p1TeamMode > 2 then p1TeamMode = 0 end
- elseif p1TeamMode == 2 then
- if commandGetState(p1Cmd, 'l') then
- sndPlay(sysSnd, 100, 0)
- p1NumTurns = p1NumTurns - 1
- if p1NumTurns < 1 then p1NumTurns = 1 end
- elseif commandGetState(p1Cmd, 'r') then
- sndPlay(sysSnd, 100, 0)
- p1NumTurns = p1NumTurns + 1
- if p1NumTurns > 4 then p1NumTurns = 4 end
- end
- end
- textImgDraw(p1SelTmTxt)
- textImgDraw(p1SingleTxt)
- textImgDraw(p1SimulTxt)
- textImgDraw(p1TurnsTxt)
- animUpdate(p1TmIcon)
- animPosDraw(p1TmIcon, 80, 66)
- animPosDraw(p1TmIcon, 86, 66)
- for i = 1, p1NumTurns do
- animPosDraw(p1TmIcon, 74 + i*6, 81)
- end
- animUpdate(p1TmCursor)
- animPosDraw(p1TmCursor, 10, 47 + p1TeamMode*15)
- if btnPalNo(p1Cmd) > 0 then
- sndPlay(sysSnd, 100, 1)
- setTeamMode(1, p1TeamMode, p1NumTurns)
- p1Selected = {}
- p1SelEnd = false
- p1Task = p1SelSub
- end
- end
- ------------------------------------------------------------
- p2SelTmTxt = createTextImg(jgFnt, 0, -1, 'Player 2', 300, 30)
- p2SingleTxt = createTextImg(jgFnt, 0, -1, 'Single', 300, 50)
- p2SimulTxt = createTextImg(jgFnt, 0, -1, 'Simul', 300, 65)
- p2TurnsTxt = createTextImg(jgFnt, 0, -1, 'Turns', 300, 80)
- textImgSetScale(p2SelTmTxt, 0.7, 0.5)
- textImgSetScale(p2SingleTxt, 0.5, 0.5)
- textImgSetScale(p2SimulTxt, 0.5, 0.5)
- textImgSetScale(p2TurnsTxt, 0.5, 0.5)
- p2TmCursor = animNew(sysSff, [[
- 190,0, 0,0, -1
- ]])
- p2TmIcon = animNew(sysSff, [[
- 191,0, 0,0, -1
- ]])
- function p2TmSub()
- if commandGetState(p2Cmd, 'u') then
- sndPlay(sysSnd, 100, 0)
- p2TeamMode = p2TeamMode - 1
- if p2TeamMode < 0 then p2TeamMode = 2 end
- elseif commandGetState(p2Cmd, 'd') then
- sndPlay(sysSnd, 100, 0)
- p2TeamMode = p2TeamMode + 1
- if p2TeamMode > 2 then p2TeamMode = 0 end
- elseif p2TeamMode == 2 then
- if commandGetState(p2Cmd, 'r') then
- sndPlay(sysSnd, 100, 0)
- p2NumTurns = p2NumTurns - 1
- if p2NumTurns < 1 then p2NumTurns = 1 end
- elseif commandGetState(p2Cmd, 'l') then
- sndPlay(sysSnd, 100, 0)
- p2NumTurns = p2NumTurns + 1
- if p2NumTurns > 4 then p2NumTurns = 4 end
- end
- end
- textImgDraw(p2SelTmTxt)
- textImgDraw(p2SingleTxt)
- textImgDraw(p2SimulTxt)
- textImgDraw(p2TurnsTxt)
- animUpdate(p2TmIcon)
- animPosDraw(p2TmIcon, 240, 66)
- animPosDraw(p2TmIcon, 234, 66)
- for i = 1, p2NumTurns do
- animPosDraw(p2TmIcon, 246 - i*6, 81)
- end
- animUpdate(p2TmCursor)
- animPosDraw(p2TmCursor, 310, 47 + p2TeamMode*15)
- if btnPalNo(p2Cmd) > 0 then
- sndPlay(sysSnd, 100, 1)
- setTeamMode(2, p2TeamMode, p2NumTurns)
- p2Selected = {}
- p2SelEnd = false
- p2Task = p2SelSub
- end
- end
- ------------------------------------------------------------
- p1Cursor = animNew(sysSff, [[
- 160,0, 0,0, -1
- ]])
- animSetScale(p1Cursor, 3.0/selectColumns, 3.0/selectColumns)
- p1NameTxt = createTextImg(jgFnt, 0, 1, '', 0, 0)
- textImgSetScale(p1NameTxt, 0.5, 0.5)
- function p1DrawSelectName()
- local y = 162
- for i = 1, #p1Selected do
- textImgSetText(p1NameTxt, getCharName(p1Selected[i]))
- textImgPosDraw(p1NameTxt, 10, y)
- y = y + 7
- end
- return y
- end
- function p1SelSub()
- local n = p1SelOffset + p1SelX + selectColumns*p1SelY
- p1Portrait = n
- local y = p1DrawSelectName()
- if not p1SelEnd then
- if commandGetState(p1Cmd, 'su') then
- sndPlay(sysSnd, 100, 0)
- p1SelY = p1SelY - 20
- elseif commandGetState(p1Cmd, 'sd') then
- sndPlay(sysSnd, 100, 0)
- p1SelY = p1SelY + 20
- elseif commandGetState(p1Cmd, 'u') then
- sndPlay(sysSnd, 100, 0)
- p1SelY = p1SelY - 1
- elseif commandGetState(p1Cmd, 'd') then
- sndPlay(sysSnd, 100, 0)
- p1SelY = p1SelY + 1
- elseif commandGetState(p1Cmd, 'l') then
- sndPlay(sysSnd, 100, 0)
- p1SelX = p1SelX - 1
- elseif commandGetState(p1Cmd, 'r') then
- sndPlay(sysSnd, 100, 0)
- p1SelX = p1SelX + 1
- end
- if p1SelY < 0 then
- p1SelY = 0
- elseif p1SelY >= selectRows then
- p1SelOffset = p1SelOffset + selectColumns*(p1SelY - (selectRows - 4))
- p1SelY = selectRows - 1
- end
- if p1SelX < 0 then
- p1SelX = selectColumns - 1
- elseif p1SelX >= selectColumns then
- p1SelX = 0
- end
- animUpdate(p1Cursor)
- animPosDraw(
- p1Cursor, 118 + 29*p1SelX*3.0/selectColumns,
- 107 + 29*p1SelY*3.0/selectColumns)
- textImgSetText(p1NameTxt, getCharName(n))
- textImgPosDraw(p1NameTxt, 10, y)
- p1SelectedPal = btnPalNo(p1Cmd)
- local selval = selectChar(1, n, p1SelectedPal)
- if selval > 0 then
- sndPlay(sysSnd, 100, 1)
- p1Selected[#p1Selected+1] = n
- end
- if selval == 2 then
- p1SelEnd = true
- if p2In == 1 then
- p2Task = p2TmSub
- commandBufReset(p2Cmd, p2In)
- end
- end
- end
- end
- ------------------------------------------------------------
- p2Cursor = animNew(sysSff, [[
- 170,0, 0,0, -1
- ]])
- animSetScale(p2Cursor, 3.0/selectColumns, 3.0/selectColumns)
- p2NameTxt = createTextImg(jgFnt, 0, -1, '', 0, 0)
- textImgSetScale(p2NameTxt, 0.5, 0.5)
- function p2DrawSelectName()
- local y = 162
- for i = 1, #p2Selected do
- textImgSetText(p2NameTxt, getCharName(p2Selected[i]))
- textImgPosDraw(p2NameTxt, 310, y)
- y = y + 7
- end
- return y
- end
- function p2SelSub()
- local n = p2SelOffset + p2SelX + selectColumns*p2SelY
- p2Portrait = n
- local y = p2DrawSelectName()
- if not p2SelEnd then
- if commandGetState(p2Cmd, 'su') then
- sndPlay(sysSnd, 100, 0)
- p2SelY = p2SelY - 20
- elseif commandGetState(p2Cmd, 'sd') then
- sndPlay(sysSnd, 100, 0)
- p2SelY = p2SelY + 20
- elseif commandGetState(p2Cmd, 'u') then
- sndPlay(sysSnd, 100, 0)
- p2SelY = p2SelY - 1
- elseif commandGetState(p2Cmd, 'd') then
- sndPlay(sysSnd, 100, 0)
- p2SelY = p2SelY + 1
- elseif commandGetState(p2Cmd, 'l') then
- sndPlay(sysSnd, 100, 0)
- p2SelX = p2SelX - 1
- elseif commandGetState(p2Cmd, 'r') then
- sndPlay(sysSnd, 100, 0)
- p2SelX = p2SelX + 1
- end
- if p2SelY < 0 then
- p2SelY = 0
- elseif p2SelY >= selectRows then
- p2SelOffset = p2SelOffset + selectColumns*(p2SelY - (selectRows - 4))
- p2SelY = selectRows - 1
- end
- if p2SelX < 0 then
- p2SelX = selectColumns - 1
- elseif p2SelX >= selectColumns then
- p2SelX = 0
- end
- animUpdate(p2Cursor)
- animPosDraw(
- p2Cursor, 118 + 29*p2SelX*3.0/selectColumns,
- 107 + 29*p2SelY*3.0/selectColumns)
- textImgSetText(p2NameTxt, getCharName(n))
- textImgPosDraw(p2NameTxt, 310, y)
- local selval = selectChar(2, n, btnPalNo(p2Cmd))
- if selval > 0 then
- sndPlay(sysSnd, 100, 1)
- p2Selected[#p2Selected+1] = n
- end
- if selval == 2 then
- p2SelEnd = true
- if p1In == 2 then
- p1Task = p1TmSub
- commandBufReset(p1Cmd, p1In)
- end
- end
- end
- end
- ------------------------------------------------------------
- selStageTxt = createTextImg(jgFnt, 0, 0, '', 160, 237)
- textImgSetScale(selStageTxt, 0.5, 0.5)
- function selStageSub()
- if commandGetState(p1Cmd, 'l') then
- sndPlay(sysSnd, 100, 0)
- stageNo = setStage(stageNo - 1)
- elseif commandGetState(p1Cmd, 'r') then
- sndPlay(sysSnd, 100, 0)
- stageNo = setStage(stageNo + 1)
- elseif commandGetState(p1Cmd, 'u') then
- sndPlay(sysSnd, 100, 0)
- stageNo = setStage(stageNo - 10)
- elseif commandGetState(p1Cmd, 'd') then
- sndPlay(sysSnd, 100, 0)
- stageNo = setStage(stageNo + 10)
- end
- textImgSetText(
- selStageTxt, 'Stage ' .. stageNo .. ': ' .. getStageName(stageNo))
- textImgDraw(selStageTxt)
- if btnPalNo(p1Cmd) > 0 then
- selectStage(stageNo)
- selMode = false
- end
- end
- ------------------------------------------------------------
- ------------------------------------------------------------
- arcadeModeTxt = createTextImg(jgFnt, 0, 1, 'Arcade Battle', 40, 140)
- p1VsComTxt = createTextImg(jgFnt, 0, 1, 'Free Battle', 40, 160)
- p1VsP2 = createTextImg(jgFnt, 0, 1, 'Vs. Battle', 40, 180)
- watchMode = createTextImg(jgFnt, 0, 1, 'Watch Battle', 40, 200)
- netplay = createTextImg(jgFnt, 0, 1, 'Network Battle', 180, 140)
- portChange = createTextImg(jgFnt, 0, 1, '', 180, 160)
- replay = createTextImg(jgFnt, 0, 1, 'Replay Channel', 180, 180)
- optionTxt = createTextImg(jgFnt, 0, 1, 'Options', 180, 200)
- textImgSetScale(arcadeModeTxt, 0.5, 0.5)
- textImgSetScale(p1VsComTxt, 0.5, 0.5)
- textImgSetScale(p1VsP2, 0.5, 0.5)
- textImgSetScale(watchMode, 0.5, 0.5)
- textImgSetScale(netplay, 0.5, 0.5)
- textImgSetScale(portChange, 0.5, 0.5)
- textImgSetScale(replay, 0.5, 0.5)
- textImgSetScale(optionTxt, 0.5, 0.5)
- connecting = createTextImg(jgFnt, 0, 1, '', 10, 140)
- loading = createTextImg(jgFnt, 0, 1, 'Loading...', 100, 210)
- inputdia = inputDialogNew()
- function cmddInput()
- commandInput(p1Cmdd, p1In)
- commandInput(p2Cmdd, p2In)
- end
- function cmdInput()
- commandInput(p1Cmd, p1In)
- commandInput(p2Cmd, p2In)
- end
- function versusScreen()
- for i = 1, 300 do
- animDraw(SelBG)
- animDraw(Sky1)
- animDraw(Sky2)
- animDraw(Sky3)
- animDraw(Lightning)
- animDraw(Lightning2)
- animDraw(Rocks)
- animDraw(VS)
- animUpdate(VS)
- local k = 0
- for j = 1, #p1Selected do
- local scl = 10000.0 / (10000.0 - k*i)
- local tmp = i*k / 20
- drawPortrait(p1Selected[j], 18 - tmp, 0 + tmp/3, scl, scl)
- k = k + 48
- end
- k = 0
- for j = 1, #p2Selected do
- local scl = 10000.0 / (10000.0 - k*i)
- local tmp = i*k / 20
- drawPortrait(p2Selected[j], 302 + tmp, 0 + tmp/3, -scl, scl)
- k = k + 48
- end
- p1DrawSelectName()
- p2DrawSelectName()
- textImgDraw(loading)
- refresh()
- end
- end
- function selectScreen()
- while true do
- p1Selected = {}
- p1SelEnd = false
- p1Portrait = nil
- p2Selected = {}
- p2SelEnd = false
- p2Portrait = nil
- p1Task = p1TmSub
- p2Task = noTask
- if gameMode > 1 and gameMode ~= 3 then
- p2Task = p2TmSub
- end
- refresh()
- commandBufReset(p1Cmd, p1In)
- commandBufReset(p1Cmdd, p1In)
- commandBufReset(p2Cmd, p2In)
- selMode = true
- selectStart()
- ------------------------------------------------------------
- --Main loop
- ------------------------------------------------------------
- while selMode do
- if esc() then return end
- bgSub()
- if p1Portrait then drawPortrait(p1Portrait, 18, 0, 1, 1) end
- if p2Portrait then drawPortrait(p2Portrait, 302, 0, -1, 1) end
- animDraw(Rocks)
- animDraw(BOX)
- drawFace(118, 107, p1SelOffset)
- drawFace(999, 999, p2SelOffset)
- if p1SelEnd and p2SelEnd then selStageSub() end
- p2Task()
- p1Task()
- cmdInput()
- refresh()
- end
- versusScreen()
- local winner = game()
- bgm = 'script/SELECT.mp3'
- playBGM(bgm)
- end
- end
- function congratulationScreen()
- local congratulationsTxt = createTextImg(jgFnt, 0, 0, 'Congratulations!', 160, 100)
- for i = 1, 400 do
- textImgDraw(congratulationsTxt)
- refresh()
- end
- end
- function gameOverScreen()
- local gameOverTxt = createTextImg(jgFnt, 0, 0, 'Game Over', 160, 100)
- for i = 1, 400 do
- textImgDraw(gameOverTxt)
- refresh()
- end
- end
- function continueScreen()
- local continueTxt = createTextImg(jgFnt, 0, 0, 'Continue?', 160, 100)
- local yesTxt = createTextImg(jgFnt, 0, 1, 'Yes', 60, 135)
- local noTxt = createTextImg(jgFnt, 0, 1, 'No', 215, 135)
- local cursor = animNew(sysSff, [[
- 180,0, 0,0, -1
- ]])
- animSetScale(cursor, 2, 2)
- local selectedOpt = true
- while true do
- if esc() then
- return false
- end
- textImgDraw(continueTxt)
- textImgDraw(yesTxt)
- textImgDraw(noTxt)
- if commandGetState(p1Cmd, 'l') then
- selectedOpt = true
- elseif commandGetState(p1Cmd, 'r') then
- selectedOpt = false
- end
- local cursorPosX = 0
- if selectedOpt then
- cursorPosX = 55
- else
- cursorPosX = 210
- end
- animUpdate(cursor)
- animPosDraw(cursor, cursorPosX, 135)
- if btnPalNo(p1Cmd) > 0 then
- return selectedOpt
- end
- cmdInput()
- refresh()
- end
- end
- function selectArcadeOpponent()
- local opponent = opponentsIndex[1]
- selectChar(2, opponent, 4)
- p2Selected[1] = opponent
- selectStage(1)
- end
- function selectScreenArcade()
- opponentsIndex = {
- 1, -- satan
- 3, -- goku
- 4, -- gohan
- 5, -- vegeta
- 6, -- goku ssj
- 7, -- frieza
- 8, -- vegeta ssj or whatever
- 10 -- babidi
- }
- opponentsIndex = shuffle(opponentsIndex)
- p1Selected = {}
- p1SelEnd = false
- p1Portrait = nil
- while #opponentsIndex > 0 do
- bgm = 'script/SELECT.mp3'
- playBGM(bgm)
- p2Selected = {}
- p2SelEnd = false
- p2Portrait = nil
- setTeamMode(1, 0, 1)
- setTeamMode(2, 0, 1)
- p1Task = p1SelSub
- p2Task = noTask
- refresh()
- commandBufReset(p1Cmd, p1In)
- commandBufReset(p1Cmdd, p1In)
- commandBufReset(p2Cmd, p2In)
- selMode = true
- selectStart()
- ------------------------------------------------------------
- --Main loop
- ------------------------------------------------------------
- if p1SelEnd then
- selectChar(1, p1Selected[1], p1SelectedPal)
- end
- while not p1SelEnd do
- if esc() then return end
- bgSub()
- if p1Portrait then drawPortrait(p1Portrait, 18, 0, 1, 1) end
- animDraw(Rocks)
- animDraw(BOX)
- drawFace(118, 107, p1SelOffset)
- p1Task()
- cmdInput()
- refresh()
- end
- selectArcadeOpponent()
- versusScreen()
- local winner = game()
- if winner == 1 then
- table.remove(opponentsIndex,1)
- elseif winner == 2 then
- local continue = continueScreen()
- if continue then
- p1Selected = {}
- p1SelEnd = false
- p1Portrait = nil
- else
- gameOverScreen()
- return
- end
- elseif winner == -1 then
- return
- end
- end
- congratulationScreen()
- return
- end
- function drawMainMenuBg()
- animAddPos(Sky1, .125, 0)
- animUpdate(Sky1)
- animDraw(Sky1)
- animAddPos(Sky2, .25, 0)
- animUpdate(Sky2)
- animDraw(Sky2)
- animAddPos(Sky3, .375, 0)
- animUpdate(Sky3)
- animDraw(Sky3)
- animAddPos(Mount, 0, 0)
- animUpdate(Mount)
- animDraw(Mount)
- animAddPos(Grass, 0, 0)
- animUpdate(Grass)
- animDraw(Grass)
- animAddPos(Home, 0, 0)
- animUpdate(Home)
- animDraw(Home)
- end
- function drawMainMenu()
- drawMainMenuBg()
- textImgDraw(arcadeModeTxt)
- textImgDraw(p1VsComTxt)
- textImgDraw(p1VsP2)
- textImgDraw(watchMode)
- textImgDraw(netplay)
- textImgDraw(portChange)
- textImgDraw(replay)
- textImgDraw(optionTxt)
- animAddPos(Logo, 0, 0)
- animUpdate(Logo)
- animDraw(Logo)
- animUpdate(p1TmCursor)
- if gameMode <= 3 then
- animPosDraw(p1TmCursor, 37, 140 + (gameMode*20) )
- else
- animPosDraw(p1TmCursor, 177, 140 + ((gameMode-4)*20) )
- end
- end
- function modeArcade()
- setCom(1, 0)
- p2In = 0
- selectScreenArcade()
- end
- function modeCpuBattle()
- bgm = 'script/SELECT.mp3'
- playBGM(bgm)
- selectScreen()
- end
- function modeFreeBattle()
- setCom(1, 0)
- bgm = 'script/SELECT.mp3'
- playBGM(bgm)
- selectScreen()
- end
- function modeVersus()
- p2In = 2
- setCom(1, 0)
- setCom(2, 0)
- bgm = 'script/SELECT.mp3'
- playBGM(bgm)
- selectScreen()
- end
- function modeOnline()
- p2In = 2
- setCom(1, 0)
- setCom(2, 0)
- inputDialogPopup(inputdia, 'Input Server')
- while not inputDialogIsDone(inputdia) do
- refresh()
- end
- textImgSetText(
- connecting,
- 'Searching...' .. inputDialogGetStr(inputdia)
- .. ' ' .. getListenPort())
- bgm = 'script/NET.mp3'
- playBGM(bgm)
- enterNetPlay(inputDialogGetStr(inputdia))
- while not connected() do
- if esc() then
- return
- end
- animAddPos(Sky1, .125, 0)
- animUpdate(Sky1)
- animDraw(Sky1)
- animAddPos(Sky2, .25, 0)
- animUpdate(Sky2)
- animDraw(Sky2)
- animAddPos(Sky3, .375, 0)
- animUpdate(Sky3)
- animDraw(Sky3)
- animAddPos(DRAGON, 0, 0)
- animUpdate(DRAGON)
- animDraw(DRAGON)
- textImgDraw(connecting)
- refresh()
- end
- init()
- synchronize()
- math.randomseed(sszRandom())
- selectScreen()
- end
- function modeChangePort()
- inputDialogPopup(inputdia, 'Input Port')
- while not inputDialogIsDone(inputdia) do
- refresh()
- end
- setListenPort(inputDialogGetStr(inputdia))
- end
- function modeReplay()
- p2In = 2
- setCom(1, 0)
- setCom(2, 0)
- bgm = 'script/SELECT.mp3'
- playBGM(bgm)
- enterReplay('replay/netplay.replay')
- init()
- synchronize()
- math.randomseed(sszRandom())
- end
- function modeOption()
- while true do
- if esc() then
- return
- end
- drawMainMenuBg()
- local optionTitleTxt = createTextImg(jgFnt, 0, 1, 'Options', 130, 20)
- local difficultyTxt = createTextImg(jgFnt, 0, 1, 'Difficulty ', 60, 45)
- textImgSetText(difficultyTxt, "Difficulty " .. aiLevel)
- textImgSetScale(optionTitleTxt, 0.5, 0.5)
- textImgSetScale(difficultyTxt, 0.5, 0.5)
- textImgDraw(optionTitleTxt)
- textImgDraw(difficultyTxt)
- animPosDraw(p1TmCursor, 57, 45)
- if commandGetState(p1Cmd, 'l') and aiLevel > 1 then
- aiLevel = aiLevel - 1
- elseif commandGetState(p1Cmd, 'r') and aiLevel < 8 then
- aiLevel = aiLevel + 1
- end
- cmdInput()
- refresh()
- end
- end
- function changeMode()
- if commandGetState(p1Cmd, 'u') then
- sndPlay(sysSnd, 100, 0)
- gameMode = gameMode - 1
- if gameMode < 0 then
- gameMode = 3
- elseif gameMode == 3 then
- gameMode = 7
- end
- elseif commandGetState(p1Cmd, 'd') then
- sndPlay(sysSnd, 100, 0)
- gameMode = gameMode + 1
- if gameMode == 4 then
- gameMode = 0
- elseif gameMode == 8 then
- gameMode = 4
- end
- elseif commandGetState(p1Cmd, 'l') then
- sndPlay(sysSnd, 100, 0)
- gameMode = gameMode - 4
- if gameMode < 0 then
- gameMode = gameMode + 8
- end
- elseif commandGetState(p1Cmd, 'r') then
- sndPlay(sysSnd, 100, 0)
- gameMode = gameMode + 4
- if gameMode > 7 then
- gameMode = gameMode - 8
- end
- end
- if gameMode < 0 then
- gameMode = 5
- elseif gameMode > 7 then
- gameMode = 0
- end
- end
- function modeSel()
- while true do
- exitNetPlay()
- exitReplay()
- gameMode = 0
- p1In = 1
- p2In = 1
- for i = 1, 8 do
- setCom(i, aiLevel)
- end
- setAutoLevel(false)
- setMatchNo(1)
- setHomeTeam(1)
- resetRemapInput()
- textImgSetText(portChange, 'Port Change(' .. getListenPort() .. ')')
- if bgm ~= 'script/MENU.mp3' then
- bgm = 'script/MENU.mp3'
- playBGM(bgm)
- end
- refresh()
- commandBufReset(p1Cmd, 1)
- commandBufReset(p1Cmdd, 1)
- while btnPalNo(p1Cmd) <= 0 do
- changeMode()
- drawMainMenu()
- cmdInput()
- refresh()
- end
- sndPlay(sysSnd, 100, 1)
- cancel = false
- if gameMode == 0 then
- modeArcade()
- elseif gameMode == 1 then
- modeFreeBattle()
- elseif gameMode == 2 then
- modeVersus()
- elseif gameMode == 3 then
- modeCpuBattle()
- elseif gameMode == 4 then
- modeOnline()
- elseif gameMode == 5 then
- modeChangePort()
- elseif gameMode == 6 then
- modeReplay()
- elseif gameMode == 7 then
- modeOption()
- end
- end
- end
- modeSel()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement