1 /* 2 3 Copyright (C) 2015-2018 Night Dive Studios, LLC. 4 5 This program is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 */ 19 /* 20 * $Source: n:/project/lib/src/2d/RCS/fl8tl8.c $ 21 * $Revision: 1.2 $ 22 * $Author: baf $ 23 * $Date: 1994/01/14 12:40:30 $ 24 * 25 * Routines for drawing flat 8 bitmaps into a flat 8 canvas. 26 * 27 * This file is part of the 2d library. 28 * 29 * $Log: fl8tl8.c $ 30 * Revision 1.2 1994/01/14 12:40:30 baf 31 * Lit translucency reform 32 * 33 * Revision 1.1 1993/12/01 21:17:31 baf 34 * Initial revision 35 * 36 */ 37 38 #include "bitmap.h" 39 #include "cnvdat.h" 40 #include "fl8tf.h" 41 #include "tluctab.h" 42 #include <string.h> 43 flat8_tluc8_ubitmap(grs_bitmap * bm,short x,short y)44void flat8_tluc8_ubitmap(grs_bitmap *bm, short x, short y) { 45 uchar *src; 46 uchar *dst; 47 long w = bm->w; 48 long h = bm->h; 49 long i; 50 long grow = grd_bm.row; 51 long brow = bm->row; 52 53 src = bm->bits; 54 dst = grd_bm.bits + grow * y + x; 55 56 if (bm->flags & BMF_TRANS) 57 while (h--) { 58 for (i = 0; i < w; i++) 59 if (src[i] != 0) { 60 if (tluc8tab[src[i]] == NULL) 61 dst[i] = src[i]; 62 else 63 dst[i] = tluc8tab[src[i]][dst[i]]; 64 } 65 src += brow; 66 dst += grow; 67 } 68 else 69 while (h--) { 70 for (i = 0; i < w; i++) { 71 if (tluc8tab[src[i]] == NULL) 72 dst[i] = src[i]; 73 else 74 dst[i] = tluc8tab[src[i]][dst[i]]; 75 } 76 src += brow; 77 dst += grow; 78 } 79 } 80