;-----------------------------------------------------------PowerPPL v2.2á---
; File           : OAM.PPS
; Original by    : LONE RUNNER on 06/24/1995 at 21:35:00
; Last update by : LONE RUNNER on 08/28/1995 at 16:38:45
;----------------------------------------------------------------------------
;
;
;  This is a part of the Project Frontier's Source code.
;
;  Copyright (C) 1997-98 Francis Gastellu
;                    aka Lone Runner/Aegis
;
;  This program 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; either version 2
;  of the License, or (at your option) any later version.
;
;  This program 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.  See the
;  GNU General Public License for more details.
;
;  You should have received a copy of the GNU General Public License
;  along with this program; if not, write to the Free Software
;  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
;
; Online application maker

;$USEFUNCS
;----------------------------------------------------------------------------

Declare Procedure AffMenu(Int S)
Declare Procedure EffCurseur()
Declare Procedure DrawScreen(Int S)
Declare Procedure SetField(Int F, Int X, Int Y, Int L)
Declare Procedure FillForm()
Declare Function InputLine(Integer Col, Integer Row, Integer SLen, String Def, String Chars, Boolean Up) String
Declare Procedure PostForm()

;----------------------------------------------------------------------------

String K, T
String MenuEntry(4)
Int Sel
Int Field(30,2)
String Field_S(30)
Int nFields
Int Control
Int ApplyFor

;----------------------------------------------------------------------------
Begin

Int C

Sel = 3
MenuEntry(0) = "@X0F  @X0BA@X0FNSi/ASCii DESiGNE@X0BR  "
MenuEntry(1) = "@X0F         @X0BO@X0FTHE@X0BR         "
MenuEntry(2) = "@X0F        @X0BH@X0FQ/DiS@X0BT        "
MenuEntry(3) = "@X0F       @X0BP@X0FPE CoDE@X0BR@X0B       "
MenuEntry(4) = "@X0F       @X0BE@X0FXE CoDE@X0BR       "

:Start

For C = 0 To 30
	Field_S(C) = ""
Next

Cls
StartDisp FNS

PrintLn "@X0F  @X0BÜ@X3BÛ²ÛÛ@X0BÜ  Ü@X3BÛÛ²Û@X0BÜ   Ü@X3B²ÛÛ²@X0BÜ  ß@X3B²@X0BÜ     Ü@X3BÛ²ÛÛ@X0BÜ      Ü@X3BÛÛ²Û@X0BÜ   Ü@X3BÛ²Û²@X0BÜ  Ü@X3B²Û²Û@X0BÜ  Ü@X3B²Û²Û@X0BÜ "
PrintLn "@X0B @X3BÛ²@X0Bß  ß@X3B²@X0BÝ@X3B²±@X0Bß  ß@X3B²@X0BÝ ²@X3B²@X0Bß  ß@X3B²@X0BÝ  ÜÜÜ   @X3B±²@X0Bß  ß@X3B²@X0BÝ    ²@X3B²@X0Bß  ß@X3B²@X0BÝ ²@X3B²@X0Bß  ß@X3B²@X0BÝ@X3BÞ²@X0Bß  ß@X3B²@X0BÝ@X3B²Û@X0Bß  ß@X3B²@X0BÝ"
PrintLn "@X0BÞ@X3B±@X0BÝ    @X3B±²±@X0BÝ   Þ@X3B±@X0BßÞ@X3B±@X0BÝ   Þ@X3B±@X0Bß   ß@X3B²°@X0F @X3B°²@X0BÝ   Þ@X3B±@X0Bß   Þ@X3B±@X0BÝ   Þ@X3B±@X0BßÞ@X3B°@X0BÝ   Þ²@X3B²±@X0BÝ   Þ@X3B±@X0BÞ@X3B±@X0BÝ   @X03Þ@X3B±@X0Bß"
PrintLn "@X3B±²@X0F     @X3B±°°@X0F  @X0BÜÜ   @X3B²°@X0F  @X0BÜÜÜÜ     @X3B°±²@X03Þ@X3B±@X03ÜÜ        @X0B²@X3B°@X0F       @X3B±²@X0F     @X3B°±°@X0F  @X03Ü@X0BÜ@X3B°@X0Bß²@X3B°@X0F @X03ÜÜ@X38°@X3B°@X03ß "
PrintLn "@X3B°±@X0F @X0Bßß@X03Ü @X3B°@X38°°@X0F @X03ß     @X3B°±@X0F @X03ß  @X0Bß@X3B²±@X03Ü  @X08Þ@X3B±°°@X0F @X03ßß@X3B°@X38°@X3B°±@X03Ü    @X3B±²@X0F     @X03Ü @X3B°±@X0F     @X38°@X3B°±@X0F @X03ß@X0BßÜ@X03Ü @X3B±@X38°@X0F  @X03ßß   "
PrintLn "@X38°@X3B°@X08Ü    @X38°@X3B°°@X08Ý      @X38°@X3B°@X08Ý     @X3B°±@X38°@X0F @X38°@X3B°@X38±²@X0F      @X08ß@X38°@X08Ý   @X38°@X3B±@X08Ý   @X03ß@X38°Û°@X3B°@X08Ý   Þ@X38°±@X3B°@X08Ý   @X3B°@X38°@X08Þ@X3B°@X08Ý kL!  "
PrintLn "@X08Þ@X38°±@X08Ý  Þ@X38°@X03Þ@X38°±@X03Ü  @X08Ü@X38²@X08ÜÞ@X38°±@X03Ü@X08Ü  @X03Ü@X38°±@X3B°@X08Þ@X38°±²@X0F @X08Ü@X38±@X08Ü   @X03Ü@X38±²@X0F   @X08Þ@X38°@X3B°@X03Ü  Ü@X38±@X08ÝÞ@X38°±@X03Ü  Ü@X38±@X08Ý@X38°±@X08Ü  @X38°±@X08Ý@X38°±@X08Ü   @X03Ü "
PrintLn "@X03 @X38±²@X08ß Ü@X38±²@X08Ýß@X38Ü²°²°±²@X08Üß@X03ß@X38°±°²±Ü@X08ß  ßß  ß@X38°±°²±²±@X08ß    ßÞ@X38°±°²@X08ß  ßÞ@X38°²±°@X08ß ß@X38²°@X08Ü ß@X38²@X08Û@X38Ü²°@X08Ü ß@X38²@X08ß"
PrintLn "@X08      ßß    ßßßßß    ßßß           ßßßßß        ßßß      ßßß     ß    ß ßß     "
PrintLn "@X0F                                                                               "
PrintLn "@X08                                  @X0FaPPLY FoR                                    "
PrintLn "@X0F                        @X03ú Ä@X0BÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ@X03Ä ú                          "
AffMenu(Sel)
AnsiPos 1, 18
PrintLn "@X0B                 @X03ú   ú Ä@X0BÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ@X03Ä ú   ú                   "
PrintLn "@X0F                                                                               "



While (1) Do

	K = Inkey()
	
	If (K = "") Continue
	
	If (K = "DOWN") Then
		Inc Sel
		If (Sel = 6) Sel = 1
		AffMenu(Sel)
	Endif

	If (K = "UP") Then
		Dec Sel
		If (Sel = 0) Sel = 5
		AffMenu(Sel)
	Endif
	
	If (K = "") Break
	
	If (K = Chr(13)) Then
		DrawScreen(Sel)
		FillForm()
		If (Control != 1) PostForm()
		Goto Start
	Endif

EndWhile

T = "  <´EGiS CoRP'95  "

Color 15
CLS
AnsiPos 31,12
Print T
Delay 2
Backup 18
Color 7
Print T
Delay 2
Backup 18
Color 8
Print T
Delay 2
Backup 18
Color 15
Print Space(Len(T))
Delay 2
AnsiPos 1,1

End

;----------------------------------------------------------------------------
Procedure EffCurseur()
AnsiPos 2,22
Color 0
Print " "
Backup 1
EndProc

;----------------------------------------------------------------------------
Procedure Affmenu(Int S)

Int a, b, c

b = S - 2
For a = 1 to 5

	c = b - 1
	Select Case c
		Case -1
			c = 4
		Case -2
			c = 3
		Case -3
			c = 2
		Case 5
			c = 0
		Case 6
			c = 1
		Case 7
			c = 2
	End Select
	
	AnsiPos 27, 12+a
	If (a = 3) Then
		Print "@X3F" + StripAtx(MenuEntry(c))+""
	Else
		Print "@X0F " + MenuEntry(c) + " "
	Endif
	Inc b

Next

EffCurseur()

Endproc

;----------------------------------------------------------------------------
Procedure DrawScreen(Int S)

ApplyFor = S

Cls
PrintLn "@X0FÚ@X0BÄÄ@X03Ä@X0BÄ@X03Ä Ä ú    ú                                                ú -ÄÄÄ@X0BÄ@X03ÄÄÄ@X0BÄ@X03Ä@X0BÄÄÄ@X0F¿"
AnsiPos 17,1
PrintLn "@X0Ba@X0FPPLY FoR "
PrintLn "@X0B³                                                                             ³"
PrintLn "@X03³ @X0BH@X0FaNDLE    [.......................]                                         @X03³"
PrintLn "@X03: @X0BR@X0FeAL NaME [.......................]                                         @X0B³"
PrintLn "@X0B                                                                              @X03³"
PrintLn "@X03. @X0BV@X0FOiCE PHoNE [.....................]                                         @X03³"
PrintLn "@X03  @X0BD@X0FaTA PHoNE  [.....................]                                          "
PrintLn "@X0F  @X0BD@X0FaTE oF BiRTH            [../../..]                                         @X03³"
PrintLn "@X03ú @X0BY@X0FeARS COMPUTiNG                [..]                                         @X03:"
PrintLn "@X03                                                                              ."
PrintLn "@X03  @X0BD@X0Fo YoU RuN a BBS (Y/N) ?        [.]                                          "
PrintLn "@X0F  @X08BBS NaME  [.......................]                                         @X03ú"
PrintLn "@X03  @X08BBS PHoNE [.......................]                                          "
PrintLn "@X0F  @X08BBS NuP   [.......................]                                          "
PrintLn "@X0F                                                                               "
PrintLn "@X03ú @X0BA@X0FDDReSS [.................................................................] @X03ú"
PrintLn "@X03. @X0F[.........................................................................]  "
PrintLn "@X03:                                                                             ."
PrintLn "@X03³ @X0BS@X0FOMETHiNG To aDD [........................................................] @X03:"
PrintLn "@X0B³ @X0F[.........................................................................] @X03³"
PrintLn "@X03³ @X0F[.........................................................................] @X03³"
PrintLn "@X0B³ @X0F[.........................................................................] @X0B³"
Print   "@X0FÀ@X0BÄÄ@X03Ä@X0BÄ@X03ÄÄÄ@X0BÄ@X03ÄÄ-- ú   ú                                       ú     ú -ÄÄÄ@X0BÄ@X03ÄÄÄ@X0BÄ@X03Ä@X0BÄÄ@X0FÙ@X07"

SetField(0,14,3,23)
SetField(1,14,4,23)
SetField(2,16,6,21)
SetField(3,16,7,21)
SetField(4,29,8,2)
SetField(5,32,8,2)
SetField(6,35,8,2)
SetField(7,35,9,2)
SetField(8,36,11,1)
SetField(9,14,12,23)
SetField(10,14,13,23)
SetField(11,14,14,23)
SetField(12,12,16,65)
SetField(13,4,17,73)
SetField(14,21,19,56)
SetField(15,4,20,73)
SetField(16,4,21,73)
SetField(17,4,22,73)

