summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/strife/p_enemy.c46
-rw-r--r--src/strife/p_mobj.h59
-rw-r--r--src/strife/r_draw.c396
-rw-r--r--src/strife/r_things.c106
4 files changed, 186 insertions, 421 deletions
diff --git a/src/strife/p_enemy.c b/src/strife/p_enemy.c
index 6cb2aff3..f45d145e 100644
--- a/src/strife/p_enemy.c
+++ b/src/strife/p_enemy.c
@@ -2000,13 +2000,10 @@ void A_SetTLOptions(mobj_t* actor)
//
void A_BossMeleeAtk(mobj_t* actor)
{
- int r;
-
if(!actor->target)
return;
- r = P_Random();
- P_DamageMobj(actor->target, actor, actor, 10 * (r & 9));
+ P_DamageMobj(actor->target, actor, actor, 10 * (P_Random() & 9));
}
//
@@ -2048,7 +2045,8 @@ void A_FireHookShot(mobj_t* actor)
// A_FireChainShot
//
// villsa [STRIFE] new codepointer
-// 09/06/10: Action function for the hookshot.
+// 09/06/10: Action function for the hookshot projectile. Spawns echoes
+// to create a chain-like appearance.
//
void A_FireChainShot(mobj_t* actor)
{
@@ -2057,12 +2055,12 @@ void A_FireChainShot(mobj_t* actor)
P_SpawnMobj(actor->x, actor->y, actor->z, MT_CHAINSHOT); // haleyjd: fixed type
P_SpawnMobj(actor->x - (actor->momx >> 1),
- actor->y - (actor->momy >> 1),
- actor->z, MT_CHAINSHOT);
+ actor->y - (actor->momy >> 1),
+ actor->z, MT_CHAINSHOT);
P_SpawnMobj(actor->x - actor->momx,
- actor->y - actor->momy,
- actor->z, MT_CHAINSHOT);
+ actor->y - actor->momy,
+ actor->z, MT_CHAINSHOT);
}
@@ -2078,8 +2076,8 @@ void A_MissileSmoke(mobj_t* actor)
S_StartSound(actor, sfx_rflite);
P_SpawnPuff(actor->x, actor->y, actor->z);
mo = P_SpawnMobj(actor->x - actor->momx,
- actor->y - actor->momy,
- actor->z, MT_MISSILESMOKE);
+ actor->y - actor->momy,
+ actor->z, MT_MISSILESMOKE);
mo->momz = FRACUNIT;
@@ -2103,7 +2101,7 @@ void A_SpawnSparkPuff(mobj_t* actor)
y = (10*FRACUNIT) * ((r & 3) - (P_Random() & 3)) + actor->y;
mo = P_SpawnMobj(x, y, actor->z, MT_SPARKPUFF);
- P_SetMobjState(mo, S_BNG4_01);
+ P_SetMobjState(mo, S_BNG4_01); // 199
mo->momz = FRACUNIT;
}
@@ -2470,28 +2468,29 @@ void A_TeleportBeacon(mobj_t* actor)
// A_BodyParts
//
// villsa [STRIFE] new codepointer
+// 09/06/10: Spawns gibs when organic actors get splattered, or junk
+// when robots explode.
//
void A_BodyParts(mobj_t* actor)
{
mobjtype_t type;
mobj_t* mo;
angle_t an;
- if(actor->flags & MF_NOBLOOD)
+
+ if(actor->flags & MF_NOBLOOD) // Robots are flagged NOBLOOD
type = MT_JUNK;
else
type = MT_MEAT;
mo = P_SpawnMobj(actor->x, actor->y, actor->z + (24*FRACUNIT), type);
- P_SetMobjState(mo, mo->info->spawnstate + (P_Random()%19));
+ P_SetMobjState(mo, mo->info->spawnstate + (P_Random() % 19));
- an = ((P_Random() << 13) / 255);
+ an = (P_Random() << 13) / 255;
mo->angle = an << ANGLETOFINESHIFT;
- mo->momx += FixedMul(finecosine[an], (P_Random() & 0xf)<<FRACBITS);
- mo->momy += FixedMul(finesine[an], (P_Random() & 0xf)<<FRACBITS);
- mo->momz += (P_Random() & 0xf)<<FRACBITS;
-
-
+ mo->momx += FixedMul(finecosine[an], (P_Random() & 0x0f) << FRACBITS);
+ mo->momy += FixedMul(finesine[an], (P_Random() & 0x0f) << FRACBITS);
+ mo->momz += (P_Random() & 0x0f) << FRACBITS;
}
void A_ClaxonBlare(mobj_t* actor)
@@ -2503,12 +2502,13 @@ void A_ClaxonBlare(mobj_t* actor)
// A_ActiveSound
//
// villsa [STRIFE] new codepointer
+// 09/06/10: Plays an object's active sound periodically.
//
void A_ActiveSound(mobj_t* actor)
{
if(actor->info->activesound)
{
- if(!leveltime & 7)
+ if(!(leveltime & 7)) // haleyjd: added parens
S_StartSound(actor, actor->info->activesound);
}
}
@@ -2517,6 +2517,9 @@ void A_ActiveSound(mobj_t* actor)
// A_ClearSoundTarget
//
// villsa [STRIFE] new codepointer
+// 09/06/10: Clears the actor's sector soundtarget, so that the actor
+// will not be continually alerted/awakened ad infinitum. Used by
+// shopkeepers.
//
void A_ClearSoundTarget(mobj_t* actor)
{
@@ -2532,6 +2535,7 @@ void A_DropBurnFlesh(mobj_t* actor)
// A_FlameDeath
//
// villsa [STRIFE] new codepointer
+// 09/06/10: Death animation for flamethrower fireballs.
//
void A_FlameDeath(mobj_t* actor)
{
diff --git a/src/strife/p_mobj.h b/src/strife/p_mobj.h
index 67c1c35d..09013395 100644
--- a/src/strife/p_mobj.h
+++ b/src/strife/p_mobj.h
@@ -119,101 +119,101 @@
typedef enum
{
// Call P_SpecialThing when touched.
- MF_SPECIAL = 1,
+ MF_SPECIAL = 1,
// Blocks.
- MF_SOLID = 2,
+ MF_SOLID = 2,
// Can be hit.
- MF_SHOOTABLE = 4,
+ MF_SHOOTABLE = 4,
// Don't use the sector links (invisible but touchable).
- MF_NOSECTOR = 8,
+ MF_NOSECTOR = 8,
// Don't use the blocklinks (inert but displayable)
- MF_NOBLOCKMAP = 16,
+ MF_NOBLOCKMAP = 16,
// villsa [STRIFE] Stand around until alerted
MF_STAND = 32,
// Will try to attack right back.
- MF_JUSTHIT = 64,
+ MF_JUSTHIT = 64,
// Will take at least one step before attacking.
- MF_JUSTATTACKED = 128,
+ MF_JUSTATTACKED = 128,
// On level spawning (initial position),
// hang from ceiling instead of stand on floor.
- MF_SPAWNCEILING = 256,
+ MF_SPAWNCEILING = 256,
// Don't apply gravity (every tic),
// that is, object will float, keeping current height
// or changing it actively.
- MF_NOGRAVITY = 512,
+ MF_NOGRAVITY = 512,
// Movement flags.
// This allows jumps from high places.
- MF_DROPOFF = 0x400,
+ MF_DROPOFF = 0x400,
// villsa [STRIFE] For players, count as quest item
MF_GIVEQUEST = 0x800,
// Player cheat. ???
- MF_NOCLIP = 0x1000,
+ MF_NOCLIP = 0x1000,
// villsa [STRIFE] are feet clipped into water/slude floor?
MF_FEETCLIPPED = 0x2000,
// Allow moves to any height, no gravity.
// For active floaters, e.g. cacodemons, pain elementals.
- MF_FLOAT = 0x4000,
+ MF_FLOAT = 0x4000,
// villsa [STRIFE] is mobj in combat?
- MF_INCOMBAT = 0x8000,
+ MF_INCOMBAT = 0x8000,
// Don't hit same species, explode on block.
// Player missiles as well as fireballs of various kinds.
- MF_MISSILE = 0x10000,
+ MF_MISSILE = 0x10000,
// Dropped by a demon, not level spawned.
// E.g. ammo clips dropped by dying former humans.
- MF_DROPPED = 0x20000,
+ MF_DROPPED = 0x20000,
// Use fuzzy draw (shadow demons or spectres),
// temporary player invisibility powerup.
- MF_SHADOW = 0x40000,
+ MF_SHADOW = 0x40000,
// Flag: don't bleed when shot (use puff),
// barrels and shootable furniture shall not bleed.
- MF_NOBLOOD = 0x80000,
+ MF_NOBLOOD = 0x80000,
// Don't stop moving halfway off a step,
// that is, have dead bodies slide down all the way.
- MF_CORPSE = 0x100000,
+ MF_CORPSE = 0x100000,
// Floating to a height for a move, ???
// don't auto float to target's height.
- MF_INFLOAT = 0x200000,
+ MF_INFLOAT = 0x200000,
// On kill, count this enemy object
// towards intermission kill total.
// Happy gathering.
- MF_COUNTKILL = 0x400000,
+ MF_COUNTKILL = 0x400000,
// Not to be activated by sound, deaf monster.
- MF_AMBUSH = 0x800000,
+ MF_AMBUSH = 0x800000,
// villsa [STRIFE] flag used for bouncing projectiles
- MF_BOUNCE = 0x1000000,
+ MF_BOUNCE = 0x1000000,
// Don't spawn this object
// in death match mode (e.g. key cards).
- MF_NOTDMATCH = 0x2000000,
+ MF_NOTDMATCH = 0x2000000,
// villsa [STRIFE] friendly towards player with matching flag
MF_ALLY = 0x4000000,
- // villsa [STRIFE] 75% transparency? -- NEEDS VERIFICATION
+ // villsa [STRIFE] 75% or 25% transparency? -- NEEDS VERIFICATION
MF_MVIS = 0x8000000,
// villsa [STRIFE] color translation
@@ -225,18 +225,17 @@ typedef enum
// villsa [STRIFE] color translation
MF_COLORSWAP3 = 0x40000000,
- // villsa [STRIFE] TODO - add description
+ // villsa [STRIFE] spectral entity, only damaged by spectral missiles
MF_SPECTRAL = 0x80000000,
// Player sprites in multiplayer modes are modified
// using an internal color lookup table for re-indexing.
- // If 0x4 0x8 or 0xc,
- // use a translation table for player colormaps
- MF_TRANSLATION = 0xc000000,
+ // haleyjd 09/06/10: redid for Strife translations
+ MF_TRANSLATION = (MF_COLORSWAP1|MF_COLORSWAP2|MF_COLORSWAP3),
- // Hmm ???.
+ // Turns 0x10000000 into 0x01 to get a translation index.
// villsa [STRIFE] change from 26 to 28
- MF_TRANSSHIFT = 28
+ MF_TRANSSHIFT = 28
} mobjflag_t;
diff --git a/src/strife/r_draw.c b/src/strife/r_draw.c
index 0e887b99..a09032c7 100644
--- a/src/strife/r_draw.c
+++ b/src/strife/r_draw.c
@@ -51,7 +51,7 @@
// status bar height at bottom of screen
// haleyjd 08/31/10: Verified unmodified.
-#define SBARHEIGHT 32
+#define SBARHEIGHT 32
//
// All drawing to the view buffer is accomplished in this file.
@@ -76,7 +76,8 @@ int columnofs[MAXWIDTH];
// translate a limited part to another
// (color ramps used for suit colors).
//
-byte translations[3][256];
+// [STRIFE] Unused.
+//byte translations[3][256];
// Backing buffer containing the bezel drawn around the screen and
// surrounding background.
@@ -216,240 +217,47 @@ void R_DrawColumn (void)
}
#endif
-
-void R_DrawColumnLow (void)
-{
- int count;
- byte* dest;
- byte* dest2;
- fixed_t frac;
- fixed_t fracstep;
- int x;
-
- count = dc_yh - dc_yl;
-
- // Zero length.
- if (count < 0)
- return;
-
-#ifdef RANGECHECK
- if ((unsigned)dc_x >= SCREENWIDTH
- || dc_yl < 0
- || dc_yh >= SCREENHEIGHT)
- {
-
- I_Error ("R_DrawColumn: %i to %i at %i", dc_yl, dc_yh, dc_x);
- }
- // dccount++;
-#endif
- // Blocky mode, need to multiply by 2.
- x = dc_x << 1;
-
- dest = ylookup[dc_yl] + columnofs[x];
- dest2 = ylookup[dc_yl] + columnofs[x+1];
-
- fracstep = dc_iscale;
- frac = dc_texturemid + (dc_yl-centery)*fracstep;
-
- do
- {
- // Hack. Does not work corretly.
- *dest2 = *dest = dc_colormap[dc_source[(frac>>FRACBITS)&127]];
- dest += SCREENWIDTH;
- dest2 += SCREENWIDTH;
- frac += fracstep;
-
- } while (count--);
-}
-
+// haleyjd 09/06/10 [STRIFE] Removed low detail
//
// Spectre/Invisibility.
//
-#define FUZZTABLE 50
-#define FUZZOFF (SCREENWIDTH)
+// haleyjd 09/06/10: ]STRIFE] replaced fuzzdraw with translucency.
-int fuzzoffset[FUZZTABLE] =
-{
- FUZZOFF,-FUZZOFF,FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,
- FUZZOFF,FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,
- FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,-FUZZOFF,-FUZZOFF,-FUZZOFF,
- FUZZOFF,-FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,
- FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,-FUZZOFF,FUZZOFF,
- FUZZOFF,-FUZZOFF,-FUZZOFF,-FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,
- FUZZOFF,FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,FUZZOFF
-};
-
-int fuzzpos = 0;
-
-
-//
-// Framebuffer postprocessing.
-// Creates a fuzzy image by copying pixels
-// from adjacent ones to left and right.
-// Used with an all black colormap, this
-// could create the SHADOW effect,
-// i.e. spectres and invisible players.
//
-void R_DrawFuzzColumn (void)
-{
- int count;
- byte* dest;
- fixed_t frac;
- fixed_t fracstep;
-
- // Adjust borders. Low...
- if (!dc_yl)
- dc_yl = 1;
-
- // .. and high.
- if (dc_yh == viewheight-1)
- dc_yh = viewheight - 2;
-
- count = dc_yh - dc_yl;
-
- // Zero length.
- if (count < 0)
- return;
-
-#ifdef RANGECHECK
- if ((unsigned)dc_x >= SCREENWIDTH
- || dc_yl < 0 || dc_yh >= SCREENHEIGHT)
- {
- I_Error ("R_DrawFuzzColumn: %i to %i at %i",
- dc_yl, dc_yh, dc_x);
- }
-#endif
-
- dest = ylookup[dc_yl] + columnofs[dc_x];
-
- // Looks familiar.
- fracstep = dc_iscale;
- frac = dc_texturemid + (dc_yl-centery)*fracstep;
-
- // Looks like an attempt at dithering,
- // using the colormap #6 (of 0-31, a bit
- // brighter than average).
- do
- {
- // Lookup framebuffer, and retrieve
- // a pixel that is either one column
- // left or right of the current one.
- // Add index from colormap to index.
- *dest = colormaps[6*256+dest[fuzzoffset[fuzzpos]]];
-
- // Clamp table lookup index.
- if (++fuzzpos == FUZZTABLE)
- fuzzpos = 0;
-
- dest += SCREENWIDTH;
-
- frac += fracstep;
- } while (count--);
-}
-
-// low detail mode version
-
-void R_DrawFuzzColumnLow (void)
-{
- int count;
- byte* dest;
- byte* dest2;
- fixed_t frac;
- fixed_t fracstep;
- int x;
-
- // Adjust borders. Low...
- if (!dc_yl)
- dc_yl = 1;
-
- // .. and high.
- if (dc_yh == viewheight-1)
- dc_yh = viewheight - 2;
-
- count = dc_yh - dc_yl;
-
- // Zero length.
- if (count < 0)
- return;
-
- // low detail mode, need to multiply by 2
-
- x = dc_x << 1;
-
-#ifdef RANGECHECK
- if ((unsigned)x >= SCREENWIDTH
- || dc_yl < 0 || dc_yh >= SCREENHEIGHT)
- {
- I_Error ("R_DrawFuzzColumn: %i to %i at %i",
- dc_yl, dc_yh, dc_x);
- }
-#endif
-
- dest = ylookup[dc_yl] + columnofs[x];
- dest2 = ylookup[dc_yl] + columnofs[x+1];
-
- // Looks familiar.
- fracstep = dc_iscale;
- frac = dc_texturemid + (dc_yl-centery)*fracstep;
-
- // Looks like an attempt at dithering,
- // using the colormap #6 (of 0-31, a bit
- // brighter than average).
- do
- {
- // Lookup framebuffer, and retrieve
- // a pixel that is either one column
- // left or right of the current one.
- // Add index from colormap to index.
- *dest = colormaps[6*256+dest[fuzzoffset[fuzzpos]]];
- *dest2 = colormaps[6*256+dest2[fuzzoffset[fuzzpos]]];
-
- // Clamp table lookup index.
- if (++fuzzpos == FUZZTABLE)
- fuzzpos = 0;
-
- dest += SCREENWIDTH;
- dest2 += SCREENWIDTH;
-
- frac += fracstep;
- } while (count--);
-}
-
-//
-// R_DrawTLColumn
+// R_DrawMVisTLColumn
//
// villsa [STRIFE] new function
// Replacement for R_DrawFuzzColumn
//
-void R_DrawTLColumn(void)
+void R_DrawMVisTLColumn(void)
{
- int count;
- byte* dest;
- fixed_t frac;
- fixed_t fracstep;
+ int count;
+ byte* dest;
+ fixed_t frac;
+ fixed_t fracstep;
// Adjust borders. Low...
if (!dc_yl)
- dc_yl = 1;
+ dc_yl = 1;
// .. and high.
if (dc_yh == viewheight-1)
- dc_yh = viewheight - 2;
-
+ dc_yh = viewheight - 2;
+
count = dc_yh - dc_yl;
// Zero length.
if (count < 0)
- return;
+ return;
#ifdef RANGECHECK
if ((unsigned)dc_x >= SCREENWIDTH
- || dc_yl < 0 || dc_yh >= SCREENHEIGHT)
+ || dc_yl < 0 || dc_yh >= SCREENHEIGHT)
{
- I_Error ("R_DrawFuzzColumn: %i to %i at %i",
- dc_yl, dc_yh, dc_x);
+ I_Error ("R_DrawFuzzColumn: %i to %i at %i",
+ dc_yl, dc_yh, dc_x);
}
#endif
@@ -461,46 +269,48 @@ void R_DrawTLColumn(void)
do
{
- *dest = xlatab[*dest+
- (dc_colormap[dc_source[(frac>>FRACBITS)&127]]<<8)];
+ byte src = dc_colormap[dc_source[(frac>>FRACBITS)&127]];
+ byte col = xlatab[*dest + (src << 8)];
+ *dest = col;
dest += SCREENWIDTH;
frac += fracstep;
} while(count--);
}
-
//
-// R_DrawMVisTLColumn
+// R_DrawTLColumn
//
// villsa [STRIFE] new function
+// Achieves a second translucency level using the same lookup table,
+// via inversion of the colors in the index computation.
//
-void R_DrawMVisTLColumn(void)
+void R_DrawTLColumn(void)
{
- int count;
- byte* dest;
- fixed_t frac;
- fixed_t fracstep;
+ int count;
+ byte* dest;
+ fixed_t frac;
+ fixed_t fracstep;
// Adjust borders. Low...
if (!dc_yl)
- dc_yl = 1;
+ dc_yl = 1;
// .. and high.
if (dc_yh == viewheight-1)
- dc_yh = viewheight - 2;
-
+ dc_yh = viewheight - 2;
+
count = dc_yh - dc_yl;
// Zero length.
if (count < 0)
- return;
+ return;
#ifdef RANGECHECK
if ((unsigned)dc_x >= SCREENWIDTH
- || dc_yl < 0 || dc_yh >= SCREENHEIGHT)
+ || dc_yl < 0 || dc_yh >= SCREENHEIGHT)
{
- I_Error ("R_DrawFuzzColumn: %i to %i at %i",
- dc_yl, dc_yh, dc_x);
+ I_Error ("R_DrawFuzzColumn2: %i to %i at %i",
+ dc_yl, dc_yh, dc_x);
}
#endif
@@ -512,8 +322,9 @@ void R_DrawMVisTLColumn(void)
do
{
- *dest = xlatab[((*dest)<<8)
- + dc_colormap[dc_source[(frac>>FRACBITS)&127]]];
+ byte src = dc_colormap[dc_source[(frac>>FRACBITS)&127]];
+ byte col = xlatab[(*dest << 8) + src];
+ *dest = col;
dest += SCREENWIDTH;
frac += fracstep;
} while(count--);
@@ -535,26 +346,25 @@ byte* translationtables;
void R_DrawTranslatedColumn (void)
{
- int count;
- byte* dest;
- fixed_t frac;
- fixed_t fracstep;
-
+ int count;
+ byte* dest;
+ fixed_t frac;
+ fixed_t fracstep;
+
count = dc_yh - dc_yl;
if (count < 0)
- return;
-
+ return;
+
#ifdef RANGECHECK
if ((unsigned)dc_x >= SCREENWIDTH
- || dc_yl < 0
- || dc_yh >= SCREENHEIGHT)
+ || dc_yl < 0
+ || dc_yh >= SCREENHEIGHT)
{
- I_Error ( "R_DrawColumn: %i to %i at %i",
- dc_yl, dc_yh, dc_x);
+ I_Error ( "R_DrawColumn: %i to %i at %i",
+ dc_yl, dc_yh, dc_x);
}
-
-#endif
+#endif
dest = ylookup[dc_yl] + columnofs[dc_x];
@@ -565,98 +375,46 @@ void R_DrawTranslatedColumn (void)
// Here we do an additional index re-mapping.
do
{
- // Translation tables are used
- // to map certain colorramps to other ones,
- // used with PLAY sprites.
- // Thus the "green" ramp of the player 0 sprite
- // is mapped to gray, red, black/indigo.
- *dest = dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]];
- dest += SCREENWIDTH;
-
- frac += fracstep;
+ // Translation tables are used
+ // to map certain colorramps to other ones,
+ // used with PLAY sprites.
+ // Thus the "green" ramp of the player 0 sprite
+ // is mapped to gray, red, black/indigo.
+ *dest = dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]];
+ dest += SCREENWIDTH;
+ frac += fracstep;
} while (count--);
}
-void R_DrawTranslatedColumnLow (void)
-{
- int count;
- byte* dest;
- byte* dest2;
- fixed_t frac;
- fixed_t fracstep;
- int x;
-
- count = dc_yh - dc_yl;
- if (count < 0)
- return;
-
- // low detail, need to scale by 2
- x = dc_x << 1;
-
-#ifdef RANGECHECK
- if ((unsigned)x >= SCREENWIDTH
- || dc_yl < 0
- || dc_yh >= SCREENHEIGHT)
- {
- I_Error ( "R_DrawColumn: %i to %i at %i",
- dc_yl, dc_yh, x);
- }
-
-#endif
-
-
- dest = ylookup[dc_yl] + columnofs[x];
- dest2 = ylookup[dc_yl] + columnofs[x+1];
-
- // Looks familiar.
- fracstep = dc_iscale;
- frac = dc_texturemid + (dc_yl-centery)*fracstep;
-
- // Here we do an additional index re-mapping.
- do
- {
- // Translation tables are used
- // to map certain colorramps to other ones,
- // used with PLAY sprites.
- // Thus the "green" ramp of the player 0 sprite
- // is mapped to gray, red, black/indigo.
- *dest = dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]];
- *dest2 = dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]];
- dest += SCREENWIDTH;
- dest2 += SCREENWIDTH;
-
- frac += fracstep;
- } while (count--);
-}
+// haleyjd 09/06/10 [STRIFE] Removed low detail
//
// R_DrawTRTLColumn
//
// villsa [STRIFE] new function
+// Combines translucency and color translation.
//
void R_DrawTRTLColumn(void)
{
- int count;
- byte* dest;
- fixed_t frac;
- fixed_t fracstep;
-
+ int count;
+ byte* dest;
+ fixed_t frac;
+ fixed_t fracstep;
+
count = dc_yh - dc_yl;
if (count < 0)
- return;
-
+ return;
+
#ifdef RANGECHECK
if ((unsigned)dc_x >= SCREENWIDTH
- || dc_yl < 0
- || dc_yh >= SCREENHEIGHT)
+ || dc_yl < 0
+ || dc_yh >= SCREENHEIGHT)
{
- I_Error ( "R_DrawColumn: %i to %i at %i",
- dc_yl, dc_yh, dc_x);
+ I_Error ( "R_DrawColumn: %i to %i at %i",
+ dc_yl, dc_yh, dc_x);
}
-
#endif
-
dest = ylookup[dc_yl] + columnofs[dc_x];
// Looks familiar.
@@ -666,11 +424,11 @@ void R_DrawTRTLColumn(void)
// Here we do an additional index re-mapping.
do
{
- *dest = xlatab[((*dest)<<8)
- + dc_colormap[dc_translation[dc_source[frac>>FRACBITS]]]];
- dest += SCREENWIDTH;
-
- frac += fracstep;
+ byte src = dc_colormap[dc_translation[dc_source[frac>>FRACBITS&127]]];
+ byte col = xlatab[(*dest << 8) + src];
+ *dest = col;
+ dest += SCREENWIDTH;
+ frac += fracstep;
} while (count--);
}
diff --git a/src/strife/r_things.c b/src/strife/r_things.c
index 112e4214..792c9f95 100644
--- a/src/strife/r_things.c
+++ b/src/strife/r_things.c
@@ -349,29 +349,33 @@ short* mceilingclip;
fixed_t spryscale;
fixed_t sprtopscreen;
+//
+// R_DrawMaskedColumn
+//
// villsa [STRIFE] new baseclip argument
+//
void R_DrawMaskedColumn (column_t *column, int baseclip)
{
int topscreen;
int bottomscreen;
fixed_t basetexturemid;
-
+
basetexturemid = dc_texturemid;
-
+
for ( ; column->topdelta != 0xff ; )
{
- // calculate unclipped screen coordinates
- // for post
- topscreen = sprtopscreen + spryscale*column->topdelta;
- bottomscreen = topscreen + spryscale*column->length;
+ // calculate unclipped screen coordinates
+ // for post
+ topscreen = sprtopscreen + spryscale*column->topdelta;
+ bottomscreen = topscreen + spryscale*column->length;
- dc_yl = (topscreen+FRACUNIT-1)>>FRACBITS;
- dc_yh = (bottomscreen-1)>>FRACBITS;
-
- if (dc_yh >= mfloorclip[dc_x])
- dc_yh = mfloorclip[dc_x]-1;
- if (dc_yl <= mceilingclip[dc_x])
- dc_yl = mceilingclip[dc_x]+1;
+ dc_yl = (topscreen+FRACUNIT-1)>>FRACBITS;
+ dc_yh = (bottomscreen-1)>>FRACBITS;
+
+ if (dc_yh >= mfloorclip[dc_x])
+ dc_yh = mfloorclip[dc_x]-1;
+ if (dc_yl <= mceilingclip[dc_x])
+ dc_yl = mceilingclip[dc_x]+1;
// villsa [STRIFE] checks for clipping
if(baseclip)
@@ -380,19 +384,19 @@ void R_DrawMaskedColumn (column_t *column, int baseclip)
dc_yh = baseclip;
}
- if (dc_yl <= dc_yh)
- {
- dc_source = (byte *)column + 3;
- dc_texturemid = basetexturemid - (column->topdelta<<FRACBITS);
- // dc_source = (byte *)column + 3 - column->topdelta;
+ if (dc_yl <= dc_yh)
+ {
+ dc_source = (byte *)column + 3;
+ dc_texturemid = basetexturemid - (column->topdelta<<FRACBITS);
+ // dc_source = (byte *)column + 3 - column->topdelta;
- // Drawn by either R_DrawColumn
- // or (SHADOW) R_DrawFuzzColumn.
- colfunc ();
- }
- column = (column_t *)( (byte *)column + column->length + 4);
+ // Drawn by either R_DrawColumn
+ // or (SHADOW) R_DrawFuzzColumn.
+ colfunc ();
+ }
+ column = (column_t *)( (byte *)column + column->length + 4);
}
-
+
dc_texturemid = basetexturemid;
}
@@ -404,32 +408,33 @@ void R_DrawMaskedColumn (column_t *column, int baseclip)
//
void
R_DrawVisSprite
-( vissprite_t* vis,
- int x1,
- int x2 )
+( vissprite_t* vis,
+ int x1,
+ int x2 )
{
- column_t* column;
- int texturecolumn;
- fixed_t frac;
- patch_t* patch;
+ column_t* column;
+ int texturecolumn;
+ fixed_t frac;
+ patch_t* patch;
int clip; // villsa [STRIFE]
int translation; // villsa [STRIFE]
-
-
+
patch = W_CacheLumpNum (vis->patch+firstspritelump, PU_CACHE);
dc_colormap = vis->colormap;
// villsa [STRIFE]
- translation = vis->mobjflags & (MF_COLORSWAP1|MF_COLORSWAP2|MF_COLORSWAP3);
+ // haleyjd 09/06/10: updated MF_TRANSLATION for Strife
+ translation = vis->mobjflags & MF_TRANSLATION;
// villsa [STRIFE] unused
/*if (!dc_colormap)
{
- // NULL colormap = shadow draw
- colfunc = fuzzcolfunc;
+ // NULL colormap = shadow draw
+ colfunc = fuzzcolfunc;
}*/
- // villsa [STRIFE]
+
+ // villsa [STRIFE] Handle the two types of translucency
if(vis->mobjflags & MF_SHADOW)
{
if(!translation)
@@ -442,16 +447,15 @@ R_DrawVisSprite
else
{
colfunc = R_DrawTRTLColumn;
- dc_translation = translationtables - 256 + (translation>>20);
+ dc_translation = translationtables - 256 + (translation >> (MF_TRANSSHIFT - 8));
}
}
- // villsa [STRIFE] new translation tables
- else if (translation)
+ else if (translation) // villsa [STRIFE] new translation tables
{
- colfunc = transcolfunc;
- dc_translation = translationtables - 256 + (translation>>20);
+ colfunc = transcolfunc;
+ dc_translation = translationtables - 256 + (translation >> (MF_TRANSSHIFT - 8));
}
-
+
dc_iscale = abs(vis->xiscale)>>detailshift;
dc_texturemid = vis->texturemid;
frac = vis->startfrac;
@@ -461,22 +465,22 @@ R_DrawVisSprite
// villsa [STRIFE] clip sprite's feet if needed
if(vis->mobjflags & MF_FEETCLIPPED)
{
- sprbotscreen = sprtopscreen + FixedMul(spryscale, patch->height<<FRACBITS);
+ sprbotscreen = sprtopscreen + FixedMul(spryscale, patch->height << FRACBITS);
clip = (sprbotscreen - FixedMul(10*FRACUNIT, spryscale)) >> FRACBITS;
}
else
clip = 0;
-
+
for (dc_x=vis->x1 ; dc_x<=vis->x2 ; dc_x++, frac += vis->xiscale)
{
- texturecolumn = frac>>FRACBITS;
+ texturecolumn = frac>>FRACBITS;
#ifdef RANGECHECK
- if (texturecolumn < 0 || texturecolumn >= SHORT(patch->width))
- I_Error ("R_DrawSpriteRange: bad texturecolumn");
+ if (texturecolumn < 0 || texturecolumn >= SHORT(patch->width))
+ I_Error ("R_DrawSpriteRange: bad texturecolumn");
#endif
- column = (column_t *) ((byte *)patch +
- LONG(patch->columnofs[texturecolumn]));
- R_DrawMaskedColumn (column, clip); // villsa [STRIFE] clip argument
+ column = (column_t *) ((byte *)patch +
+ LONG(patch->columnofs[texturecolumn]));
+ R_DrawMaskedColumn (column, clip); // villsa [STRIFE] clip argument
}
colfunc = basecolfunc;