]> icculus.org git repositories - btb/d2x.git/blob - 2d/tmerge.c
added .cvsignore files
[btb/d2x.git] / 2d / tmerge.c
1 /* $Id: tmerge.c,v 1.3 2002-07-17 21:55:19 bradleyb Exp $ */
2 /*
3  * tmerge.c - C Texture merge routines for use with D1X
4  * Ripped from ldescent by <dph-man@iname.com>
5  *
6  */
7
8 #ifdef HAVE_CONFIG_H
9 #include <conf.h>
10 #endif
11
12 #include "gr.h"
13
14 void gr_merge_textures( ubyte * lower, ubyte * upper, ubyte * dest )
15 {
16  int x,y;
17  ubyte c;
18       for (y=0;y<64;y++) for (x=0;x<64;x++) {
19                 c=upper[64*y+x];
20                 if (c==TRANSPARENCY_COLOR)
21                         c=lower[64*y+x];
22                 *dest++=c;
23       }
24 }
25
26 void gr_merge_textures_1( ubyte * lower, ubyte * upper, ubyte * dest )
27 {
28  int x,y;
29  ubyte c;
30         for (y=0; y<64; y++ )
31                 for (x=0; x<64; x++ )   {
32                         c = upper[ 64*x+(63-y) ];
33                         if (c==TRANSPARENCY_COLOR)
34                                 c = lower[ 64*y+x ];
35                         *dest++ = c;
36                 }
37 }
38
39 void gr_merge_textures_2( ubyte * lower, ubyte * upper, ubyte * dest )
40 {
41  int x,y;
42  ubyte c;
43         for (y=0; y<64; y++ )
44                 for (x=0; x<64; x++ )   {
45                         c = upper[ 64*(63-y)+(63-x) ];
46                         if (c==TRANSPARENCY_COLOR)
47                                 c = lower[ 64*y+x ];
48                         *dest++ = c;
49                 }
50 }
51
52 void gr_merge_textures_3( ubyte * lower, ubyte * upper, ubyte * dest )
53 {
54  int x,y;
55  ubyte c;
56         for (y=0; y<64; y++ )
57                 for (x=0; x<64; x++ )   {
58                         c = upper[ 64*(63-x)+y  ];
59                         if (c==TRANSPARENCY_COLOR)
60                                 c = lower[ 64*y+x ];
61                         *dest++ = c;
62                 }
63 }