Select Case S

	Case 1
		AnsiPos 27,1
		Print "@X0BA@X0FNSi/ASCii DESiGNER"
    	AnsiPos 42, 3
    	Print "@X0BY@X0FoU CaN DRaW...             @X0BA@X0FNSi [.]";77,3,1
    	AnsiPos 42, 4
    	Print "@X0B                           A@X0FSCii [.]";77,4,1
    	AnsiPos 42, 5
    	Print "@X0F                                    "
    	AnsiPos 42, 6
    	Print "@X0BG@X0FRoUP(s) YoU'RE ALREaDY iN          "
    	AnsiPos 42, 7
    	Print "@X0F[..................................]";43,7,24
    	AnsiPos 42, 8
    	Print "@X0F                                    "
    	AnsiPos 42, 9
    	Print "@X0BY@X0FeARS oF ANSi/ASCii DRAWiNG     [..]";76,9,2
    	AnsiPos 42, 10
    	Print "@X0F                                    "
    	AnsiPos 42, 11
    	Print "@X0BP@X0FReFERED SiZE              [...x...]";71,11,3 - 75,11,3
    	AnsiPos 42, 12
    	Print "@X0BK@X0FiND [.............................]";48,12,19
    	AnsiPos 42, 13
    	Print "@X0F                                    "
    	AnsiPos 42, 14
    	Print "@X0BS@X0FoFTWARE [.........................]";52,14,15
    	SetField(18,76,3,1)
    	SetField(19,76,4,1)
    	SetField(20,43,7,34)
    	SetField(21,75,9,2)
    	SetField(22,70,11,3)
    	SetField(23,74,11,3)
    	SetField(24,48,12,29)
    	SetField(25,52,14,25)
    	nFields = 25

	Case 2
		AnsiPos 27,1
		Print "@X0BO@X0FTHeR"
		AnsiPos 42, 3
    	Print "@X0BW@X0FHaT CaN YoU oFFER To AEGiS CoRP ?  "
		AnsiPos 42, 4
    	Print "@X0F[..................................]"
		AnsiPos 42, 5
    	Print "@X0F[..................................]"
		AnsiPos 42, 6
    	Print "@X0F[..................................]"
		AnsiPos 42, 7
    	Print "@X0F[..................................]"
		AnsiPos 42, 8
    	Print "@X0F[..................................]"
		AnsiPos 42, 9
    	Print "@X0F[..................................]"
		AnsiPos 42, 10
    	Print "@X0F[..................................]"
		AnsiPos 42, 11
    	Print "@X0F[..................................]"
		AnsiPos 42, 12
    	Print "@X0F[..................................]"
		AnsiPos 42, 13
    	Print "@X0F[..................................]"
		AnsiPos 42, 14
    	Print "@X0F[..................................]"
    	SetField(18,43,4,34)
    	SetField(19,43,5,34)
    	SetField(20,43,6,34)
    	SetField(21,43,7,34)
    	SetField(22,43,8,34)
    	SetField(23,43,9,34)
    	SetField(24,43,10,34)
    	SetField(25,43,11,34)
    	SetField(26,43,12,34)
    	SetField(27,43,13,34)
    	SetField(28,43,14,34)
    	nFields = 28

	Case 3
		AnsiPos 27,1
		Print "@X0BH@X0FQ/DiSTRO SiTE"
		AnsiPos 42, 3
    	Print "@X0BD@X0Fo YoU RuN PCBoARD               [.]";77,3,1
		AnsiPos 42, 4
    	Print "@X0B# @X0FoF NoDE(s)                    [..]";76,4,2
		AnsiPos 42, 5
    	Print "@X0F                                    "
		AnsiPos 42, 6
    	Print "@X0BM@X0FoDEM / SPeED                       "
		AnsiPos 42, 7
    	Print "@X0F[..................................]";43,7,24
		AnsiPos 42, 8
    	Print "@X0F                                    "
		AnsiPos 42, 9
    	Print "@X0BB@X0FoARD AFFiLiATiON(s)                "
		AnsiPos 42, 10
    	Print "@X0F[..................................]";43,10,24
		AnsiPos 42, 11
    	Print "@X0F                                    "
		AnsiPos 42, 12
    	Print "@X0BB@X0FBS TOPiCS                          "
		AnsiPos 42, 13
    	Print "@X0F[..................................]";43,13,24
		AnsiPos 42, 14
    	Print "@X0F[..................................]";43,14,24
    	SetField(18,76,3,1)
    	SetField(19,75,4,2)
    	SetField(20,43,7,34)
    	SetField(21,43,10,34)
    	SetField(22,43,13,34)
    	SetField(23,43,14,34)
    	nFields = 23

	Case 4
		AnsiPos 27,1
		Print "@X0BP@X0FPE CoDER"
		AnsiPos 42, 3
    	Print "@X0BG@X0FRoUP(s) YoU'RE ALREaDY iN          "
		AnsiPos 42, 4
    	Print "@X0F[..................................]";43,4,24
		AnsiPos 42, 5
    	Print "@X0F                                    "
		AnsiPos 42, 6
    	Print "@X0BF@X0FaMOUS PRoD(s)                      "
		AnsiPos 42, 7
    	Print "@X0F[..................................]";43,7,24
		AnsiPos 42, 8
    	Print "@X0F                                    "
		AnsiPos 42, 9
    	Print "@X0BY@X0FeARS oF PPE XPERiENCE          [..]";76,9,2
		AnsiPos 42, 10
    	Print "@X0F                                    "
		AnsiPos 42, 11
    	Print "@X0BY@X0FoU LiKE To CoDE                    "
		AnsiPos 42, 12
    	Print "@X0B                           G@X0FaMES [.]";77,12,1
		AnsiPos 42, 13
    	Print "@X0B                           U@X0FTiLS [.]";77,13,1
		AnsiPos 42, 14
    	Print "@X0B                           o@X0FTHER [.]";77,14,1
    	SetField(18,43,4,34)
    	SetField(19,43,7,34)
    	SetField(20,75,9,2)
    	SetField(21,76,12,1)
    	SetField(22,76,13,1)
    	SetField(23,76,14,1)
    	nFields = 23
    	
	Case 5
		AnsiPos 27,1
		Print "@X0BE@X0FXE CoDER"
		AnsiPos 42, 3
    	Print "@X0BG@X0FRoUP(s) YoU'RE ALREaDY iN          "
		AnsiPos 42, 4
    	Print "@X0F[..................................]";43,4,24
		AnsiPos 42, 5
    	Print "@X0F                                    "
		AnsiPos 42, 6
    	Print "@X0BF@X0FaMOUS PRoD(s)                      "
		AnsiPos 42, 7
    	Print "@X0F[..................................]";43,7,24
		AnsiPos 42, 8
    	Print "@X0F                                    "
		AnsiPos 42, 9
    	Print "@X0BY@X0FeARS oF EXE XPERiENCE          [..]";76,9,2
		AnsiPos 42, 10
    	Print "@X0F                                    "
		AnsiPos 42, 11
    	Print "@X0BY@X0FoU LiKE To CoDE                    "
		AnsiPos 42, 12
    	Print "@X0B                           G@X0FaMES [.]";77,12,1
		AnsiPos 42, 13
    	Print "@X0B                           U@X0FTiLS [.]";77,13,1
		AnsiPos 42, 14
    	Print "@X0B                           o@X0FTHER [.]";77,14,1
    	SetField(18,43,4,34)
    	SetField(19,43,7,34)
    	SetField(20,75,9,2)
    	SetField(21,76,12,1)
    	SetField(22,76,13,1)
    	SetField(23,76,14,1)
    	nFields = 23

