📄 mazemod.bas
字号:
Attribute VB_Name = "MazeMod"
Global D As Integer 'Direction
Global H As Integer ' Height
Global W As Integer 'Width
Global Start ' for the timing
Global TheEnd 'for the timing
Global PauseAd ' For the timing
Global Demo As Boolean ' is the demo going?
Public Const FrmCap = "3D Maze: "
Public Const MH = 20 ' max lenght of maze
Public Const MW = 20 ' max width of maze
'Tells how to read the maze file
Type TheMap
Map(MH) As String * MW
End Type
' the name of files
Global MazeFile As String
Global DemoFile As String
'Tells how to read the options menu
Type SavOp
MFile As String * 13 'maze file name
DFile As String * 13 'demo file name
SSize As Integer ' the picture size
Max As Boolean 'is the form maximized
RndS As Boolean ' random start
End Type
'Sub to color in the maze
Declare Sub FloodFill Lib "GDI32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long)
Function Check(TH, TW)
'this function sees if where the player is tring to move
'is a legal spot
Dim Maze As TheMap
Open App.Path & "\" & MazeFile For Random As #1 Len = Len(Maze)
Get #1, 1, Maze
Close #1
' if the player can't move there exit set check to false
If TH > MH Or TW > MW Or TH <= 0 Or TW <= 0 Then Check = False: Exit Function
Temp = Mid(Maze.Map(TH), TW, 1)
If Temp >= 1 Then Check = True
If Temp = 0 Then Check = False
End Function
Sub Fill(Left, Right, Center, Level)
MazFrm.DrwBrd.FillStyle = 0
f = MazFrm.DrwBrd.ScaleHeight
backup = MazFrm.DrwBrd.FillColor
Rep = 255 / 6
Col = 255
Select Case Level
Case 0
' this Case colors the finish if its in the center
' don't ask me why i put it here, i know its confusing
If Center <> -1 Then
MazFrm.DrwBrd.FillColor = RGB(Rep * Center, Col, Rep * Center)
Else
MazFrm.DrwBrd.FillColor = RGB(Rep * 5.5, Col, Rep * 5.5)
End If
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2, f / 2, 0)
If Left = 2 And Center <> -1 Then
MazFrm.DrwBrd.FillColor = RGB(Rep * Center, Rep * Center, Rep * Center)
If Center = 1 Then
MazFrm.DrwBrd.Line (f - f / 5, f - f / 5)-(f / 5, f / 5), , BF
MazFrm.DrwBrd.Line (f - f / 5, f - f / 5)-(f / 5, f / 5), 0, B
End If
If Center = 2 Then
MazFrm.DrwBrd.Line (f - f / 3, f - f / 3)-(f / 3, f / 3), , BF
MazFrm.DrwBrd.Line (f - f / 3, f - f / 3)-(f / 3, f / 3), 0, B
End If
If Center = 3 Then
MazFrm.DrwBrd.Line (f - f / 2.5, f - f / 2.5)-(f / 2.5, f / 2.5), , BF
MazFrm.DrwBrd.Line (f - f / 2.5, f - f / 2.5)-(f / 2.5, f / 2.5), 0, B
End If
If Center = 4 Then
MazFrm.DrwBrd.Line (f - f / 2.25, f - f / 2.25)-(f / 2.25, f / 2.25), , BF
MazFrm.DrwBrd.Line (f - f / 2.25, f - f / 2.25)-(f / 2.25, f / 2.25), 0, B
End If
If Center = 5 Then
MazFrm.DrwBrd.Line (f - f / 2.12, f - f / 2.12)-(f / 2.12, f / 2.12), , BF
MazFrm.DrwBrd.Line (f - f / 2.12, f - f / 2.12)-(f / 2.12, f / 2.12), 0, B
End If
End If
Case 1 'first spot
MazFrm.DrwBrd.FillColor = RGB(0, Col, 0)
'colors sides
Call FloodFill(MazFrm.DrwBrd.hdc, f - 1, f / 2, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, 0, f / 2, 0)
MazFrm.DrwBrd.FillColor = RGB(255, 0, 0)
'colors top
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2, f / 2 + f / 3, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2, f / 2 - f / 3, 0)
If Right = 1 Then 'colors rights if hallway is there
Call FloodFill(MazFrm.DrwBrd.hdc, f - 1, f - f / 18, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, f - 1, f / 18, 0)
End If
If Left = 1 Then
Call FloodFill(MazFrm.DrwBrd.hdc, 0, f - f / 18, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, 0, f / 18, 0)
End If
If Left = 2 Then 'color if finish is on the left
MazFrm.DrwBrd.FillColor = RGB(OCol, OCol, OCol)
Call FloodFill(MazFrm.DrwBrd.hdc, 0, f / 2, 0)
End If
If Right = 2 Then
MazFrm.DrwBrd.FillColor = RGB(OCol, OCol, OCol)
Call FloodFill(MazFrm.DrwBrd.hdc, f - 1, f / 2, 0)
End If
Case 2
OCol = Rep * 2 ' this changes the color so it looks like it fades down the hall
MazFrm.DrwBrd.FillColor = RGB(OCol, Col, OCol)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2 + f / 4.5, f / 2, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2 - f / 4.5, f / 2, 0)
MazFrm.DrwBrd.FillColor = RGB(Col, OCol, OCol)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2, f / 2 + f / 4.5, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2, f / 2 - f / 4.5, 0)
If Right = 1 Then
Call FloodFill(MazFrm.DrwBrd.hdc, f / 1.3, f / 2 + f / 4.5, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 1.3, f / 2 - f / 4.5, 0)
End If
If Left = 1 Then
Call FloodFill(MazFrm.DrwBrd.hdc, f / 4, f / 2 + f / 4.5, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 4, f / 2 - f / 4.5, 0)
End If
If Left = 2 Then
MazFrm.DrwBrd.FillColor = RGB(OCol, OCol, OCol)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2 - f / 4.5, f / 2, 0)
End If
If Right = 2 Then
MazFrm.DrwBrd.FillColor = RGB(OCol, OCol, OCol)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2 + f / 4.5, f / 2, 0)
End If
Case 3
OCol = Rep * 3
MazFrm.DrwBrd.FillColor = RGB(OCol, Col, OCol)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2 + f / 7.5, f / 2, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2 - f / 7.5, f / 2, 0)
MazFrm.DrwBrd.FillColor = RGB(Col, OCol, OCol)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2, f / 2 + f / 7.5, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2, f / 2 - f / 7.5, 0)
If Right = 1 Then
Call FloodFill(MazFrm.DrwBrd.hdc, f / 1.55, f / 2 + f / 7.5, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 1.55, f / 2 - f / 7.5, 0)
End If
If Left = 1 Then
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2.9, f / 2 + f / 7.5, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2.9, f / 2 - f / 7.5, 0)
End If
If Left = 2 Then
MazFrm.DrwBrd.FillColor = RGB(OCol, OCol, OCol)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2 - f / 7.5, f / 2, 0)
End If
If Right = 2 Then
MazFrm.DrwBrd.FillColor = RGB(OCol, OCol, OCol)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2 + f / 7.5, f / 2, 0)
End If
Case 4
OCol = Rep * 4
MazFrm.DrwBrd.FillColor = RGB(OCol, Col, OCol)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2 + f / 13.5, f / 2, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2 - f / 13.5, f / 2, 0)
MazFrm.DrwBrd.FillColor = RGB(Col, OCol, OCol)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2, f / 2 + f / 13.5, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2, f / 2 - f / 13.5, 0)
If Right = 1 Then
Call FloodFill(MazFrm.DrwBrd.hdc, f / 1.7, f / 2 + f / 13.5, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 1.7, f / 2 - f / 13.5, 0)
End If
If Left = 1 Then
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2.4, f / 2 + f / 13.5, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2.4, f / 2 - f / 13.5, 0)
End If
If Left = 2 Then
MazFrm.DrwBrd.FillColor = RGB(OCol, OCol, OCol)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2 - f / 13.5, f / 2, 0)
End If
If Right = 2 Then
MazFrm.DrwBrd.FillColor = RGB(OCol, OCol, OCol)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2 + f / 13.5, f / 2, 0)
End If
Case 5
OCol = Rep * 5
MazFrm.DrwBrd.FillColor = RGB(OCol, Col, OCol)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2 + f / 19.5, f / 2, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2 - f / 19.5, f / 2, 0)
MazFrm.DrwBrd.FillColor = RGB(Col, OCol, OCol)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2, f / 2 + f / 19.5, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2, f / 2 - f / 19.5, 0)
If Right = 1 Then
Call FloodFill(MazFrm.DrwBrd.hdc, f / 1.83, f / 2.15, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 1.83, f / 1.86, 0)
End If
If Left = 1 Then
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2.22, f / 2.16, 0)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2.22, f / 1.87, 0)
End If
If Left = 2 Then
MazFrm.DrwBrd.FillColor = RGB(OCol, OCol, OCol)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2 - f / 19.5, f / 2, 0)
End If
If Right = 2 Then
MazFrm.DrwBrd.FillColor = RGB(OCol, OCol, OCol)
Call FloodFill(MazFrm.DrwBrd.hdc, f / 2 + f / 19.5, f / 2, 0)
End If
End Select
MazFrm.DrwBrd.FillStyle = 1
MazFrm.DrwBrd.FillColor = backup
End Sub
Sub Finish()
Dim Maze As TheMap
Dim Dat As SavOp
MazFrm.Tim.Visible = False
If Demo = True Then Demo = False: MazFrm.DrwBrd.Cls: Exit Sub
Open App.Path & "\" & MazeFile For Random As #1 Len = Len(Maze)
Get #1, 1, Maze
'gets the password for the level, if there is one
Pass = Mid(Maze.Map(0), 6)
If Mid(Pass, 1, 1) <> "|" Then Pass = Left(Pass, InStr(1, Pass, "|") - 1): Pas = True
TheEnd = Timer
TotalTime = TheEnd - Start
If TotalTime >= 60 Then
M = Int(TotalTime / 60)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -