Skip to content

Commit

Permalink
Fixed fuzz effect closer to original and fixed inverse colormap.
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesDunne committed Nov 29, 2012
1 parent 580809b commit 5656071
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
4 changes: 3 additions & 1 deletion doomclassic/doom/defs.h
Expand Up @@ -230,7 +230,9 @@ If you have questions concerning this license or the applicable additional terms
#define MAX_ADJOINING_SECTORS 20
// p_spec.defs end //
// p_user.defs begin //
#define INVERSECOLORMAP 32

// CHANGE(jsd): Was 32 for COLORMAP index
#define INVERSECOLORMAP (NUMCOLORMAPS)

// DHM - NERVE :: MAXBOB reduced 25%
//#define MAXBOB 0x100000
Expand Down
18 changes: 10 additions & 8 deletions doomclassic/doom/r_data.cpp
Expand Up @@ -568,22 +568,24 @@ void R_InitSpriteLumps (void)
//
void R_InitColormaps (void)
{
#if 0
int lump, length;

// Load in the light tables,
// 256 byte align tables.
lump = W_GetNumForName("COLORMAP");
length = W_LumpLength (lump) + 255;
::g->colormaps = (lighttable_t*)DoomLib::Z_Malloc (length, PU_STATIC, 0);
::g->colormaps = (byte *)( ((int)::g->colormaps + 255)&~0xff);
W_ReadLump (lump,::g->colormaps);
#else
::g->colormaps = (lighttable_t*)DoomLib::Z_Malloc (256 * NUMCOLORMAPS * sizeof(lighttable_t), PU_STATIC, 0);
::g->stored_colormaps = (byte*)DoomLib::Z_Malloc (length, PU_STATIC, 0);
::g->stored_colormaps = (byte*)( ((int)::g->stored_colormaps + 255)&~0xff);
W_ReadLump (lump,::g->stored_colormaps);

// Calculate 24bpp colormaps as identity functions:
::g->colormaps = (lighttable_t*)DoomLib::Z_Malloc (256 * (NUMCOLORMAPS + 1) * sizeof(lighttable_t), PU_STATIC, 0);
for (int c = 0; c < NUMCOLORMAPS; ++c)
for (int i = 0; i < 256; ++i)
::g->colormaps[c * 256 + i] = c * 256 + i;
#endif
// Setup the inverse colormap for invulnerable mode:
for (int i = 0; i < 256; ++i)
::g->colormaps[(INVERSECOLORMAP * 256) + i] = ::g->stored_colormaps[(32 * 256) + i];
}


Expand Down
8 changes: 6 additions & 2 deletions doomclassic/doom/r_draw.cpp
Expand Up @@ -329,10 +329,14 @@ void R_DrawFuzzColumn ( lighttable_t * dc_colormap,
// a pixel that is either one column
// left or right of the current one.
// Add index from colormap to index.
//*dest = ::g->colormaps[6*256+dest[::g->fuzzoffset[::g->fuzzpos]]];

colormapindex_t curr = dest[::g->fuzzoffset[::g->fuzzpos]];
int level = ((curr >> 8) - 6);
int level = ((curr >> 8) - 3);
if (level < 0) level = 0;
*dest = (curr & 255) + (level * 256);

//*dest = (curr & 255) + (level * 256);
*dest = ::g->stored_colormaps[6*256+ (curr & 255)] + (level * 256);

// Clamp table lookup index.
if (++::g->fuzzpos == FUZZTABLE)
Expand Down
1 change: 1 addition & 0 deletions doomclassic/doom/vars.h
Expand Up @@ -565,6 +565,7 @@ fixed_t* spritewidth;
fixed_t* spriteoffset;
fixed_t* spritetopoffset;
lighttable_t *colormaps;
byte *stored_colormaps;
int flatmemory;
int texturememory;
int spritememory;
Expand Down
2 changes: 1 addition & 1 deletion doomclassic/doom/z_zone.cpp
Expand Up @@ -76,7 +76,7 @@ void *I_ZoneBase( int *size )
{
enum
{
HEAP_SIZE = 15 * 1024 * 1024 // SMF - was 10 * 1024 * 1024
HEAP_SIZE = 20 * 1024 * 1024 // SMF - was 10 * 1024 * 1024
};
*size = HEAP_SIZE;
return malloc( HEAP_SIZE );
Expand Down

0 comments on commit 5656071

Please sign in to comment.