summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Villareal2010-09-05 07:18:03 +0000
committerSamuel Villareal2010-09-05 07:18:03 +0000
commit219e482771f64677d2d59820345684cf3060968d (patch)
treef0b612810408c144bc4d80093b2df9da7f50bcc6
parent9efed5192aeb52379a8bfc66cde3b773b1bcb681 (diff)
downloadchocolate-doom-219e482771f64677d2d59820345684cf3060968d.tar.gz
chocolate-doom-219e482771f64677d2d59820345684cf3060968d.tar.bz2
chocolate-doom-219e482771f64677d2d59820345684cf3060968d.zip
+ Strife translation tables implemented
+ Changed MF_TRANSSHIFT to 28 (was 26) Subversion-branch: /branches/strife-branch Subversion-revision: 2013
-rw-r--r--src/strife/p_mobj.h3
-rw-r--r--src/strife/r_draw.c97
-rw-r--r--src/strife/r_things.c5
3 files changed, 88 insertions, 17 deletions
diff --git a/src/strife/p_mobj.h b/src/strife/p_mobj.h
index fcf963b2..38c04075 100644
--- a/src/strife/p_mobj.h
+++ b/src/strife/p_mobj.h
@@ -235,7 +235,8 @@ typedef enum
MF_TRANSLATION = 0xc000000,
// Hmm ???.
- MF_TRANSSHIFT = 26
+ // villsa [STRIFE] change from 26 to 28
+ MF_TRANSSHIFT = 28
} mobjflag_t;
diff --git a/src/strife/r_draw.c b/src/strife/r_draw.c
index e0dc9da8..9d0882d9 100644
--- a/src/strife/r_draw.c
+++ b/src/strife/r_draw.c
@@ -546,7 +546,8 @@ byte *xlatab;
//
void R_InitTranslationTables (void)
{
- int i;
+ int i;
+ int j;
// [STRIFE] Load xlatab. Here's how Rogue did it:
// v7 = W_CacheLumpName("XLATAB", PU_CACHE); // note potential cache bug...
@@ -563,24 +564,92 @@ void R_InitTranslationTables (void)
// to do is this:
xlatab = W_CacheLumpName("XLATAB", PU_STATIC);
- translationtables = Z_Malloc (256*3, PU_STATIC, 0);
+ // villsa [STRIFE] allocate a larger size for translation tables
+ translationtables = Z_Malloc (256*8, PU_STATIC, 0);
- // STRIFE-TODO: Strife has many more (and more varied) translations
- // translate just the 16 green colors
- for (i=0 ; i<256 ; i++)
+ // villsa [STRIFE] setup all translation tables
+ for(i = 0, j = -6; i < 256; i++, j++)
{
- if (i >= 0x70 && i<= 0x7f)
+ if(i >= 0x80 && i<= 0x8f)
{
- // map green ramp to gray, brown, red
- translationtables[i] = 0x60 + (i&0xf);
- translationtables [i+256] = 0x40 + (i&0xf);
- translationtables [i+512] = 0x20 + (i&0xf);
+ translationtables [i ] = (i & 0xf) + 64;
+ translationtables [i+ 256] = (i & 0xf) - 80;
+ translationtables [i+2*256] = (i & 0xf) + 16;
+ translationtables [i+3*256] = (i & 0xf) + 48;
+ translationtables [i+4*256] = (i & 0xf) + 80;
+ translationtables [i+5*256] = (i & 0xf) + 96;
+ translationtables [i+6*256] = (i & 0xf) - 112;
}
- else
+
+ else if(i >= 0x50 && i<= 0x5f)
+ {
+ translationtables [i ] = i;
+ translationtables [i+ 256] = i;
+ translationtables [i+2*256] = i;
+ translationtables [i+3*256] = i;
+ translationtables [i+4*256] = (i & 0xf) + -128;
+ translationtables [i+5*256] = (i & 0xf) + 16;
+ translationtables [i+6*256] = (i & 0xf) + 64;
+ }
+ else if(i >= 0xd0 && i<= 0xdf)
+ {
+ translationtables [i ] = i;
+ translationtables [i+ 256] = i;
+ translationtables [i+2*256] = i;
+ translationtables [i+3*256] = i;
+ translationtables [i+4*256] = (i & 0xf) - 80;
+ translationtables [i+5*256] = (i & 0xf) + 48;
+ translationtables [i+6*256] = (i & 0xf) + 16;
+ }
+ else if(i >= 0xc0 && i<= 0xcf)
+ {
+ translationtables [i ] = i;
+ translationtables [i+ 256] = i;
+ translationtables [i+2*256] = i;
+ translationtables [i+3*256] = i;
+ translationtables [i+4*256] = (i & 0xf) - 96;
+ translationtables [i+5*256] = (i & 0xf) + 32;
+ translationtables [i+6*256] = (i & 0xf);
+ }
+ else if(i >= 0xf7 && i<= 0xfb)
+ {
+ translationtables [i ] = j;
+ translationtables [i+ 256] = i;
+ translationtables [i+2*256] = i;
+ translationtables [i+3*256] = i;
+ translationtables [i+4*256] = i;
+ translationtables [i+5*256] = i;
+ translationtables [i+6*256] = i;
+ }
+ else if(i >= 0xf1 && i<= 0xf6)
+ {
+ translationtables [i ] = (i & 0xf) - 33;
+ translationtables [i+ 256] = i;
+ translationtables [i+2*256] = i;
+ translationtables [i+3*256] = i;
+ translationtables [i+4*256] = i;
+ translationtables [i+5*256] = i;
+ translationtables [i+6*256] = i;
+ }
+ else if(i >= 0x20 && i<= 0x40)
+ {
+ translationtables [i ] = i;
+ translationtables [i+ 256] = i;
+ translationtables [i+2*256] = (i & 0xf) - 48;
+ translationtables [i+3*256] = (i & 0xf) - 48;
+ translationtables [i+4*256] = i;
+ translationtables [i+5*256] = i;
+ translationtables [i+6*256] = i;
+ }
+ else // Keep all other colors as is.
{
- // Keep all other colors as is.
- translationtables[i] = translationtables[i+256]
- = translationtables[i+512] = i;
+ translationtables[i]=
+ translationtables[i+256]=
+ translationtables[i+2*256]=
+ translationtables[i+3*256]=
+ translationtables[i+4*256]=
+ translationtables[i+5*256]=
+ translationtables[i+6*256]=i;
}
}
}
diff --git a/src/strife/r_things.c b/src/strife/r_things.c
index 90267052..45b71915 100644
--- a/src/strife/r_things.c
+++ b/src/strife/r_things.c
@@ -414,11 +414,12 @@ R_DrawVisSprite
// NULL colormap = shadow draw
colfunc = fuzzcolfunc;
}
- else if (vis->mobjflags & MF_TRANSLATION)
+ // villsa [STRIFE] new translation tables
+ else if (vis->mobjflags & (MF_COLORSWAP1|MF_COLORSWAP2|MF_COLORSWAP3))
{
colfunc = transcolfunc;
dc_translation = translationtables - 256 +
- ( (vis->mobjflags & MF_TRANSLATION) >> (MF_TRANSSHIFT-8) );
+ ((vis->mobjflags & (MF_COLORSWAP1|MF_COLORSWAP2|MF_COLORSWAP3))>>20);
}
dc_iscale = abs(vis->xiscale)>>detailshift;