static void paintown_draw_sprite_ex16( BITMAP * dst, BITMAP * src, int dx, int dy, int mode, int flip );
static void paintown_light16(BITMAP * dst, const int x, const int y, const int width, const int height, const int start_y, const int focus_alpha, const int edge_alpha, const int focus_color, const int edge_color);
static void paintown_applyTrans16(BITMAP * dst, const int color);
const int Bitmap::MaskColor = MASK_COLOR_16;
const int Bitmap::MODE_TRANS = 0;
const int Bitmap::MODE_SOLID = 1;
const int Bitmap::SPRITE_NO_FLIP = 0;
const int Bitmap::SPRITE_V_FLIP = 1;
const int Bitmap::SPRITE_H_FLIP = 2;
const int Bitmap::SPRITE_NORMAL = 1;
const int Bitmap::SPRITE_LIT = 2;
const int Bitmap::SPRITE_TRANS = 3;
Bitmap * Bitmap::Screen = NULL;
Bitmap * Scaler = NULL;
Bitmap * Buffer = NULL;
Bitmap::Bitmap():
own( NULL ),
error( false ){
setBitmap( create_bitmap( 10, 10 ) );
if ( ! getBitmap() ){
error = true;
cerr << "Could not create bitmap!" << endl;
} else {
clear();
own = new int;
*own = 1;
}
}
Bitmap::Bitmap( int x, int y ):
own( NULL ),
error( false ){
if ( x < 1 ){
x = 1;
}
if ( y < 1 ){
y = 1;
}
setBitmap( create_bitmap( x, y ) );
if ( ! getBitmap() ){
error = true;
cerr << "Could not create bitmap!" << endl;
} else {
clear();
own = new int;
*own = 1;
}
}
/* If a BITMAP is given to us, we didn't make it so we don't own it */
void Bitmap::Stretch( const Bitmap & where, const int sourceX, const int sourceY, const int sourceWidth, const int sourceHeight, const int destX, const int destY, const int destWidth, const int destHeight ) const {
/* defined at allegro/include/internal/aintern.h:466 */
extern EXTERNAL_VARIABLE int _blender_col_16;
/* defined at allegro/include/internal/aintern.h:470 */
extern EXTERNAL_VARIABLE int _blender_alpha;
static void paintown_draw_sprite_ex16( BITMAP * dst, BITMAP * src, int dx, int dy, int mode, int flip ){
- int x, y, w, h;
- int x_dir = 1, y_dir = 1;
- int dxbeg, dybeg;
- int sxbeg, sybeg;
- PAINTOWN_DLS_BLENDER lit_blender;
- PAINTOWN_DTS_BLENDER trans_blender;
-
- ASSERT(dst);
- ASSERT(src);
-
- if ( flip & Bitmap::SPRITE_V_FLIP ){
- y_dir = -1;
- }
- if ( flip & Bitmap::SPRITE_H_FLIP ){
- x_dir = -1;
- }
-
- if (dst->clip) {
- int tmp;
-
- tmp = dst->cl - dx;
- sxbeg = ((tmp < 0) ? 0 : tmp);
- dxbeg = sxbeg + dx;
-
- tmp = dst->cr - dx;
- w = ((tmp > src->w) ? src->w : tmp) - sxbeg;
- if (w <= 0)
- return;
-
- if ( flip & Bitmap::SPRITE_H_FLIP ){
- /* use backward drawing onto dst */
- sxbeg = src->w - (sxbeg + w);
- dxbeg += w - 1;
- }
-
- tmp = dst->ct - dy;
- sybeg = ((tmp < 0) ? 0 : tmp);
- dybeg = sybeg + dy;
-
- tmp = dst->cb - dy;
- h = ((tmp > src->h) ? src->h : tmp) - sybeg;
- if (h <= 0)
- return;
-
- if ( flip & Bitmap::SPRITE_V_FLIP ){
- /* use backward drawing onto dst */
- sybeg = src->h - (sybeg + h);
- dybeg += h - 1;
- }
- } else {
- w = src->w;
- h = src->h;
- sxbeg = 0;
- sybeg = 0;
- dxbeg = dx;
- if ( flip & Bitmap::SPRITE_H_FLIP ){
- dxbeg = dx + w - 1;
- }
- dybeg = dy;
- if ( flip & Bitmap::SPRITE_V_FLIP ){
- dybeg = dy + h - 1;
- }
- }
-
- lit_blender = PAINTOWN_MAKE_DLS_BLENDER(0);
- trans_blender = PAINTOWN_MAKE_DTS_BLENDER();
-
- if (dst->id & (BMP_ID_VIDEO | BMP_ID_SYSTEM)) {
- bmp_select(dst);
-
- switch (mode){
- case Bitmap::SPRITE_NORMAL : {
- for (y = 0; y < h; y++) {
- PAINTOWN_PIXEL_PTR s = PAINTOWN_OFFSET_PIXEL_PTR(src->line[sybeg + y], sxbeg);
- PAINTOWN_PIXEL_PTR d = PAINTOWN_OFFSET_PIXEL_PTR(bmp_write_line(dst, dybeg + y * y_dir), dxbeg);
- for (x = w - 1; x >= 0; PAINTOWN_INC_PIXEL_PTR(s), PAINTOWN_INC_PIXEL_PTR_EX(d,x_dir), x--) {
-
- unsigned long c = PAINTOWN_GET_MEMORY_PIXEL(s);
- if (!PAINTOWN_IS_SPRITE_MASK(src, c)) {
- PAINTOWN_PUT_PIXEL(d, c);
- }
- }
- }
+ int x, y, w, h;
+ int x_dir = 1, y_dir = 1;
+ int dxbeg, dybeg;
+ int sxbeg, sybeg;
+ PAINTOWN_DLS_BLENDER lit_blender;
+ PAINTOWN_DTS_BLENDER trans_blender;
+
+ ASSERT(dst);
+ ASSERT(src);
+
+ if ( flip & Bitmap::SPRITE_V_FLIP ){
+ y_dir = -1;
+ }
+ if ( flip & Bitmap::SPRITE_H_FLIP ){
+ x_dir = -1;
+ }
+
+ if (dst->clip) {
+ int tmp;
+
+ tmp = dst->cl - dx;
+ sxbeg = ((tmp < 0) ? 0 : tmp);
+ dxbeg = sxbeg + dx;
+
+ tmp = dst->cr - dx;
+ w = ((tmp > src->w) ? src->w : tmp) - sxbeg;
+ if (w <= 0)
+ return;
- break;
+ if ( flip & Bitmap::SPRITE_H_FLIP ){
+ /* use backward drawing onto dst */
+ sxbeg = src->w - (sxbeg + w);
+ dxbeg += w - 1;
}
- case Bitmap::SPRITE_LIT : {
- for (y = 0; y < h; y++) {
- PAINTOWN_PIXEL_PTR s = PAINTOWN_OFFSET_PIXEL_PTR(src->line[sybeg + y], sxbeg);
- PAINTOWN_PIXEL_PTR d = PAINTOWN_OFFSET_PIXEL_PTR(bmp_write_line(dst, dybeg + y * y_dir), dxbeg);
- for (x = w - 1; x >= 0; PAINTOWN_INC_PIXEL_PTR(s), PAINTOWN_INC_PIXEL_PTR_EX(d,x_dir), x--) {
-
- unsigned long c = PAINTOWN_GET_MEMORY_PIXEL(s);
- if (!PAINTOWN_IS_SPRITE_MASK(src, c)) {
- c = PAINTOWN_DLSX_BLEND(lit_blender, c);
- PAINTOWN_PUT_PIXEL(d, c);
- }
- }
- }
- break;
+
+ tmp = dst->ct - dy;
+ sybeg = ((tmp < 0) ? 0 : tmp);
+ dybeg = sybeg + dy;
+
+ tmp = dst->cb - dy;
+ h = ((tmp > src->h) ? src->h : tmp) - sybeg;
+ if (h <= 0)
+ return;
+
+ if ( flip & Bitmap::SPRITE_V_FLIP ){
+ /* use backward drawing onto dst */
+ sybeg = src->h - (sybeg + h);
+ dybeg += h - 1;
}
- case Bitmap::SPRITE_TRANS : {
- for (y = 0; y < h; y++) {
- PAINTOWN_PIXEL_PTR s = PAINTOWN_OFFSET_PIXEL_PTR(src->line[sybeg + y], sxbeg);
- PAINTOWN_PIXEL_PTR d = PAINTOWN_OFFSET_PIXEL_PTR(bmp_write_line(dst, dybeg + y * y_dir), dxbeg);
- for (x = w - 1; x >= 0; PAINTOWN_INC_PIXEL_PTR(s), PAINTOWN_INC_PIXEL_PTR_EX(d,x_dir), x--) {
-
- unsigned long c = PAINTOWN_GET_MEMORY_PIXEL(s);
- if (!PAINTOWN_IS_SPRITE_MASK(src, c)) {
- c = PAINTOWN_DTS_BLEND(trans_blender, PAINTOWN_GET_PIXEL(d), c);
- PAINTOWN_PUT_PIXEL(d, c);
- }
- }
- }
- break;
+ } else {
+ w = src->w;
+ h = src->h;
+ sxbeg = 0;
+ sybeg = 0;
+ dxbeg = dx;
+ if ( flip & Bitmap::SPRITE_H_FLIP ){
+ dxbeg = dx + w - 1;
+ }
+ dybeg = dy;
+ if ( flip & Bitmap::SPRITE_V_FLIP ){
+ dybeg = dy + h - 1;
}
- }
+ }
-#if 0
- for (y = 0; y < h; y++) {
- PAINTOWN_PIXEL_PTR s = PAINTOWN_OFFSET_PIXEL_PTR(src->line[sybeg + y], sxbeg);
-
- /* flipped if y_dir is -1 */
- PAINTOWN_PIXEL_PTR d = PAINTOWN_OFFSET_PIXEL_PTR(bmp_write_line(dst, dybeg + y * y_dir), dxbeg);
-
- /* d is incremented by x_dir, -1 if flipped */
- for (x = w - 1; x >= 0; PAINTOWN_INC_PIXEL_PTR(s), PAINTOWN_INC_PIXEL_PTR_EX(d,x_dir), x--) {
- unsigned long c = PAINTOWN_GET_MEMORY_PIXEL(s);
- if (!PAINTOWN_IS_SPRITE_MASK(src, c)) {
- switch( mode ){
- case Bitmap::SPRITE_NORMAL : break;
- case Bitmap::SPRITE_LIT : {
- c = PAINTOWN_DLSX_BLEND(lit_blender, c);
- break;
- case Bitmap::SPRITE_TRANS : {
- c = PAINTOWN_DTS_BLEND(trans_blender, PAINTOWN_GET_PIXEL(d), c);
- break;
- }
- }
- }
- PAINTOWN_PUT_PIXEL(d, c);
- }
- }
- }
-#endif
+ lit_blender = PAINTOWN_MAKE_DLS_BLENDER(0);
+ trans_blender = PAINTOWN_MAKE_DTS_BLENDER();
- bmp_unwrite_line(dst);
- }
- else {
+ if (dst->id & (BMP_ID_VIDEO | BMP_ID_SYSTEM)) {
+ bmp_select(dst);
+#if 0
switch (mode){
case Bitmap::SPRITE_NORMAL : {
- for (y = 0; y < h; y++) {
- PAINTOWN_PIXEL_PTR s = PAINTOWN_OFFSET_PIXEL_PTR(src->line[sybeg + y], sxbeg);
- PAINTOWN_PIXEL_PTR d = PAINTOWN_OFFSET_PIXEL_PTR(bmp_write_line(dst, dybeg + y * y_dir), dxbeg);
-
- for (x = w - 1; x >= 0; PAINTOWN_INC_PIXEL_PTR(s), PAINTOWN_INC_PIXEL_PTR_EX(d,x_dir), x--) {
- unsigned long c = PAINTOWN_GET_MEMORY_PIXEL(s);
- if (!PAINTOWN_IS_SPRITE_MASK(src, c)) {
- PAINTOWN_PUT_MEMORY_PIXEL(d, c);
- }
- }
- }
-
- break;
- }
+ for (y = 0; y < h; y++) {
+ PAINTOWN_PIXEL_PTR s = PAINTOWN_OFFSET_PIXEL_PTR(src->line[sybeg + y], sxbeg);
+ PAINTOWN_PIXEL_PTR d = PAINTOWN_OFFSET_PIXEL_PTR(bmp_write_line(dst, dybeg + y * y_dir), dxbeg);
+ for (x = w - 1; x >= 0; PAINTOWN_INC_PIXEL_PTR(s), PAINTOWN_INC_PIXEL_PTR_EX(d,x_dir), x--) {
+
+ unsigned long c = PAINTOWN_GET_MEMORY_PIXEL(s);
+ if (!PAINTOWN_IS_SPRITE_MASK(src, c)) {
+ PAINTOWN_PUT_PIXEL(d, c);
+ }
+ }
+ }
+
+ break;
+ }
case Bitmap::SPRITE_LIT : {
- for (y = 0; y < h; y++) {
- PAINTOWN_PIXEL_PTR s = PAINTOWN_OFFSET_PIXEL_PTR(src->line[sybeg + y], sxbeg);
- PAINTOWN_PIXEL_PTR d = PAINTOWN_OFFSET_PIXEL_PTR(bmp_write_line(dst, dybeg + y * y_dir), dxbeg);
-
- for (x = w - 1; x >= 0; PAINTOWN_INC_PIXEL_PTR(s), PAINTOWN_INC_PIXEL_PTR_EX(d,x_dir), x--) {
- unsigned long c = PAINTOWN_GET_MEMORY_PIXEL(s);
- if (!PAINTOWN_IS_SPRITE_MASK(src, c)) {
- c = PAINTOWN_DLSX_BLEND(lit_blender, c);
- PAINTOWN_PUT_MEMORY_PIXEL(d, c);
- }
+ for (y = 0; y < h; y++) {
+ PAINTOWN_PIXEL_PTR s = PAINTOWN_OFFSET_PIXEL_PTR(src->line[sybeg + y], sxbeg);
+ PAINTOWN_PIXEL_PTR d = PAINTOWN_OFFSET_PIXEL_PTR(bmp_write_line(dst, dybeg + y * y_dir), dxbeg);
+ for (x = w - 1; x >= 0; PAINTOWN_INC_PIXEL_PTR(s), PAINTOWN_INC_PIXEL_PTR_EX(d,x_dir), x--) {
+
+ unsigned long c = PAINTOWN_GET_MEMORY_PIXEL(s);
+ if (!PAINTOWN_IS_SPRITE_MASK(src, c)) {
+ c = PAINTOWN_DLSX_BLEND(lit_blender, c);
+ PAINTOWN_PUT_PIXEL(d, c);
+ }
+ }
+ }
+ break;
+ }
+ case Bitmap::SPRITE_TRANS : {
+ for (y = 0; y < h; y++) {
+ PAINTOWN_PIXEL_PTR s = PAINTOWN_OFFSET_PIXEL_PTR(src->line[sybeg + y], sxbeg);
+ PAINTOWN_PIXEL_PTR d = PAINTOWN_OFFSET_PIXEL_PTR(bmp_write_line(dst, dybeg + y * y_dir), dxbeg);
+ for (x = w - 1; x >= 0; PAINTOWN_INC_PIXEL_PTR(s), PAINTOWN_INC_PIXEL_PTR_EX(d,x_dir), x--) {
+
+ unsigned long c = PAINTOWN_GET_MEMORY_PIXEL(s);
+ if (!PAINTOWN_IS_SPRITE_MASK(src, c)) {
+ c = PAINTOWN_DTS_BLEND(trans_blender, PAINTOWN_GET_PIXEL(d), c);
+ PAINTOWN_PUT_PIXEL(d, c);
+ }
+ }
+ }
+ break;
+ }
+ }
+#endif
+
+ for (y = 0; y < h; y++) {
+ PAINTOWN_PIXEL_PTR s = PAINTOWN_OFFSET_PIXEL_PTR(src->line[sybeg + y], sxbeg);
+
+ /* flipped if y_dir is -1 */
+ PAINTOWN_PIXEL_PTR d = PAINTOWN_OFFSET_PIXEL_PTR(bmp_write_line(dst, dybeg + y * y_dir), dxbeg);
+
+ /* d is incremented by x_dir, -1 if flipped */
+ for (x = w - 1; x >= 0; PAINTOWN_INC_PIXEL_PTR(s), PAINTOWN_INC_PIXEL_PTR_EX(d,x_dir), x--) {
+ unsigned long c = PAINTOWN_GET_MEMORY_PIXEL(s);
+ if (!PAINTOWN_IS_SPRITE_MASK(src, c)) {
+ switch( mode ){
+ case Bitmap::SPRITE_NORMAL : break;
+ case Bitmap::SPRITE_LIT : {
+ c = PAINTOWN_DLSX_BLEND(lit_blender, c);
+ break;
+ }
+ case Bitmap::SPRITE_TRANS : {
+ c = PAINTOWN_DTS_BLEND(trans_blender, PAINTOWN_GET_PIXEL(d), c);
+ break;
+ }
}
+ PAINTOWN_PUT_PIXEL(d, c);
}
- break;
}
+ }
+
+ bmp_unwrite_line(dst);
+ }
+ else {
+
+ switch (mode){
+ case Bitmap::SPRITE_NORMAL : {
+ for (y = 0; y < h; y++) {
+ PAINTOWN_PIXEL_PTR s = PAINTOWN_OFFSET_PIXEL_PTR(src->line[sybeg + y], sxbeg);
+ PAINTOWN_PIXEL_PTR d = PAINTOWN_OFFSET_PIXEL_PTR(bmp_write_line(dst, dybeg + y * y_dir), dxbeg);
+
+ for (x = w - 1; x >= 0; PAINTOWN_INC_PIXEL_PTR(s), PAINTOWN_INC_PIXEL_PTR_EX(d,x_dir), x--) {
+ unsigned long c = PAINTOWN_GET_MEMORY_PIXEL(s);
+ if (!PAINTOWN_IS_SPRITE_MASK(src, c)) {
+ PAINTOWN_PUT_MEMORY_PIXEL(d, c);
+ }
+ }
+ }
+
+ break;
+ }
+ case Bitmap::SPRITE_LIT : {
+ for (y = 0; y < h; y++) {
+ PAINTOWN_PIXEL_PTR s = PAINTOWN_OFFSET_PIXEL_PTR(src->line[sybeg + y], sxbeg);
+ PAINTOWN_PIXEL_PTR d = PAINTOWN_OFFSET_PIXEL_PTR(bmp_write_line(dst, dybeg + y * y_dir), dxbeg);
+
+ for (x = w - 1; x >= 0; PAINTOWN_INC_PIXEL_PTR(s), PAINTOWN_INC_PIXEL_PTR_EX(d,x_dir), x--) {
+ unsigned long c = PAINTOWN_GET_MEMORY_PIXEL(s);
+ if (!PAINTOWN_IS_SPRITE_MASK(src, c)) {
+ c = PAINTOWN_DLSX_BLEND(lit_blender, c);
+ PAINTOWN_PUT_MEMORY_PIXEL(d, c);
+ }
+ }
+ }
+ break;
+ }
case Bitmap::SPRITE_TRANS : {
- for (y = 0; y < h; y++) {
- PAINTOWN_PIXEL_PTR s = PAINTOWN_OFFSET_PIXEL_PTR(src->line[sybeg + y], sxbeg);
- PAINTOWN_PIXEL_PTR d = PAINTOWN_OFFSET_PIXEL_PTR(bmp_write_line(dst, dybeg + y * y_dir), dxbeg);
-
- for (x = w - 1; x >= 0; PAINTOWN_INC_PIXEL_PTR(s), PAINTOWN_INC_PIXEL_PTR_EX(d,x_dir), x--) {
- unsigned long c = PAINTOWN_GET_MEMORY_PIXEL(s);
- if (!PAINTOWN_IS_SPRITE_MASK(src, c)) {
- c = PAINTOWN_DTS_BLEND(trans_blender, PAINTOWN_GET_PIXEL(d), c);
- PAINTOWN_PUT_MEMORY_PIXEL(d, c);
- }
+ for (y = 0; y < h; y++) {
+ PAINTOWN_PIXEL_PTR s = PAINTOWN_OFFSET_PIXEL_PTR(src->line[sybeg + y], sxbeg);
+ PAINTOWN_PIXEL_PTR d = PAINTOWN_OFFSET_PIXEL_PTR(bmp_write_line(dst, dybeg + y * y_dir), dxbeg);
+
+ for (x = w - 1; x >= 0; PAINTOWN_INC_PIXEL_PTR(s), PAINTOWN_INC_PIXEL_PTR_EX(d,x_dir), x--) {
+ unsigned long c = PAINTOWN_GET_MEMORY_PIXEL(s);
+ if (!PAINTOWN_IS_SPRITE_MASK(src, c)) {
+ c = PAINTOWN_DTS_BLEND(trans_blender, PAINTOWN_GET_PIXEL(d), c);
+ PAINTOWN_PUT_MEMORY_PIXEL(d, c);
+ }
+ }
+ }
+ break;
+ }
+ }
+
+#if 0
+ for (y = 0; y < h; y++) {
+ PAINTOWN_PIXEL_PTR s = PAINTOWN_OFFSET_PIXEL_PTR(src->line[sybeg + y], sxbeg);
+ PAINTOWN_PIXEL_PTR d = PAINTOWN_OFFSET_PIXEL_PTR(bmp_write_line(dst, dybeg + y * y_dir), dxbeg);
+
+ for (x = w - 1; x >= 0; PAINTOWN_INC_PIXEL_PTR(s), PAINTOWN_INC_PIXEL_PTR_EX(d,x_dir), x--) {
+ unsigned long c = PAINTOWN_GET_MEMORY_PIXEL(s);
+ if (!PAINTOWN_IS_SPRITE_MASK(src, c)) {
+ switch( mode ){
+ case Bitmap::SPRITE_NORMAL : break;
+ case Bitmap::SPRITE_LIT : {
+ c = PAINTOWN_DLSX_BLEND(lit_blender, c);
+ break;
+ }
+ case Bitmap::SPRITE_TRANS : {
+ c = PAINTOWN_DTS_BLEND(trans_blender, PAINTOWN_GET_PIXEL(d), c);
+ break;
+ }
}
+ PAINTOWN_PUT_MEMORY_PIXEL(d, c);
}
- break;
}
- }
-
-#if 0
- for (y = 0; y < h; y++) {
- PAINTOWN_PIXEL_PTR s = PAINTOWN_OFFSET_PIXEL_PTR(src->line[sybeg + y], sxbeg);
- PAINTOWN_PIXEL_PTR d = PAINTOWN_OFFSET_PIXEL_PTR(bmp_write_line(dst, dybeg + y * y_dir), dxbeg);
-
- for (x = w - 1; x >= 0; PAINTOWN_INC_PIXEL_PTR(s), PAINTOWN_INC_PIXEL_PTR_EX(d,x_dir), x--) {
- unsigned long c = PAINTOWN_GET_MEMORY_PIXEL(s);
- if (!PAINTOWN_IS_SPRITE_MASK(src, c)) {
- switch( mode ){
- case Bitmap::SPRITE_NORMAL : break;
- case Bitmap::SPRITE_LIT : {
- c = PAINTOWN_DLSX_BLEND(lit_blender, c);
- break;
- case Bitmap::SPRITE_TRANS : {
- c = PAINTOWN_DTS_BLEND(trans_blender, PAINTOWN_GET_PIXEL(d), c);
- break;
- }
- }
- }
- PAINTOWN_PUT_MEMORY_PIXEL(d, c);
- }
- }
- }
+ }
#endif
- }
+ }
}
/* mix pixels with the given color in with each non-masking pixel in dst */
static void paintown_applyTrans16(BITMAP * dst, const int color){
int y1 = 0;
int y2 = dst->h;
int x1 = 0;
int x2 = dst->w - 1;
if (dst->clip){
y1 = dst->ct;
y2 = dst->cb - 1;
x1 = dst->cl;
x2 = dst->cr - 1;
}
PAINTOWN_DTS_BLENDER trans_blender;
trans_blender = PAINTOWN_MAKE_DTS_BLENDER();
if (dst->id & (BMP_ID_VIDEO | BMP_ID_SYSTEM)) {
} else {
for (int y = y1; y < y2; y++) {
PAINTOWN_PIXEL_PTR d = PAINTOWN_OFFSET_PIXEL_PTR(bmp_write_line(dst, y), x1);
for (int x = x2; x >= x1; PAINTOWN_INC_PIXEL_PTR_EX(d,1), x--) {
unsigned long c = PAINTOWN_GET_MEMORY_PIXEL(d);
if (!PAINTOWN_IS_SPRITE_MASK(dst, c)) {
c = PAINTOWN_DTS_BLEND(trans_blender, color, c);
PAINTOWN_PUT_MEMORY_PIXEL(d, c);
}
}
}
}
}
/* ultra special-case for drawing a light (like from a lamp).
* center of light is x,y and shines in a perfect isosolese triangle.
*/
static void paintown_light16(BITMAP * dst, const int x, const int y, const int width, const int height, const int start_y, const int focus_alpha, const int edge_alpha, const int focus_color, const int edge_color){
int dxbeg = x - width;
int x_dir = 1;
unsigned char * alphas = new unsigned char[width];