-
Notifications
You must be signed in to change notification settings - Fork 1
/
MULT.CPP
265 lines (253 loc) · 6.2 KB
/
MULT.CPP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
#include <stdlib.h>
#include <alloc.h>
#include <string.h>
#include "mouse.h"
#include "famegraf.h"
#include "keys.h"
#include "all.h"
//extern Joy J;
extern Mouse m;
#ifdef EDITOR
#include "dialog.h"
extern Panel p;
#endif
extern char str0[25];
extern long tic; //¤«ï § ¤¥à¦ª¨ ¯® â ©¬¥àã
extern screen hidscr; //áªàëâ ï áâà ¨çª
extern block tfnt; //¯®¤ ¡®«ì訥 èà¨äâë
screen text;
extern char far stroka[255];
extern int end;
void mult(char * name) {
//áç¨âë¢ ¨¥ ®¯¨á ¨ï ¬ã«ìâ ¨ ¯®ª §
block txt,tmp;
char _char_fgd=char_fgd, _char_bkgd=char_bkgd; /*梥â ᨬ¢®« ¨ ä® */
int x,y;
int n,i,j,k;
char str1[20];
char str2[20];
char str3[20];
char str4[20];
char str5[20];
char str6[20];
char str7[20];
NormalScreen();
//áç¨â ¥¬ áæ¥ à¨©
text=famemalloc(SizeLib(name)+8);
_fmemset(text,0,SizeLib(name)+8);
GetLib(name,(block)text); txt=(block)text;
n=1; end=0;
while(n>=1 && end==0) {
//áç¨â ¥¬ ®ç¥à¥¤ áâபã
memcpy((block)&stroka,txt,80);
n=sscanf(stroka,"%s %s %s %s %s %s %s ",
&str1,&str2,&str3,&str4,&str5,&str6,&str7);
if (stricmp(str1,"CLS")==0) {
//®ç¨áª íªà
SetColor(atoi(str2));
WVR();
CBar(0,0,320,200);
} else
if (strnicmp(str1,"TI",2)==0) {
//¯ થâ
GetLib(str2,(block)hidscr);
TileBar(MinX,MinY,MaxX-MinX+1,MaxY-MinY+1,atoi(str3),atoi(str4),(block)hidscr);
} else
if (stricmp(str1,"BAR")==0) {
//¯àאַ㣮«ì¨ª
WVR();
CBar(atoi(str2),atoi(str3),atoi(str4),atoi(str5));
} else
if (strnicmp(str1,"PAU",3)==0) {
//¯ ã§
tic=gettic()+18*atoi(str2);
while (gettic()<tic && end==0);
} else
if (stricmp(str1,"CLIP")==0) {
//®¡« íªà
Clip(atoi(str2),atoi(str3),atoi(str4),atoi(str5));
x=atoi(str2);y=atoi(str3);
} else
if (stricmp(str1,"COL")==0) {
//梥â
SetColor(atoi(str2));
char_fgd=CurrentColor;
} else
if (stricmp(str1,"XY")==0) {
//¯®§¨æ¨ï íªà ¥
x=atoi(str2);y=atoi(str3);
} else
if (stricmp(str1,"PSHOW")==0) {
//¯®ª § âì ª à⨪ã
GetLibs(str2,(block)hidscr);
WVR();
PutCMas(x,y,atoi(str3),atoi(str4),(block)hidscr);
} else
if (stricmp(str1,"ISHOW")==0) {
//¯®ª § âì ª à⨪㠡¥§ ¯à®á¢¥â®¢
GetLibs(str2,(block)hidscr);
WVR();
PutCImg(x,y,atoi(str3),atoi(str4),(block)hidscr);
} else
if (stricmp(str1,"SSHOW")==0) {
//¯®ª § âì ª à⨪ã 梥⮩ ª®âãà
GetLibs(str2,(block)hidscr);
WVR();
PutCBlink(x,y,atoi(str3),atoi(str4),(block)hidscr);
} else
if (stricmp(str1,"LSHOW")==0) {
//¯®ª § âì ª à⨪㠫¨¨ï¬¨ ¢ë¥§¦ ï
GetLibs(str2,(block)hidscr);
for ( i=0; i<atoi(str4); ++i ) {
WVR();
for ( j=atoi(str4)-i-1; j>=0; j-- ) {
PutCImg(x,y+i+j,atoi(str3),1,(block)hidscr+atoi(str3)*i);
}
}
} else
if (stricmp(str1,"XSHOW")==0) {
//¯®ª § âì ª à⨪ã â®çª ¬¨
GetLibs(str2,(block)hidscr);
tic=gettic()+18*atoi(str5); //ª®«-¢® ᥪã¤
do {
i=random(atoi(str3)); j=random(atoi(str4));
//CurrentColor=*((block)hidscr)+i+j*atoi(str3);
PutImg(x+i,y+j,1,1,(block)hidscr+i+j*atoi(str3));
/*if ( CurrentColor ) {
PutPixel(x+i,y+j);
}*/
} while (gettic()<tic && end==0);
PutCMas(x,y,atoi(str3),atoi(str4),(block)hidscr);
} else
if (stricmp(str1,"IROLL")==0) {
//¤¢¨£ âì ª à⨪ã íªà ¥
GetLibs(str2,(block)hidscr);
i=atoi(str7);
do {
x+=atoi(str5); y+=atoi(str6);
tic=gettic()+1;
WVR();
PutCImg(x,y,atoi(str3),atoi(str4),(block)hidscr);
while (gettic()<tic && end==0);
} while ( --i>0 && end==0 );
} else
if (stricmp(str1,"MUL")==0) {
//¬ã«ìâ ¨§ ¥áª ª ¤à®¢ ¯®¢â®àïî騩áï N ᥪã¤
GetLibs(str2,(block)hidscr);
k=atoi(str5); //ª®«-¢® ª ¤à®¢
j=atoi(str6); //§ ¤¥à¦ª delay
i=0;
tic=gettic()+18*atoi(str7);
do {
WVR();
PutCImg(x,y,atoi(str3),atoi(str4),(block)hidscr+(i*atoi(str3)*atoi(str4)));
delay(j);
if ( ++i>=k ) i=0;
} while (gettic()<tic && end==0);
} else
if (stricmp(str1,"NMUL")==0) {
//¬ã«ìâ ¨§ ¥áª ª ¤à®¢ ¯®¢â®àïî騩áï N à §
GetLibs(str2,(block)hidscr);
k=atoi(str5); //ª®«-¢® ª ¤à®¢
j=atoi(str6); //§ ¤¥à¦ª delay
i=0;
n=atoi(str7);
do {
WVR();
PutCImg(x,y,atoi(str3),atoi(str4),(block)hidscr+(i*atoi(str3)*atoi(str4)));
delay(j);
if ( ++i>=k ) {
i=0;
if ( (--n)<=0 ) {
n=1;
break;
}
}
} while (end==0);
} else
if (strnicmp(str1,"TXT",3)==0) {
//¢ë¢®¤ ⥪áâ ¡¥§ ¯à®á¢¥â®¢
MoveXY(x,y); tmp=txt;
while ( *tmp && *tmp!='@' ) ++tmp; ++tmp;
while ( *tmp && *tmp!='@' && end==0) {
if ( *tmp=='#' ) {
tic=gettic()+18;
while (gettic()<tic && end==0);
} else
if ( *tmp=='\n' ) {
MoveXY(x,(y+=9));
} else {
PutCh((str1[3])?CharUp(*tmp):(*tmp));
delay(50);
}
tmp++;
}
} else
if (strnicmp(str1,"FTX",3)==0) {
//¢ë¢®¤ â¥áâ ¡¥§ ¯à®á¢¥â®¢ ¨ ¡¥§ ¯ ã§
MoveXY(x,y); tmp=txt;
while ( *tmp && *tmp!='@' ) ++tmp; ++tmp;
while ( *tmp && *tmp!='@' && end==0) {
if ( *tmp=='\n' ) {
MoveXY(x,(y+=9));
} else {
PutCh((str1[4])?CharUp(*tmp):(*tmp));
}
tmp++;
}
} else
if (strnicmp(str1,"BTXT",4)==0) {
//¢ë¢®¡ äà §ë ¡®«ì訬¨ ¡ãª¢ ¬¨
MoveXY(x,y); tmp=txt;
while ( *tmp && *tmp!='@' ) ++tmp; ++tmp;
while ( *tmp && *tmp!='@' && end==0) {
putBch(x,y,(str1[4])?CharUp(*tmp):(*tmp),tfnt);
x+=24; ++tmp;
delay(50);
}
} else
if (stricmp(str1,"LPAL")==0) {
//áç¨â âì á ¤¨áª ¯ «¨âàã
GetLib(str2,palette);
} else
if (stricmp(str1,"LIB")==0) {
//áç¨â âì á ¤¨áª ®¢ãî ¡¨¡-ªã
SetLib(str2);
} else
if (stricmp(str1,"PAL")==0) {
//ãáâ ¯ «¨âàã
PutPalette(palette);
} else
if (stricmp(str1,"OFF")==0) {
//âãè¨âì ¯ «¨âàã
PaletteOff(palette);
} else
if (stricmp(str1,"ON")==0) {
//§ ¦¨£ âì ¯ «¨âàã
PaletteOn(palette);
} else
if (str1[0]=='Q' || str1[0]=='q') {
goto m_exit;
}
//¨¤¥¬ á«¥¤ áâபã
// PATCH: text buffer overflow
while ( ((*txt>27) || (*txt==9)) && (txt < tail) ) ++txt;
while ( (*txt<27) && (txt < tail) ) ++txt;
}
m_exit:
if ( end ) { //¥á«¨ ¯à¥à¢ «¨
PaletteOff(palette); Cls(0);
}
char_fgd=_char_fgd;char_bkgd=_char_bkgd; /*梥â ᨬ¢®« ¨ ä® */
farfree(text);
return;
}
int GetLibs(char *s, block f) {
//íª®®¬ ï § £à㧪
str0[20]=0;
if (stricmp(str0,s)!=0) {
strcpy(str0,s);
return GetLib(s,f);
}
return 0;
}