home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
sourcecode
/
utilities
/
grabiff.amos
/
grabiff.amosSourceCode
< prev
next >
Wrap
AMOS Source Code
|
1992-05-23
|
8KB
|
283 lines
'
' Filename: GrabIFF.AMOS
'
' Date: 23/05/92 Version: 1.1
'
' By: Tony Swanwick
'
'***************************************************************************
'
' This program is AMOS Public Domain.
'
'***************************************************************************
'
Set Buffer 10
Dim V(5)
Global A$,SX,SY,XOFF,YOFF,PY,TX,TY,VP,FF,T$,D$,FILE$,BLANK$
Global PADSCRN,OLDSCRN,NEWSCRN,BACKSCRN,SCRNBANK,V(),WM,HM,NC
Goto L_COLD_START
'
L_LOOP:
P_SCREEN_XY
If Mouse Key=0 Then Goto L_LOOP
'
If SX>14 and SY>7 and SX<70 and SY<33 Then Goto L_EXIT
If SX>14 and SY>37 and SX<70 and SY<61 Then Goto L_CLEAR
If SX>436 and SY>6 and SX<524 and SY<17 Then P_LOAD_FILE
'
If FF=0 Then Goto L_LOOP
'
' Only do these if file loaded.
'
If SX>92 and SY>45 and SX<411 and SY<53 Then P_CHANGE_VP
If SX>434 and SY>36 and SX<592 and SY<62 Then P_CHANGE_VALUE
If SX>534 and SY>21 and SX<614 and SY<32 Then P_FLASH
If SX>436 and SY>21 and SX<524 and SY<32 Then P_SAVE_FILE
If SX>534 and SY>6 and SX<614 and SY<17 Then P_SHOW_OLD
If SX>0 Then P_MOVE_PAD
Goto L_LOOP
'
'
' ***** Procedures *****
'
Procedure P_CENTRE_TEXT
Screen PADSCRN : Ink 1,0
If Len(T$)>32 Then T$=Left$(T$,32)
X=252+XOFF-((10*Len(T$))/2) : Y=YOFF+16+9*TY
Text X,Y,T$
End Proc
Procedure P_CHANGE_VALUE
S=1 : Y=42 : If SY>49 Then S=-1 : Y=56
V=1 : X=443 : If SX>487 Then V=10 : X=498
If SX>541 Then V=100 : X=553
Ink 2 : Paint XOFF+X,YOFF+Y,1
A=V(VP)+(V*S) : If A<0 Then A=0
If(VP=0 or VP=2) and A>WM Then A=WM
If(VP=1 or VP=3) and A>HM Then A=HM
V(VP)=A
If V(0)<16 Then V(0)=16
If V(1)<8 Then V(1)=8
P_COPY_OLD_NEW
P_STATUS
SX=0 : Ink 7 : Paint XOFF+X,YOFF+Y,1
End Proc
Procedure P_CHANGE_VP
VP=(SX-93)/80 : P_STATUS
P_MOUSE_UP
SX=0
End Proc
Procedure P_CLEAR_DISPLAY
Screen PADSCRN
Cls 0,XOFF+85,YOFF+10 To XOFF+419,YOFF+59
End Proc
Procedure P_COPY_OLD_NEW
X1=V(2) : Y1=V(3) : X2=V(4) : Y2=V(5) : X3=0 : Y3=0
If WM>320
Screen Open NEWSCRN,V(0),V(1),NC,Hires : Flash Off
Else
Screen Open NEWSCRN,V(0),V(1),NC,Lowres : Flash Off
End If
Get Palette OLDSCRN
Screen Copy OLDSCRN,X1,Y1,X2,Y2 To NEWSCRN,X3,Y3
Screen Show NEWSCRN
Screen To Back BACKSCRN
Screen To Front NEWSCRN
Screen To Front PADSCRN
End Proc
Procedure P_FLASH
Ink 2 : Paint XOFF+539,YOFF+28,1
Screen NEWSCRN : C=Colour(0)
Flash 0,"(001,3)(003,3)(005,3)(007,3)(009,3)(00b,3)(00d,3)(00f,4)(00d,3)(00b,3)(009,3)(007,3)(005,3)(003,3)"
P_MOUSE_UP
Flash Off : SX=0 : Colour 0,C
Screen PADSCRN : Ink 7 : Paint XOFF+539,YOFF+28,1
End Proc
Procedure P_LOAD_FILE
SX=0 : Ink 2 : Paint XOFF+441,YOFF+12
Set Dir 32,".info/*.info/*.*.info"
Dir$=D$
PATH$="*.*"
T1$="Load IFF File" : T2$=""
FILE$=Fsel$(PATH$,"",T1$,T2$)
If FILE$="" Then Goto L_P_L_F_EXIT
'
P_CLEAR_DISPLAY
TY=1 : T$="Loading IFF File" : P_CENTRE_TEXT
TY=3 : T$=FILE$ : P_CENTRE_TEXT
Load Iff FILE$,OLDSCRN : Flash Off : NC=Screen Colour
Screen Hide OLDSCRN
V(0)=Screen Width(OLDSCRN) : V(4)=V(0)
V(1)=Screen Height(OLDSCRN) : V(5)=V(1)
V(2)=0 : V(3)=0 : WM=V(0) : HM=V(1) : FF=1
P_STATUS
P_COPY_OLD_NEW
'
L_P_L_F_EXIT:
Screen PADSCRN : Ink 7 : Paint XOFF+441,YOFF+12
End Proc
Procedure P_MOUSE_UP
While Mouse Key<>0
Wend
End Proc
Procedure P_MOVE_PAD
OMY=Y Mouse : OPY=PY : LMY=OMY
L_P_M_P0:
MY=Y Mouse
If Mouse Key=0 Then Goto L_P_M_P_EXIT
If MY=LMY Then Goto L_P_M_P0
'
PY=OPY+MY-OMY
Screen Display PADSCRN,,PY,,
LMY=MY
Goto L_P_M_P0
'
L_P_M_P_EXIT:
End Proc
Procedure P_PAD_BOTTOM
PB=234 : DY=Sgn(PB-PY)
While PY<>PB
Screen Display PADSCRN,,PY,,
PY=PY+DY : Wait Vbl
Wend
End Proc
Procedure P_SAVE_FILE
SX=0 : Ink 2 : Paint XOFF+441,YOFF+28
Set Dir 32,".info/*.info/*.*.info"
Dir$=D$
PATH$="*.*"
T1$="Save IFF File" : T2$=""
FILE$=Fsel$(PATH$,"",T1$,T2$)
If FILE$="" Then Goto L_P_S_F_EXIT
'
P_CLEAR_DISPLAY
TY=1 : T$="Saving IFF File" : P_CENTRE_TEXT
TY=3 : T$=FILE$ : P_CENTRE_TEXT
Screen NEWSCRN
Save Iff FILE$ : Flash Off
'
L_P_S_F_EXIT:
P_STATUS
Ink 7 : Paint XOFF+441,YOFF+28
End Proc
Procedure P_SCREEN1
Screen Open BACKSCRN,320,296,2,Lowres : Flash Off : Curs Off
D$="df1:" : If Exist(D$)=0 Then D$="df0:"
A$=D$+"GrabIFF.IFF"
Wait Vbl : If Length(SCRNBANK)>0
Unpack SCRNBANK To PADSCRN : Screen Hide PADSCRN
Else
Load Iff A$,PADSCRN : Flash Off : Curs Off : Screen Hide PADSCRN
Spack PADSCRN To SCRNBANK
End If
'
' Determine offsets?
'
YOFF=0 : XOFF=320
While Point(XOFF,YOFF)=0
Inc YOFF
Wend
XOFF=0 : Y=YOFF+40
While Point(XOFF,Y)=0
Inc XOFF
Wend
End Proc
Procedure P_SCREEN_TITLE
' Sign On Title
'
Screen PADSCRN : P_CLEAR_DISPLAY
TY=1 : T$="Screen Grabber V1.1" : P_CENTRE_TEXT
TY=2 : T$="by Tony Swanwick" : P_CENTRE_TEXT
TY=4 : T$="Start By Loading An IFF File" : P_CENTRE_TEXT
Screen Show PADSCRN
P_PAD_BOTTOM
End Proc
Procedure P_SCREEN_XY
SX=X Screen(1,X Mouse) : SY=Y Screen(1,Y Mouse) : SC=Point(SX,SY)
SX=SX-XOFF : SY=SY-YOFF
' T$=" SX="+Str$(SX)+" SY="+Str$(SY)+" SC="+Str$(SC)+" "
' TY=-1 : P_CENTRE_TEXT
End Proc
Procedure P_SHOW_OLD
Ink 2 : Paint XOFF+539,YOFF+12,1
Screen Show OLDSCRN : Screen To Front OLDSCRN
While Mouse Key<>0
Wend
Screen Hide OLDSCRN
Ink 7 : Paint XOFF+539,YOFF+12,1
End Proc
Procedure P_STATUS
P_CLEAR_DISPLAY
T$="Loaded Screen:"+BLANK$ : TY=0 : P_CENTRE_TEXT
W=Screen Width(OLDSCRN) : H=Screen Height(OLDSCRN)
TY=1 : T$="Width="+Str$(W)+" Height="+Str$(H)+BLANK$
P_CENTRE_TEXT
T$="New Screen:"+BLANK$ : TY=3 : P_CENTRE_TEXT
'
C=2 : TY=4 : TX=0 : T$="W= H= XOFF= YOFF=" : P_TEXT_XY
Ink 1,0 : If VP=0 Then Ink 1,C
TY=4 : TX=2 : T$=Str$(V(0))+" " : T$=Mid$(T$,2,3) : P_TEXT_XY
Ink 1,0 : If VP=1 Then Ink 1,C
TY=4 : TX=9 : T$=Str$(V(1))+" " : T$=Mid$(T$,2,3) : P_TEXT_XY
Ink 1,0 : If VP=2 Then Ink 1,C
TY=4 : TX=20 : T$=Str$(V(2))+" " : T$=Mid$(T$,2,3) : P_TEXT_XY
Ink 1,0 : If VP=3 Then Ink 1,C
TY=4 : TX=29 : T$=Str$(V(3))+" " : T$=Mid$(T$,2,3) : P_TEXT_XY
Ink 1,0
End Proc
Procedure P_TEXT_XY
Screen PADSCRN
If Len(T$)>36 Then T$=Left$(T$,36)
X=92+XOFF+(10*TX) : Y=YOFF+16+9*TY
Text X,Y,T$
End Proc
'
'
'
L_CLEAR:
Hide On
Screen PADSCRN : Ink 2 : Paint XOFF+19,YOFF+58,1
If FF=1 Then Screen Close NEWSCRN : Screen Close OLDSCRN
Goto L_WARM_START
'
L_COLD_START:
Hide On : While Screen>-1
Screen Close Screen
Wend : Close Editor
BLANK$=" "
PADSCRN=1
OLDSCRN=2
NEWSCRN=3
BACKSCRN=4
SCRNBANK=1
P_SCREEN1
'
L_WARM_START:
D$="df1:" : If Exist(D$)=0 Then D$="df0:"
PY=300 : FF=0 : FILE$="" : VP=0
P_SCREEN_TITLE
X Mouse=253 : Y Mouse=264
Limit Mouse 128,42 To 447,297 : Show On
Ink 7 : Paint XOFF+19,YOFF+58,1
Goto L_LOOP
'
L_EXIT:
Ink 2 : Paint XOFF+19,YOFF+30,1 : Wait 20
Default : Edit
End
'
VARIABLES:
'
' A = any variable.
' D$ = Directory pathname.
' FF = file loaded flag.
' FILE$ = file description.
' HM = max new screen height.
' NC = number of colours in oldscrn.
' PY = pad vertical screen offset.
' TY = text row value.
' T$ = text string.
' VP = array pointer.
' V() = array w,h,xoff,yoff.
' WM = max new screen width.
' XOFF,YOFF = pad screen offsets.
'