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