File size: 4,544 Bytes
806d4b5 | 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 |
/*
This is one of the oldest songs. I picked
the random name "risen" and said to God
"Oh, you're ambitious," thinking it was
an epic name. He laughed and gave an
epic song!
*/
<1>/* Graphics Not Rendered in HTML */
<2>/* Graphics Not Rendered in HTML */
<3>/* Graphics Not Rendered in HTML */
<4>/* Graphics Not Rendered in HTML */
F64 t0=Beat;
#define WING 24
#define BODY 8
U0 Bird(CDC *dc,F64 wing_theta)
{
CD3I32 p[3];
dc->color=WHITE;
p[0].x=0; p[0].y=0; p[0].z=-BODY;
p[1].x=0; p[1].y=0; p[1].z=BODY;
p[2].x=-WING*Cos(wing_theta); p[2].y=-WING*Sin(wing_theta); p[2].z=0;
GrFillPoly3(dc,3,p);
p[0].x=0; p[0].y=0; p[0].z=-BODY;
p[1].x=0; p[1].y=0; p[1].z=BODY;
p[2].x=WING*Cos(wing_theta); p[2].y=-WING*Sin(wing_theta); p[2].z=0;
GrFillPoly3(dc,3,p);
dc->color=ROPF_DITHER+WHITE<<16+LTGRAY;
dc->thick=3;
GrLine3(dc,0,0,-BODY,0,0,BODY);
}
#define SCALE 115
#define ARM 112
#define CHAIN 100
#define CUP 28
#define TILT -.25
#define ARM_Y -(0.93*CHAIN)
#define ARM_Z -45
#define BIRDS_NUM 7
#define RANGE 40
F64 bx[BIRDS_NUM],by[BIRDS_NUM];
U0 DrawIt(CTask *task,CDC *dc)
{
I64 i;
F64 theta,dt=Beat-t0,d_chain=Sin(pi/64*Sin(pi*dt/4))*CHAIN;
if (t0) {
DCDepthBufAlloc(dc);
dc->flags|=DCF_TRANSFORMATION;
Mat4x4IdentEqu(dc->r);
dc->x=task->pix_width>>1;
dc->y=task->pix_height>>1-SCALE;
dc->z=3*GR_Z_ALL>>1;
Mat4x4RotX(dc->r,TILT);
Mat4x4RotZ(dc->r,pi/64*Sin(pi*dt/4));
Sprite3(dc,0,0,0,<3>);
Mat4x4IdentEqu(dc->r);
dc->x=task->pix_width>>1-ARM;
dc->y=task->pix_height>>1-SCALE+CHAIN-d_chain;
dc->z=3*GR_Z_ALL>>1;
Mat4x4RotX(dc->r,TILT+pi/32*Sin(pi*dt/4));
Mat4x4RotY(dc->r,pi/32*Sin(pi*dt/4));
Sprite3(dc,0,0,0,<2>);
Mat4x4IdentEqu(dc->r);
Mat4x4RotX(dc->r,TILT);
dc->color=BLACK;
GrLine3(dc,0,ARM_Y,ARM_Z,0,0,0.707*CUP);
GrLine3(dc,0,ARM_Y,ARM_Z,CUP,0,-0.707*CUP);
GrLine3(dc,0,ARM_Y,ARM_Z,-CUP,0,-0.707*CUP);
Mat4x4IdentEqu(dc->r);
dc->x=task->pix_width>>1+ARM;
dc->y=task->pix_height>>1-SCALE+CHAIN+d_chain;
dc->z=3*GR_Z_ALL>>1;
Mat4x4RotX(dc->r,TILT-pi/32*Sin(pi*dt/4));
Mat4x4RotY(dc->r,-pi/32*Sin(pi*dt/4));
Sprite3(dc,0,0,0,<2>);
Mat4x4IdentEqu(dc->r);
Mat4x4RotX(dc->r,TILT);
dc->color=BLACK;
GrLine3(dc,0,ARM_Y,ARM_Z,0,0,0.707*CUP);
GrLine3(dc,0,ARM_Y,ARM_Z,CUP,0,-0.707*CUP);
GrLine3(dc,0,ARM_Y,ARM_Z,-CUP,0,-0.707*CUP);
Mat4x4IdentEqu(dc->r);
dc->x=task->pix_width>>1;
dc->y=task->pix_height>>1;
dc->z=3*GR_Z_ALL>>1;
Mat4x4RotZ(dc->r,0.6-pi/32*Sin(pi*dt/4));
Mat4x4RotX(dc->r,TILT-pi/32*Sin(pi*dt/4));
Mat4x4RotY(dc->r,-pi/32*Sin(pi*dt/4));
Sprite3(dc,0,0,0,<4>);
if (dt>=12.0) {
Mat4x4IdentEqu(dc->r);
dc->x=task->pix_width>>1;
dc->y=task->pix_height>>1;
dc->z=GR_Z_ALL;
Mat4x4Scale(dc->r,.5+.04*dt);
Sprite3(dc,0,0,0,<1>);
}
dc->y=task->pix_height+60;
for (i=0;i<BIRDS_NUM;i++) {
bx[i]=Clamp(bx[i]+0.35*SignI64(RandI16),-RANGE,RANGE);
by[i]=Clamp(by[i]+0.35*SignI64(RandI16),-RANGE,RANGE);
theta=pi/2*i/BIRDS_NUM+0.2*pi*dt+pi/2;
Mat4x4IdentEqu(dc->r);
Mat4x4RotX(dc->r,pi/2);
Mat4x4RotZ(dc->r,theta);
Mat4x4TranslationEqu(dc->r,230*Cos(theta)+bx[i],230*Sin(theta)+by[i],
-(120*i/BIRDS_NUM+16*dt));
Mat4x4RotX(dc->r,0.45*pi+pi);
Bird(dc,Sin(2*pi*dt+i*2*pi/BIRDS_NUM));
}
}
}
U0 TOSTheme()
{
I64 i,old_update=gr.fp_final_scrn_update;
gr.fp_final_scrn_update=NULL;
t0=0;
SettingsPush; //See SettingsPush
AutoComplete;
WinBorder;
WinMax;
WinVert(0,TEXT_ROWS-1,Fs);
DocCursor;
DocClear;
Fs->text_attr=LTCYAN<<4+BLACK;
Fs->draw_it=&DrawIt;
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 2.85;
music.stacatto_factor= 0.902;
for (i=0;i<BIRDS_NUM;i++) {
bx[i]=RANGE*RandI16/RANGE;
by[i]=RANGE*RandI16/RANGE;
}
try {
"$BG+H,LTCYAN$";
Sleep(250);
for (i=0;i<2;i++) {
t0=Beat;
Play("5eDEqFFetEEFqDeCDDEetCGF");
Play("5eDEqFFetEEFqDeCDDEetCGF");
Play("5eDCqDE4eAA5etEEFEDG4B5DCqF");
Play("5eDCqDE4eAA5etEEFEDG4B5DCqF");
}
Sleep(250);
} catch
PutExcept;
SettingsPop;
gr.fp_final_scrn_update=old_update;
}
TOSTheme;
|