/[projet1]/public/oric/demos/30years/part_hires_picture/main.c
Defence Force logotype

Contents of /public/oric/demos/30years/part_hires_picture/main.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1120 - (show annotations)
Sat Mar 29 20:13:28 2014 UTC (5 years, 8 months ago) by dbug
File MIME type: text/plain
File size: 3547 byte(s)
Born In 1983 v1.1
- Added the nfo file
- Modified the code to use the new floppy builder
- Fixed a minor bug in the rasters in the intro
1 //
2 // This program simply display a picture on the hires screen
3 //
4 //#include <demosystem.h>
5 #include <lib.h>
6
7 // irq.s
8 extern void System_InstallIRQ_SimpleVbl();
9 extern void System_RemoveIRQ();
10 extern void VSync();
11
12 // player.s
13 extern void Player_Initialize();
14 extern void Player_PlayFrame();
15 extern void Player_PlayNote();
16 extern void Player_PlayPause();
17 extern void Player_Silence();
18
19 extern unsigned int player_note;
20
21 extern unsigned char LabelPicture[];
22 extern unsigned char LabelPictureXnitzy[];
23 extern unsigned char LabelPictureOops[];
24
25 extern unsigned char RedRasters[];
26 extern unsigned char BlackRasters[];
27 extern unsigned char MultiRasters[];
28
29 unsigned char RasterPos=0;
30 unsigned char GlobalShowY;
31
32 void Rasters()
33 {
34 if (GlobalShowY<44)
35 {
36 unsigned char* screen;
37 int y,maxy;
38 int i,j,k;
39
40 screen=(unsigned char*)0xa000+40*44;
41
42 i=RasterPos;
43 j=RasterPos;
44 k=RasterPos;
45
46 maxy=(44-GlobalShowY)/2;
47 if (maxy>18)
48 {
49 maxy=18;
50 }
51
52 for (y=0;y<maxy;y++)
53 {
54 screen[1]=RedRasters[j&15];
55 screen[15]=MultiRasters[k&31];
56 screen-=40;
57 k++;
58
59 screen[1]=BlackRasters[i&15];
60 screen[15]=MultiRasters[k&31];
61 screen-=40;
62 k++;
63
64 i++;
65 j--;
66 }
67 RasterPos++;
68 }
69 }
70
71 void Pause()
72 {
73 VSync();
74 /*
75 int i;
76
77 for (i=0;i<500;i++)
78 {
79
80 }
81 */
82 }
83
84 void PatchPicture()
85 {
86 unsigned char* ptr;
87 int y;
88 ptr=LabelPicture;
89 for (y=0;y<200;y++)
90 {
91 ptr[0]=0;
92 //ptr[1]=7;
93 ptr+=40;
94 }
95 }
96
97 void ShowPicture()
98 {
99 unsigned char* ptr;
100
101 ptr=(unsigned char*)0xa000+200*40;
102
103 GlobalShowY=200;
104 while (GlobalShowY)
105 {
106 Pause();
107 ptr-=40;
108
109 ptr[0-40*4]=16+4;
110 ptr[1-40*4]=1;
111
112 ptr[0-40*3]=16+4;
113 ptr[1-40*3]=1;
114
115 ptr[0-40*2]=16+6;
116 ptr[1-40*2]=3;
117
118 ptr[0-40*1]=16+6;
119 ptr[1-40*1]=3;
120
121 ptr[0]=16+7;
122 ptr[1]=0;
123
124 Rasters();
125
126 GlobalShowY--;
127 }
128 }
129
130
131 unsigned char StarOffsets[]=
132 {
133 10,
134 22,
135 24,
136 16,
137 12,
138 19,
139 34,
140 8,
141 32,
142 3,
143 2,
144 39,
145 28,
146 35,
147 4,
148 14,
149 5,
150 7,
151 0,
152 25,
153 23,
154 37,
155 20,
156 13,
157 6,
158 36,
159 29,
160 18,
161 33,
162 11,
163 27,
164 31,
165 15,
166 17,
167 21,
168 1,
169 9,
170 38,
171 30,
172 26,
173 };
174
175 unsigned char StarColors[]=
176 {
177 16+7,
178 16+6,
179 16+4,
180 16+0,
181 };
182
183 int StarGlobalOffset;
184
185 void StarField()
186 {
187 int y;
188 unsigned char* ptr;
189 int x,xx,color;
190 int xxx;
191
192 memset((unsigned char*)0xa000,0,8000);
193 memcpy((unsigned char*)0xa000,LabelPictureXnitzy,8000);
194
195 while (StarGlobalOffset>-150)
196 {
197 ptr=(unsigned char*)0xa000+4;
198 for (y=0;y<20;y++)
199 {
200 x=(StarOffsets[y]+StarGlobalOffset);
201 for (xx=0;xx<4;xx++)
202 {
203 xxx=x+xx;
204 if (xxx>39)
205 {
206 xxx=0;
207 }
208 color=StarColors[xx];
209 ptr[xxx]=color;
210 }
211 ptr+=40*10;
212 }
213
214 StarGlobalOffset--;
215 }
216
217 memcpy((unsigned char*)0xa000,LabelPictureOops,8000);
218 for (y=0;y<100;y++)
219 {
220 VSync();
221 }
222 }
223
224 extern void Player_SetMusic_Birthday();
225
226 void main()
227 {
228 int y;
229 /*
230 if (!is_overlay_enabled())
231 {
232 hires();
233 }
234 */
235 System_InstallIRQ_SimpleVbl();
236
237 // Show the Xnitzy && Xnutzi animation
238 StarField();
239
240 // Hide all the colors of the picture
241 PatchPicture();
242
243 // Display the black picture
244 memcpy((unsigned char*)0xa000,LabelPicture,8000);
245
246 // Change the music to HappyBirthday
247 Player_SetMusic_Birthday();
248
249 // Make the picture appear with some gradient
250 ShowPicture();
251
252 for (y=0;y<200;y++)
253 {
254 Rasters();
255 Pause();
256 }
257 memset((unsigned char*)0xa000,0,8000);
258
259 System_RemoveIRQ();
260 }
261

  ViewVC Help
Powered by ViewVC 1.1.26