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