📄 russia.lst
字号:
C51 COMPILER V7.06 RUSSIA 10/17/2006 15:30:07 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE RUSSIA
OBJECT MODULE PLACED IN russia.OBJ
COMPILER INVOKED BY: C:\Program Files\Keil\C51\BIN\C51.EXE russia.c LARGE BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include "system.h"
2 #include "lcd.h"
3 #include "picture.h"
4 #include "russia.h"
5 #include "Menu.h"
6
7 int levelup;//=M[2].para_value[2]; //每次升级所需分数
*** ERROR C132 IN LINE 7 OF RUSSIA.C: 'levelup': not in formal parameter list
8 int level;//=M[2].para_value[1]; //控制游戏速度 1~9
*** ERROR C132 IN LINE 8 OF RUSSIA.C: 'level': not in formal parameter list
9 int score;//=(level-1)*levelup; //游戏得分
*** ERROR C132 IN LINE 9 OF RUSSIA.C: 'score': not in formal parameter list
10 unsigned char nextshape_No=18; //下一形状
*** ERROR C244 IN LINE 10 OF RUSSIA.C: 'nextshape_No': can't initialize, bad type or class
*** ERROR C132 IN LINE 10 OF RUSSIA.C: 'nextshape_No': not in formal parameter list
11 unsigned char gamespace[25][12]; //游戏主空间 25*12
*** ERROR C132 IN LINE 11 OF RUSSIA.C: 'gamespace': not in formal parameter list
12
13 unsigned char code strFox1[]={" 分 数 :"};
14 unsigned char code strFox2[]={"GAME OVER!!"};
15 unsigned char code strFox3[]={" 速 度 :"};
16 unsigned char code strFox4[]={"左移"};
17 unsigned char code strFox5[]={"下移"};
18 unsigned char code strFox6[]={"右移"};
19 unsigned char code strFox7[]={"变形"};
20 unsigned char code strFox8[]={"退出 重启"};
21 unsigned char code strFox0[]={"下一形状:"};
22 unsigned char strFox9[5]={"00"}; //存放得分的字串
23 unsigned char strFox10[5]={"1"}; //存放难度的字串
24
25 struct thecurrent //保存当前所控制方块的形状,坐标及变形形状
26 {
27 int shape_No;
28 int x,y;
29 int next;
30 } currentshape;
31
32 struct shapes //19种方块形状及其变形形状
33 {
34 int xy[4][4];
35 int next;
36 }
37 shape[19]=
38 {
39 {
40 {0,0,0,0,
41 0,1,0,0,
42 0,1,0,0,
43 0,1,1,0 },
44 1
45 },
46
47 {
48 {0,0,0,0,
49 0,0,0,0,
C51 COMPILER V7.06 RUSSIA 10/17/2006 15:30:07 PAGE 2
50 0,0,1,0,
51 1,1,1,0 },
52 2
53 },
54
55 {
56 {0,0,0,0,
57 0,1,1,0,
58 0,0,1,0,
59 0,0,1,0 },
60 3
61 },
62
63 { {0,0,0,0,
64 0,0,0,0,
65 1,1,1,0,
66 1,0,0,0 },
67 0
68 },
69 //L
70 { {0,0,0,0,
71 0,1,1,0,
72 0,1,0,0,
73 0,1,0,0 },
74 5
75 },
76
77
78 { {0,0,0,0,
79 0,0,0,0,
80 1,0,0,0,
81 1,1,1,0 },
82 6
83 },
84
85 { {0,0,0,0,
86 0,0,1,0,
87 0,0,1,0,
88 0,1,1,0 },
89 7
90 },
91
92 { {0,0,0,0,
93 0,0,0,0,
94 1,1,1,0,
95 0,0,1,0 },
96 4
97 },
98 //7
99 { {0,0,0,0,
100 0,0,0,0,
101 0,1,0,0,
102 1,1,1,0 },
103 9
104 },
105
106 { {0,0,0,0,
107 0,0,1,0,
108 0,1,1,0,
109 0,0,1,0 },
110 10
111 },
C51 COMPILER V7.06 RUSSIA 10/17/2006 15:30:07 PAGE 3
112
113 { {0,0,0,0,
114 0,0,0,0,
115 1,1,1,0,
116 0,1,0,0 },
117 11
118 },
119
120 { {0,0,0,0,
121 1,0,0,0,
122 1,1,0,0,
123 1,0,0,0 },
124 8
125 },
126 //凸
127 { {0,0,0,0,
128 0,0,0,0,
129 0,1,1,0,
130 1,1,0,0 },
131 13
132 },
133
134 { {0,0,0,0,
135 0,1,0,0,
136 0,1,1,0,
137 0,0,1,0 },
138 12
139 },
140 //_|~
141 { {0,0,0,0,
142 0,0,0,0,
143 1,1,0,0,
144 0,1,1,0 },
145 15
146 },
147
148 { {0,0,0,0,
149 0,1,0,0,
150 1,1,0,0,
151 1,0,0,0 },
152 14
153 },
154 //~|_
155 { {0,1,0,0,
156 0,1,0,0,
157 0,1,0,0,
158 0,1,0,0 },
159 17
160 },
161
162 { {0,0,0,0,
163 0,0,0,0,
164 1,1,1,1,
165 0,0,0,0 },
166 16
167 },
168 // |
169 { {0,0,0,0,
170 0,0,0,0,
171 0,1,1,0,
172 0,1,1,0 },
173 18
C51 COMPILER V7.06 RUSSIA 10/17/2006 15:30:07 PAGE 4
174 }
175 };
176
177 static int i,j,k;
178 void deleteshape(int number, int x, int y) //删除x,y处number形状
179 {
180 for(i=0;i<4;i++){
181 for(j=0;j<4;j++){
182 if(shape[number].xy[i][j]==1)
183 gamespace[x+i][y+j]=0;
184 }
185 }
186 }
187
188 void drawshape(int number , int x, int y) //增加x,y处number形状
189 {
190 1 for(i=0;i<4;i++){
191 2 for(j=0;j<4;j++){
192 3 if(shape[number].xy[i][j]==1)
193 3 gamespace[x+i][y+j]=1;
194 3 }
195 2 }
196 1 }
197
198
199 int Move_Right() //右移一步函数,成功返回1,失败返回0
200 {
201 1 deleteshape(currentshape.shape_No, currentshape.x, currentshape.y); //先删除
202 1 for(i=0;i<4;i++){
203 2 for(j=0;j<4;j++){
204 3 if((gamespace[currentshape.x+i][currentshape.y+j+1]==1)&&(shape[currentshape.shape_No].xy[i][j]==1))
205 3 { //冲突检测
206 4 drawshape(currentshape.shape_No, currentshape.x, currentshape.y); //有冲突,再画上
207 4 return(0);
208 4 }
209 3 }
210 2 }
211 1 currentshape.y++; //无冲突,调整位置
212 1 drawshape(currentshape.shape_No, currentshape.x, currentshape.y); //在新位置画图,完成移动
213 1 return(1);
214 1 }
215
216 int Move_Left() //左移一步函数,成功返回1,失败返回0
217 {
218 1 deleteshape(currentshape.shape_No, currentshape.x, currentshape.y); //先删除
219 1 for(i=0;i<4;i++){
220 2 for(j=0;j<4;j++){
221 3 if((gamespace[currentshape.x+i][currentshape.y+j-1]==1)&&(shape[currentshape.shape_No].xy[i][j]==1))
222 3 { //冲突检测
223 4 drawshape(currentshape.shape_No, currentshape.x, currentshape.y); //有冲突,再画上
224 4 return(0);
225 4 }
226 3 }
227 2 }
228 1 currentshape.y--; //无冲突,调整位置
229 1 drawshape(currentshape.shape_No, currentshape.x, currentshape.y); //在新位置画图,完成移动
230 1 return(1);
231 1 }
232
233 int Move_Down() //下移一步函数,成功返回1,失败返回0
234 {
235 1 deleteshape(currentshape.shape_No, currentshape.x, currentshape.y); //先删除
C51 COMPILER V7.06 RUSSIA 10/17/2006 15:30:07 PAGE 5
236 1 for(i=0;i<4;i++){
237 2 for(j=0;j<4;j++){
238 3 if((gamespace[currentshape.x+i+1][currentshape.y+j]==1)&&(shape[currentshape.shape_No].xy[i][j]==1))
239 3 { //冲突检测
240 4 drawshape(currentshape.shape_No, currentshape.x, currentshape.y); //有冲突,再画上
241 4 return(0);
242 4 }
243 3 }
244 2 }
245 1 currentshape.x++;
246 1 drawshape(currentshape.shape_No, currentshape.x, currentshape.y);
247 1 return(1);
248 1 }
249
250 int Turn_Round() //变形函数,成功返回1,失败返回0
251 {
252 1 deleteshape(currentshape.shape_No, currentshape.x, currentshape.y);
253 1 for(i=0;i<4;i++){
254 2 for(j=0;j<4;j++){
255 3 if((gamespace[currentshape.x+i][currentshape.y+j]==1)&&(shape[currentshape.next].xy[i][j]==1))
256 3 {
257 4 drawshape(currentshape.shape_No, currentshape.x, currentshape.y);
258 4 return(0);
259 4 }
260 3 }
261 2 }
262 1 currentshape.shape_No=currentshape.next;
263 1 currentshape.next=shape[currentshape.shape_No].next;
264 1 drawshape(currentshape.shape_No, currentshape.x, currentshape.y);
265 1 return(1);
266 1 }
267
268 int CreateShape() //在顶端生成新方块.成功返回1,失败返回0(GAME OVER)
269 {
270 1 currentshape.shape_No=nextshape_No;
271 1 nextshape_No=(counter%19);
272 1 currentshape.x=0;
273 1 currentshape.y=4;
274 1 currentshape.next=shape[currentshape.shape_No].next;
275 1 for(i=0;i<4;i++){
276 2 for(j=0;j<4;j++){
277 3 if((gamespace[currentshape.x+i][currentshape.y+j]==1)&&(shape[currentshape.shape_No].xy[i][j]==1))
278 3 {
279 4 return(0);
280 4 }
281 3 }
282 2 }
283 1 drawshape(currentshape.shape_No, currentshape.x, currentshape.y);
284 1 return(1);
285 1 }
286
287 int ClearLine() //检验是否有满行需要删除,得分返回1,无动作返回0
288 {
289 1 int flag=0;
290 1 unsigned char sum;
291 1 for(i=0;i<24;i++) //从上至下 逐行检测
292 1 {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -