home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 4: Demo 1
/
almathera_demo1.bin
/
amos
/
cityeditor.amos
/
cityeditor.amosSourceCode
< prev
next >
Wrap
AMOS Source Code
|
1995-03-16
|
6KB
|
250 lines
'MAPREAD["map.1"]
Def Scroll 1,0,0 To 320,256,-16,0
Def Scroll 2,0,0 To 320,256,0,16
Def Scroll 3,0,0 To 320,256,16,0
Def Scroll 4,0,0 To 320,256,0,-16
' Open first screen for original picture
'
Screen Open 1,320,256,16,Lowres
Flash Off
Curs Off
'
If Length(6)=0
Load Iff "city.iff",1
If Length(2)=0
Gosub _READICONS
End If
Spack 1 To 6
Else
If Length(2)=0
Gosub _READICONS
End If
Get Icon Palette
Make Icon Mask
Unpack 6
End If
If Length(5)=0
Reserve As Data 5,32768
F$=Fsel$("*.Abk","","Please select a map file to load")
If F$=""
For N=0 To 32767 Step 2
Doke Start(5)+N,109+Rnd(1)*15+Rnd(2)
Next
End If
End If
Double Buffer
Bob Update Off
'
' Create screen for drawing on
'
Screen Open 2,320,256,16,Lowres
Flash Off
Curs Off
Get Icon Palette
Cls 0
Proc DISPLAY[0,19,0,15]
Autoback 0
'
Screen To Front 2
'
XX=0 : YY=0
INUM=44 : Rem water
Limit Mouse
Do
Repeat
M=Mouse Key
K$=Inkey$
Until M<>0 or(K$<>"")
If K$<>""
If K$="f"
Locate 10,10
Print Border$("Please wait",1)
For N=0 To 32767 Step 2
Doke Start(5)+N,109+Rnd(1)*15+Rnd(2)
Next
Proc DISPLAY[0,19,0,15]
End If
A=Asc(K$)
DX=(A=29 and XX>0)-(A=28 and XX<108)
DY=(A=30 and YY>0)-(A=31 and YY<108)
SCROL=-(DX=1)-2*(DY=-1)-3*(DX=-1)-4*(DY=1)
XX=XX+DX : YY=YY+DY
Locate 10,10
If SCROL
Scroll SCROL
Proc DISPLAY[-19*(SCROL=1),-19*(SCROL<>3),-15*(SCROL=4),-15*(SCROL<>2)]
End If
Else
X=X Screen(X Mouse)/16
Y=Y Screen(Y Mouse)/16
Locate 2,2
If M>=2
' display screen 1
SCR=1
Screen To Front 1
Else
If SCR=2
' draw icon, update data area
Doke Start(5)+(X+XX)*2+(Y+YY)*256,INUM
Paste Icon X*16,Y*16,INUM
Else
' choose icon, change inum, revert to screen 2
While Mouse Key
Wend
INUM=X*15+Y+1
Screen To Front 2
SCR=2
End If
End If
End If
Screen Swap
Loop
'
'
Procedure DISPLAY[X1,X2,Y1,Y2]
Shared XX,YY
Screen 2
For I=X1 To X2
For J=Y1 To Y2
S=Deek(Start(5)+(I+XX)*2+(J+YY)*256)
If S
Paste Icon I*16,J*16,S
Else
Ink 0
Bar I*16,J*16 To I*16+15,J*16+15
End If
Next
Next
End Proc
'
_READICONS:
For J=0 To 14
For I=0 To 19
Get Icon 1,I*15+J+1,I*16,J*16 To I*16+16,J*16+16
Next
Next
Return
'
Procedure MAPREAD[M$]
Load Iff M$,5
For I=0 To 127
For J=0 To 127
On Point(I,J) Goto TILE,GROUND,GRASS,WATER,DAMTILE,DARKWALL
If Point(I+1,J)=0
If Point(I,J+1)=0
P=157
Else
P=156
End If
Else
If Point(I,J+1)=0
P=142
Else
P=141
End If
End If
Goto SKIP
TILE:
If Point(I,J+1)=0 or Point(I,J+1)=6
If Point(I-1,J+1)=0 or Point(I-1,J+1)=6
If Point(I-1,J)=0 or Point(I-1,J)=6
P=9
Else
P=22
End If
Else
P=8
End If
Else
If Point(I-1,J+1)=0 or Point(I-1,J+1)=6
If Point(I-1,J)=0 or Point(I-1,J)=6
P=7
Else
P=23
End If
Else
If Point(I-1,J)=0 or Point(I-1,J)=6
P=24
Else
P=245
End If
End If
End If
Goto SKIP
GROUND:
If Point(I,J+1)=0 or Point(I,J+1)=6
If Point(I-1,J+1)=0 or Point(I-1,J+1)=6
If Point(I-1,J)=0 or Point(I-1,J)=6
P=6
Else
P=19
End If
Else
P=5
End If
Else
If Point(I-1,J+1)=0 or Point(I-1,J+1)=6
If Point(I-1,J)=0 or Point(I-1,J)=6
P=4
Else
P=20
End If
Else
If Point(I-1,J)=0 or Point(I-1,J)=6
P=21
Else
P=39+15*Rnd(2)
End If
End If
End If
Goto SKIP
GRASS:
If Point(I,J+1)=0 or Point(I,J+1)=6
If Point(I-1,J+1)=0 or Point(I-1,J+1)=6
P=16
Else
P=2
End If
Else
If Point(I-1,J+1)=0 or Point(I-1,J+1)=6
If Point(I-1,J)=0 or Point(I-1,J)=6
P=1
Else
P=17
End If
Else
If Point(I-1,J)=0 or Point(I-1,J)=6
P=18
Else
P=109+Rnd(2)+Rnd(1)*15
End If
End If
End If
Goto SKIP
WATER:
P=79+Rnd(1)+Rnd(1)*15
Goto SKIP
DAMTILE:
P=236
Goto SKIP
DARKWALL:
If Point(I+1,J)=6
If Point(I,J+1)=6
P=155
Else
P=154
End If
Else
If Point(I,J+1)=6
P=140
Else
P=139
End If
End If
SKIP:
Doke Start(5)+I*2+J*256,P
Next
Next
Screen Close 5
End Proc
'