End Select

EndProc

;----------------------------------------------------------------------------
Procedure SetField(Int F, Int X, Int Y, Int L)

Field(F,0) = X
Field(F,1) = Y
Field(F,2) = L

Endproc

;----------------------------------------------------------------------------
Procedure FillForm()

Int a
String Str, s
Boolean BBS, Upp, Ask

BBS = False

A = -1

While (1) Do
Inc a
If (A > nFields) A = 0

If ((A == 8) || (ApplyFor = 1 && (A = 18 || A = 19)) || (ApplyFor = 3 && A = 18) || ((ApplyFor = 5 || ApplyFor = 4) && (A = 21 || A = 22 || A = 23))) Then
	Upp = True
	s = "YyNn"
Else
	Upp = False
	s = Mask_Ascii()+"@‚Š‡…—”‹‰"
Endif
	
If ((A >= 9 && A <= 11) && !BBS) Continue

Str = InputLine(Field(a,0), Field(a,1), Field(a,2), Field_S(a),s,Upp)

;If (Str != "") 
Field_S(a) = Str

If (Control = 1) Break
If (Control = 2) Then
	If (A == 12 && !BBS) Then
		A = A - 5
	Else
		A = A - 2
	Endif
Endif

If (Control = 3) Continue

If (A = 8 & Str != "") Then
	If (Str = "Y") Then
		BBS = True
		AnsiPos 1,12
		PrintLn "@X0F  @X0BB@X0FBS NaME  [.......................]"
		PrintLn "@X03  @X0BB@X0FBS PHoNE [.......................]"
		PrintLn "@X0F  @X0BB@X0FBS NuP   [.......................]"
	Else
		BBS = False
		AnsiPos 1,12
		PrintLn "@X0F  @X08BBS NaME  [.......................]"
		PrintLn "@X03  @X08BBS PHoNE [.......................]"
		PrintLn "@X0F  @X08BBS NuP   [.......................]"
	Endif
