]> icculus.org git repositories - btb/d2x.git/blob - 2d/tmerge.c
typo
[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 #include <conf.h>
5 #ifdef NO_ASM // If for some reason we have elected not to use assembler...
6
7 #include "gr.h"
8
9 void gr_merge_textures( ubyte * lower, ubyte * upper, ubyte * dest )
10 {
11  int x,y;
12  ubyte c;
13       for (y=0;y<64;y++) for (x=0;x<64;x++) {
14                 c=upper[64*y+x];
15                 if (c==TRANSPARENCY_COLOR)
16                         c=lower[64*y+x];
17                 *dest++=c;
18       }
19 }
20
21 void gr_merge_textures_1( ubyte * lower, ubyte * upper, ubyte * dest )
22 {
23  int x,y;
24  ubyte c;
25         for (y=0; y<64; y++ )
26                 for (x=0; x<64; x++ )   {
27                         c = upper[ 64*x+(63-y) ];
28                         if (c==TRANSPARENCY_COLOR)
29                                 c = lower[ 64*y+x ];
30                         *dest++ = c;
31                 }
32 }
33
34 void gr_merge_textures_2( ubyte * lower, ubyte * upper, ubyte * dest )
35 {
36  int x,y;
37  ubyte c;
38         for (y=0; y<64; y++ )
39                 for (x=0; x<64; x++ )   {
40                         c = upper[ 64*(63-y)+(63-x) ];
41                         if (c==TRANSPARENCY_COLOR)
42                                 c = lower[ 64*y+x ];
43                         *dest++ = c;
44                 }
45 }
46
47 void gr_merge_textures_3( ubyte * lower, ubyte * upper, ubyte * dest )
48 {
49  int x,y;
50  ubyte c;
51         for (y=0; y<64; y++ )
52                 for (x=0; x<64; x++ )   {
53                         c = upper[ 64*(63-x)+y  ];
54                         if (c==TRANSPARENCY_COLOR)
55                                 c = lower[ 64*y+x ];
56                         *dest++ = c;
57                 }
58 }
59
60
61 #endif