8 unsigned char sprite
[256*256];
9 unsigned char light
[256*256];
10 unsigned char picture
[64000];
11 unsigned char palette
[960];
15 #define ARG_TEMPLATE "WINPOSX=X/N/K,WINPOSY=Y/N/K"
20 static IPTR args
[NUM_ARGS
];
22 static void getarguments(void)
24 struct RDArgs
*myargs
;
26 if ((myargs
= ReadArgs(ARG_TEMPLATE
, args
, NULL
)))
31 WORD winx
= *(IPTR
*)args
[ARG_X
];
33 snprintf(s
, sizeof(s
), "%d", winx
);
34 SetVar("WINPOSX", s
, strlen(s
), GVF_LOCAL_ONLY
| LV_VAR
);
40 WORD winy
= *(IPTR
*)args
[ARG_Y
];
42 snprintf(s
, sizeof(s
), "%d", winy
);
43 SetVar("WINPOSY", s
, strlen(s
), GVF_LOCAL_ONLY
| LV_VAR
);
50 void make_sprite(float m
)
54 for (y
=-128; y
<128; y
++)
55 for (x
=-128; x
<128; x
++)
57 val
=255-(sqrt((x
*x
)+(y
*y
))*m
);
59 sprite
[256*(y
+128)+(x
+128)]=val
;
61 sprite
[256*(y
+128)+(x
+128)]=0;
67 KDPreadBMP("bmp/shade1.bmp",palette
,picture
);
68 KDPreadBMP("bmp/shade2.bmp",palette
,pic
);
71 void make_lightpicture(int xpos
, int ypos
)
74 memset(light
, 0, 256*256);
78 light
[(320*(ypos
+y
)+(xpos
+x
))& 0xffff]=sprite
[256*y
+x
];
93 for(o
=320;o
<64000;o
++)
95 //xdelta=picture[o-1]-picture[o];
96 //ydelta=(picture[o-320]-picture[o])*320;
97 //vmem[o]=KDPcgcoltab[(pic[o]<<8)+light[(o+xdelta+ydelta)&0xffff]];
99 ydelta
=((*(p
-320))-(*p
))*320;
101 *(vm
++)=KDPcgcoltab
[((*(pc
++))<<8)+light
[(o
+xdelta
+ydelta
)&0xffff]];
107 int main(int argc
, char **argv
)
112 float xx
= 0.0,yy
= 0.0;
119 KDPmakecoltab1(palette
);
121 if (KDPopen(&screen
))
127 while(mouse
.button
!=3)
129 make_lightpicture(mx
, my
);