Endif

Endwhile

Ask = False
For A = 0 to nFields
	If (Field_S(A) != "") Ask = True
Next


If (!Ask) Then

	Control = 1

Else

    AnsiPos 35,23
    Print "@X0BS@X0FaVE ? [.]"
    
    Str = InputLine(43, 23, 1, "", "YyNn", True)

    AnsiPos 35,23
    Print "@X0F          "
    EffCurseur()
    
    If (Str != "Y") Then
    	Control = 1
    Else
    	Control = 0
    Endif

Endif

EndProc

;----------------------------------------------------------------------------
Function InputLine(Integer Col, Integer Row, Integer SLen, String Def, String Chars, Boolean Up) String

Integer il_L
String il_Line

Control = 0
AnsiPos Col, Row

Print "@X0B"+Def
il_L = Len(Def)
il_Line = Def

While (True) Do
	k = Inkey()
	If (Up) k = Upper(k)
	Select Case k
	
		Case Chr(27)
			InputLine = il_Line;""
			Control = 1
			Break
			
		Case "UP"
			InputLine = il_line;""
			Control = 2
			Break

		Case "DOWN"
			InputLine = il_line;""
			Control = 3
			Break
	
		Case Chr(13)
			InputLine = il_Line
			Break
			
		Case Chr(8)
			If (il_Line <> "") Then
				il_Line = Left(il_Line,len(il_Line)-1)
				Backup 1
				Print "@X0F."
				Backup 1
			Endif
		
		Case Else
			If (Len(il_Line) < SLen & Len(k) = 1 & Asc(k) > 31) Then
				If (InStr(Chars, k)) Then
					If (Right(Il_Line,1) = " ") k = Upper(K)
					il_Line = il_Line + k
					Print "@X0B"+k
					If (len(il_Line) = SLen) Then
						InputLine = il_Line
						Break
					Endif
				Endif
			Endif
	
	End Select
Endwhile

EndFunc

;----------------------------------------------------------------------------
Procedure PostForm()

Int a, Conf
String ToName, Secu, Line
Boolean StripIt

Fcreate 1, PPEPath() + "MESSAGE.TXT", O_WR, S_DN

Conf = ToInt(ReadLine(PPEPath() + "OAM.CFG", 1))
ToName = ReadLine(PPEPath() + "OAM.CFG", 2)
Secu = ReadLine(PPEPath() + "OAM.CFG", 3)
If (ReadLine(PPEPath() + "OAM.CFG", 4) = "YES") StripIt = True

FClose -1

For a = 1 to 23
	Line = Rtrim(ScrText(1, a, 79, True)," ")
	If (StripIt) Line = StripAtx(Line)
	Fputln 1, Line
Next

FClose 1

Message Conf, ToName, U_NAME(), "APP FORM", Secu, 0, False, False, PPEPath() + "MESSAGE.TXT"

Delete PPEPath() + "MESSAGE.TXT"

Cls

AnsiPos 37,11
Print "@X0FSaVED!"
Delay 1
Backup 6
Print "@X07SaVED!"
Delay 1
Backup 6
Print "@X08SaVED!"
Delay 1
Backup 6
Print "@X07SaVED!"
Delay 1
Backup 6
Print "@X0FSaVED!"
Delay 1
Backup 6
Print "@X07SaVED!"
Delay 1
Backup 6
Print "@X08SaVED!"
Delay 1
Backup 6
Print "      "
Delay 1

Endproc

