these routines are in tmerge.c

This commit is contained in:
Bradley Bell 2002-09-04 22:47:25 +00:00
parent e4bea89105
commit 05f319b532

View file

@ -1,3 +1,4 @@
/* $Id: texmerge.c,v 1.3 2002-09-04 22:47:25 btb Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -7,10 +8,114 @@ IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/
/*
*
* Routines to cache merged textures.
*
* Old Log:
* Revision 1.1 1995/05/16 15:31:36 allender
* Initial revision
*
* Revision 2.0 1995/02/27 11:31:08 john
* New version 2.0, which has no anonymous unions, builds with
* Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
*
* Revision 1.28 1995/01/14 19:16:56 john
* First version of new bitmap paging code.
*
* Revision 1.27 1994/12/14 18:21:58 yuan
* *** empty log message ***
*
* Revision 1.26 1994/12/13 09:50:08 john
* Added Asserts to stop if wall looks like door.
*
* Revision 1.25 1994/12/07 00:35:24 mike
* change how flat shading average color is computed for paste-ons.
*
* Revision 1.24 1994/11/19 15:20:29 mike
* rip out unused code and data
*
* Revision 1.23 1994/11/12 16:38:51 mike
* deal with avg_color in texture merging.
*
* Revision 1.22 1994/11/09 19:55:39 john
* Added full rle support with texture rle caching.
*
* Revision 1.21 1994/10/20 15:21:16 john
* Took out the texmerge caching.
*
* Revision 1.20 1994/10/10 19:00:57 john
* Made caching info print every 1000 frames.
*
* Revision 1.19 1994/10/10 18:41:21 john
* Printed out texture caching info.
*
* Revision 1.18 1994/08/11 18:59:02 mike
* Use new assembler version of merge functions.
*
* Revision 1.17 1994/06/09 12:13:14 john
* Changed selectors so that all bitmaps have a selector of
* 0, but inside the texture mapper they get a selector set.
*
* Revision 1.16 1994/05/14 17:15:15 matt
* Got rid of externs in source (non-header) files
*
* Revision 1.15 1994/05/09 17:21:09 john
* Took out mprintf with cache hits/misses.
*
* Revision 1.14 1994/05/05 12:55:07 john
* Made SuperTransparency work.
*
* Revision 1.13 1994/05/04 11:15:37 john
* Added Super Transparency
*
* Revision 1.12 1994/04/28 23:36:04 john
* Took out a debugging mprintf.
*
* Revision 1.11 1994/04/22 17:44:48 john
* Made top 2 bits of paste-ons pick the
* orientation of the bitmap.
*
* Revision 1.10 1994/03/31 12:05:51 matt
* Cleaned up includes
*
* Revision 1.9 1994/03/15 16:31:52 yuan
* Cleaned up bm-loading code.
* (And structures)
*
* Revision 1.8 1994/01/24 13:15:19 john
* Made caching work with pointers, not texture numbers,
* that way, the animated textures cache.
*
* Revision 1.7 1994/01/21 16:38:10 john
* Took out debug info.
*
* Revision 1.6 1994/01/21 16:28:43 john
* added warning to print cache hit/miss.
*
* Revision 1.5 1994/01/21 16:22:30 john
* Put in caching/
*
* Revision 1.4 1994/01/21 15:34:49 john
* *** empty log message ***
*
* Revision 1.3 1994/01/21 15:33:08 john
* *** empty log message ***
*
* Revision 1.2 1994/01/21 15:15:35 john
* Created new module texmerge, that merges textures together and
* caches the results.
*
* Revision 1.1 1994/01/21 14:55:29 john
* Initial revision
*
*
*/
#ifdef HAVE_CONFIG_H
#include <conf.h>
#endif
@ -210,7 +315,7 @@ grs_bitmap * texmerge_get_cached_bitmap( int tmap_bottom, int tmap_top )
Cache[least_recently_used].bitmap->bm_flags = bitmap_bottom->bm_flags & (~BM_FLAG_RLE);
Cache[least_recently_used].bitmap->avg_color = bitmap_bottom->avg_color;
}
Cache[least_recently_used].top_bmp = bitmap_top;
Cache[least_recently_used].bottom_bmp = bitmap_bottom;
Cache[least_recently_used].last_frame_used = FrameCount;
@ -221,10 +326,6 @@ grs_bitmap * texmerge_get_cached_bitmap( int tmap_bottom, int tmap_top )
void merge_textures_new( int type, grs_bitmap * bottom_bmp, grs_bitmap * top_bmp, ubyte * dest_data )
{
#ifdef MACINTOSH
ubyte c;
int x,y;
#endif
ubyte * top_data, *bottom_data;
if ( top_bmp->bm_flags & BM_FLAG_RLE )
@ -243,60 +344,20 @@ void merge_textures_new( int type, grs_bitmap * bottom_bmp, grs_bitmap * top_bmp
// mprintf( 0, "Type=%d\n", type );
switch( type ) {
case 0:
// Normal
#ifndef MACINTOSH
gr_merge_textures( bottom_data, top_data, dest_data );
#else
for (y=0; y<64; y++ )
for (x=0; x<64; x++ ) {
c = top_data[ 64*y+x ];
if (c==TRANSPARENCY_COLOR)
c = bottom_data[ 64*y+x ];
*dest_data++ = c;
}
#endif
break;
case 1:
#ifndef MACINTOSH
gr_merge_textures_1( bottom_data, top_data, dest_data );
#else
for (y=0; y<64; y++ )
for (x=0; x<64; x++ ) {
c = top_data[ 64*x+(63-y) ];
if (c==TRANSPARENCY_COLOR)
c = bottom_data[ 64*y+x ];
*dest_data++ = c;
}
#endif
break;
case 2:
#ifndef MACINTOSH
gr_merge_textures_2( bottom_data, top_data, dest_data );
#else
for (y=0; y<64; y++ )
for (x=0; x<64; x++ ) {
c = top_data[ 64*(63-y)+(63-x) ];
if (c==TRANSPARENCY_COLOR)
c = bottom_data[ 64*y+x ];
*dest_data++ = c;
}
#endif
break;
case 3:
#ifndef MACINTOSH
gr_merge_textures_3( bottom_data, top_data, dest_data );
#else
for (y=0; y<64; y++ )
for (x=0; x<64; x++ ) {
c = top_data[ 64*(63-x)+y ];
if (c==TRANSPARENCY_COLOR)
c = bottom_data[ 64*y+x ];
*dest_data++ = c;
}
#endif
break;
case 0:
// Normal
gr_merge_textures( bottom_data, top_data, dest_data );
break;
case 1:
gr_merge_textures_1( bottom_data, top_data, dest_data );
break;
case 2:
gr_merge_textures_2( bottom_data, top_data, dest_data );
break;
case 3:
gr_merge_textures_3( bottom_data, top_data, dest_data );
break;
}
}