1 |
james |
26 |
REM > CreateJCode:Create |
2 |
|
|
|
3 |
|
|
DEF PROCCreate(Path$) |
4 |
|
|
LOCAL Name$, Sprt$ |
5 |
|
|
LOCAL Temp%, Spr1%, Spr2% |
6 |
|
|
|
7 |
|
|
REMLOCAL ERROR |
8 |
|
|
REMON ERROR LOCAL RESTORE ERROR: PROCCreate_Error |
9 |
|
|
|
10 |
|
|
Name$ = FNWimp_GetLeaf(Path$) |
11 |
|
|
|
12 |
|
|
SYS"OS_CLI", "CDir " + Path$ |
13 |
|
|
SYS"OS_CLI", "Copy " + Task_Path$ + "Base " + Path$ + ".!" + Name$ + " A~C~DFL~N~P~QR~S~T~V" |
14 |
|
|
SYS"OS_CLI", "CDir " + Path$ + "." + Name$ |
15 |
|
|
SYS"OS_CLI", "CDir " + Path$ + "." + Name$ + ".Basic" |
16 |
|
|
|
17 |
|
|
PROCWimp_LoadFile(Task_Path$ + "Files.!Sprites", 1, "Sprites") |
18 |
|
|
PROCWimp_LoadFile(Task_Path$ + "Files.!Sprites22", 1, "Sprites22") |
19 |
|
|
Spr1% = FNHeap_Find(1, "Sprites") |
20 |
|
|
Spr2% = FNHeap_Find(1, "Sprites22") |
21 |
|
|
Sprt$ = "!" + FNString_Lower(LEFT$(Name$, 11)) |
22 |
|
|
$(Spr1% + 4 + &10) = Sprt$ |
23 |
|
|
$(Spr2% + 4 + &10) = Sprt$ |
24 |
|
|
Spr1%?(4 + &10 + LENSprt$) = 0 |
25 |
|
|
Spr2%?(4 + &10 + LENSprt$) = 0 |
26 |
|
|
SYS"OS_File", 10, Path$ + ".!" + Name$ + ".!Sprites", &FF9,, Spr1% + 4, Spr1% + !Spr1% + 4 |
27 |
|
|
SYS"OS_File", 10, Path$ + ".!" + Name$ + ".!Sprites22", &FF9,, Spr2% + 4, Spr2% + !Spr2% + 4 |
28 |
|
|
PROCHeap_Lose(1, "Sprites") |
29 |
|
|
PROCHeap_Lose(1, "Sprites22") |
30 |
|
|
|
31 |
|
|
Type$ = "Obey" |
32 |
|
|
PROCCopy(Task_Path$ + "Files.!Run", Path$ + ".!" + Name$ + ".!Run") |
33 |
|
|
PROCCopy(Task_Path$ + "Files.!Run2", Path$ + "." + Name$ + ".!Run") |
34 |
|
|
PROCCopy(Task_Path$ + "Files.LinkCrunch", Path$ + "." + Name$ +".LinkCrunch") |
35 |
|
|
|
36 |
|
|
Type$ = "Text" |
37 |
|
|
PROCCopy(Task_Path$+"Files.Menus", Path$ + ".!" +Name$+".Resources.UK.Menus") |
38 |
|
|
|
39 |
|
|
Type$ = "BASIC" |
40 |
|
|
PROCBasic(Task_Path$ + "Files.!Main", Path$ + "." + Name$ + ".!Main") |
41 |
|
|
PROCBasic(Task_Path$+"Files.Basic.Click",Path$ + "." + Name$ +".Basic.Click") |
42 |
|
|
PROCBasic(Task_Path$+"Files.Basic.Init", Path$ + "." + Name$ + ".Basic.Init") |
43 |
|
|
PROCBasic(Task_Path$+"Files.Basic.Menu", Path$ + "." + Name$ + ".Basic.Menu") |
44 |
|
|
PROCBasic(Task_Path$+"Files.Basic.Quit", Path$ + "." + Name$ + ".Basic.Quit") |
45 |
|
|
|
46 |
|
|
ENDPROC |
47 |
|
|
|
48 |
|
|
REM ������������������������������������������������������������������������� |
49 |
|
|
|
50 |
|
|
DEF PROCCreate_Error |
51 |
|
|
PROCHeap_Lose(1, "*") |
52 |
|
|
Erro_ERL% = ERL |
53 |
|
|
Erro_REPORT$ = REPORT$ |
54 |
|
|
Erro_ERR% = Erro_Warn% |
55 |
|
|
ERROR Erro_Warn%, REPORT$ |
56 |
|
|
ENDPROC |
57 |
|
|
|
58 |
|
|
REM ������������������������������������������������������������������������� |
59 |
|
|
|
60 |
|
|
DEF PROCCopy(Fil1$, Fil2$) |
61 |
|
|
LOCAL Fil1%, Fil2%, Byte%, Byt1%, Byt2%, Loop% |
62 |
|
|
|
63 |
|
|
Fil1% = OPENIN(Fil1$) |
64 |
|
|
Fil2% = OPENOUT(Fil2$) |
65 |
|
|
|
66 |
|
|
REMLOCAL ERROR |
67 |
|
|
REMON ERROR LOCAL RESTORE ERROR: PROCCopy_Error |
68 |
|
|
|
69 |
|
|
WHILE NOT EOF#Fil1% |
70 |
|
|
Byte% = BGET#Fil1% |
71 |
|
|
IF Byte% = ASC"{" THEN |
72 |
|
|
Byt1% = BGET#Fil1% |
73 |
|
|
Byt2% = BGET#Fil1% |
74 |
|
|
IF (Byt1% = ASC"!") AND (Byt2% = ASC"}") THEN |
75 |
|
|
FOR Loop% = 1 TO LENName$ |
76 |
|
|
BPUT#Fil2%, ASC(MID$(Name$, Loop%, 1)) |
77 |
|
|
NEXT |
78 |
|
|
ELSE |
79 |
|
|
BPUT#Fil2%, Byte% |
80 |
|
|
BPUT#Fil2%, Byt1% |
81 |
|
|
BPUT#Fil2%, Byt2% |
82 |
|
|
ENDIF |
83 |
|
|
ELSE |
84 |
|
|
BPUT#Fil2%, Byte% |
85 |
|
|
ENDIF |
86 |
|
|
ENDWHILE |
87 |
|
|
|
88 |
|
|
REMRESTORE ERROR |
89 |
|
|
|
90 |
|
|
CLOSE#Fil1% |
91 |
|
|
CLOSE#Fil2% |
92 |
|
|
SYS"OS_CLI", "SetType " + Fil2$ + " " + Type$ |
93 |
|
|
ENDPROC |
94 |
|
|
|
95 |
|
|
REM ������������������������������������������������������������������������� |
96 |
|
|
|
97 |
|
|
DEF PROCCopy_Error |
98 |
|
|
CLOSE#Fil1% |
99 |
|
|
CLOSE#Fil2% |
100 |
|
|
Erro_ERL% = ERL |
101 |
|
|
Erro_REPORT$ = REPORT$ |
102 |
|
|
Erro_ERR% = Erro_Warn% |
103 |
|
|
ERROR Erro_Warn%, REPORT$ |
104 |
|
|
ENDPROC |
105 |
|
|
|
106 |
|
|
REM ������������������������������������������������������������������������� |
107 |
|
|
|
108 |
|
|
DEF PROCBasic(Fil1$, Fil2$) |
109 |
|
|
LOCAL Fil1%, Fil2%, Byte%, Byt1%, Byt2% |
110 |
|
|
|
111 |
|
|
Fil1% = OPENIN(Fil1$) |
112 |
|
|
Fil2% = OPENOUT(Fil2$) |
113 |
|
|
|
114 |
|
|
REMLOCAL ERROR |
115 |
|
|
REMON ERROR LOCAL RESTORE ERROR: PROCCopy_Error |
116 |
|
|
|
117 |
|
|
Byte% = BGET#Fil1% :REM &D |
118 |
|
|
BPUT#Fil2%, Byte% |
119 |
|
|
Byte% = BGET#Fil1% :REM line 1 |
120 |
|
|
WHILE Byte% <> &FF |
121 |
|
|
BPUT#Fil2%, Byte% |
122 |
|
|
Byte% = BGET#Fil1% :REM line 2 |
123 |
|
|
BPUT#Fil2%, Byte% |
124 |
|
|
Byte% = BGET#Fil1% :REM length |
125 |
|
|
Line$ = "" |
126 |
|
|
Byte% = BGET#Fil1% |
127 |
|
|
WHILE Byte% <> &D |
128 |
|
|
IF Byte% = ASC"{" THEN |
129 |
|
|
Byt1% = BGET#Fil1% |
130 |
|
|
Byt2% = BGET#Fil1% |
131 |
|
|
IF (Byt1% = ASC"!") AND (Byt2% = ASC"}") THEN |
132 |
|
|
Line$ += Name$ |
133 |
|
|
ENDIF |
134 |
|
|
ELSE |
135 |
|
|
Line$ += CHR$(Byte%) |
136 |
|
|
ENDIF |
137 |
|
|
Byte% = BGET#Fil1% |
138 |
|
|
ENDWHILE |
139 |
|
|
BPUT#Fil2%, LENLine$ + 4 |
140 |
|
|
BPUT#Fil2%, Line$; |
141 |
|
|
BPUT#Fil2%, Byte% |
142 |
|
|
Byte% = BGET#Fil1% :REM line 1 |
143 |
|
|
ENDWHILE |
144 |
|
|
BPUT#Fil2%, Byte% |
145 |
|
|
|
146 |
|
|
REMRESTORE ERROR |
147 |
|
|
|
148 |
|
|
CLOSE#Fil1% |
149 |
|
|
CLOSE#Fil2% |
150 |
|
|
SYS"OS_CLI", "SetType " + Fil2$ + " " + Type$ |
151 |
|
|
ENDPROC |