DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

Changing the Raycastor - Very Involved with Many Changes!
Page 1 of 2 Goto page 1, 2  Next
DieHard Wolfers Forum Index -> Code Tutorials View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
Post new topicReply to topic
Author Message
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Wed Nov 24, 2004 11:06 am
   Subject: Changing the Raycastor - Very Involved with Many Changes!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

Changing the Original Raycastor for Darkone's (from NewWolfClassic):

What will this do for me? It will give you transparent doors and transparent walls. It will also give you Darkone's lightshading and animated walls. And if you go into God Mode... well lets just say the screen looks like "DOOM Godmode". I won't go into all the other changes that you can make to the code .. but it has to do with things like fog... etc... This code will also, strangely enough, give you a more stable frames per second framerate and a whole chunk of free memory.

Note: This is Darkone's original code.... It has a few drawbacks, but it does work. My version has a completely reworked CheckIntersection routine and some other changes to the code. For this I would suggest installing it into a new or fresh "Original" source. Then start making your changes to the rest of the code for other features that you want. I have fixed the code where there were bugs.

Also Note: When using this change, you will have to change or modify the tutorials for Textured Ceilings/Floors and Ripper's Starry Sky and Cloudy Sky routines where it does the lightshading. Ripper's Directional Sprites are NOT compatible with this modification. To create Directional Sprites you will have to rewrite the complete code for that tutorial (which is something I haven't even tried at this time). Also, you will NOT be able to use Ripper's shading tutorial or his Removing the Scalers tutorial as well (they aren't needed).

Now on to the Modification.....

Open the WL_DEF.H file and find the "doorobj_t" type define. Now make that section look like this:

::: CODE :::

typedef struct doorstruct
{
   byte   tilex,tiley, vertical, lock;
   enum   {dr_open,dr_closed,dr_opening,dr_closing}   action;
   unsigned   position;
   int   ticcount;
} doorobj_t;


Find the code:

::: CODE :::

typedef enum {
   dr_normal,
   dr_lock1,
   dr_lock2,
   dr_lock3,
   dr_lock4,
   dr_elevator
} door_t;


And make it read:

::: CODE :::
typedef enum {
   dr_normal,
   dr_lock1,
   dr_lock2,
   dr_lock3,
   dr_lock4,
   dr_elevator
   ,dr_types
} door_t;


Now go down to the WL_DRAW Definitions and add the following line in there somewhere:

::: CODE :::

void LightTableSetup(void);



Next Open your WL_DRAW.C file and add the following code above the "Global Variables" remarks:

::: CODE :::

#define FLAG_TRANSLUCENCY 0x8000
#define VGAMAPBIT(x) asm {cli;mov dx,SC_INDEX;mov ax,0x0102;mov cl,x;shl ah,cl;out dx,ax;sti;}
#define FIX_HEIGHT(pix_height)      ((pix_height)<<2)
#define PIX_HEIGHT(fix_height)      (((fixheight)>>2)&~1)
#define PIX_HALFHEIGHT(fix_height)   ((fixheight)>>3)
unsigned minwallheight;


Next we remove the "CalcHeight" routine and replace it with this one:

::: CODE :::

/* CalcHeightEx
**
** Calculates the height of globalx,globaly from viewx,viewy
*/

unsigned min_wallheight;

#pragma warn -rvl   // I stick the return value in with ASMs
int CalcHeightEx(long globalx, long globaly)
{
   fixed gxt, gyt, dist;

   gxt=FixedByFrac(globalx-viewx, viewcos);
   gyt=FixedByFrac(globaly-viewy, viewsin);

   dist=gxt-gyt;

  //
  // calculate perspective ratio (heightnumerator/(nx>>8))
  //
   if(dist<MINDIST)
      dist=MINDIST;  // don't let divide overflow

   asm   mov   ax,[WORD PTR heightnumerator]
   asm   mov   dx,[WORD PTR heightnumerator+2]
   asm   idiv   [WORD PTR dist+1]   // nx>>8

// update min_wallheight
   asm mov bx,[min_wallheight]
   asm cmp ax,bx
   asm jae noupdate:
   asm mov [min_wallheight],ax
noupdate:;
}
#pragma warn +rvl


Now we remove the ScalePost routine and replace that code with the following:

::: CODE :::

// --------------- * Light Shading * -------------
byte far lighttable[17][255];   // 16 color levels for each of 255 colors
byte far *lt[50], far *spec_lt;   // each height has it's own lightshade
boolean isasprite;
/*
** Finds nearest color in the game palette
*/
byte FindColor(int r, int g, int b)
{
   int n;
   byte far *pal, bestc;
   long dr, dg, db, dc, bestdc;

   bestdc=-1;
   bestc=0;
   for(n=0, pal=&gamepal; n<256; n++, pal+=3)
   {
      dr=(int)pal[0]-r;
      dg=(int)pal[1]-g;
      db=(int)pal[2]-b;

      dc=dr*dr+dg*dg+db*db;

      if(bestdc==-1 || dc<bestdc)
      {
         bestdc=dc;
         bestc=n;
      }
   }

   return bestc;
}

/*
** Finds the nearest color from INVERSE current
**  searches the range of 16..31
**
*/
byte FindGodColor(int r, int g, int b)
{
   int n;
   byte far *pal, bestc;
   long dr, dg, db, dc, bestdc;

   r=63-r;
   g=63-g;
   b=63-b;

   bestdc=-1;
   bestc=0;
   for(n=16, pal=&gamepal+16*3; n<=31; n++, pal+=3)
   {
      dr=(int)pal[0]-r;
      dg=(int)pal[1]-g;
      db=(int)pal[2]-b;
      
      dc=dr*dr+dg*dg+db*db;

      if(bestdc==-1 || dc<bestdc)
      {
         bestdc=dc;
         bestc=n;
      }
   }

   return bestc;
}

#define COMPONENT(c) ((((long)c)>>2)<<16)
/*
** Generates lighttable
*/
void LightTableSetup(void)
{
   int n, m;
   long r, g, b, dr, dg, db;
   long tr, tg, tb; // target colors
   fixed dist;
   byte far *pal;

   tr=COMPONENT(0);
   tg=COMPONENT(0);
   tb=COMPONENT(0);

// process each color in palette
    for(n=0, pal=&gamepal; n<255; n++, pal+=3)
   {
      r=(long)pal[0]<<16;
      g=(long)pal[1]<<16;
      b=(long)pal[2]<<16;

      dr=(tr-r)>>3; // 1/16 shades
      dg=(tg-g)>>3;
      db=(tb-b)>>3;

// process each shade   
      for(m=0; m<16; m++)
      {
         lighttable[m][n]=FindColor(r>>16, g>>16, b>>16);
         r+=dr; g+=dg; b+=db;
      }
   }

// god mode: INVERSE colormap
    for(n=0, pal=&gamepal; n<255; n++, pal+=3)
   {
      lighttable[16][n]=FindGodColor(pal[0], pal[1], pal[2]);
   }

   for(n=0; n<viewheight/4; n++) // height shade
   {
      dist=(heightnumerator/(n+1))<<4; // (heightnumerator/(y<<3))<<8;

      m=dist>>16; // dist in tiles
      m-=2; // n nearest tiles are full bright
      m/=2; // linear lightlevel fades each n tiles
      //m=exp(m/5)-1;

      if(m<0)  m=0;
      if(m>15) m=15;

      lt[n]=lighttable[m];
   }
}

// ------------ * Wall Texture Mapping * ---------------
/*
** Draws a span (wall or sprite) [main texture mapping function -> optimize]
**
** if transparenty flag is set color with index 0xFF is not drawn
** no visibility test is done here, so spans should be sorted beforehand
** slinex and slinewidth corresponds to screen coordinates
** height is full height in pixels (should be even to avoid some rendering artifacts)
*/
void DrawSpan(int spanx, int spanwidth, int spanheight, byte far *src, boolean transparency)
{
   long y, dy;

   int y0, y1, y2;   // top wall edge, texel start pos & end pos
   int v;      // texture

   unsigned drawwidth, columnofs;   // for use with stupid VGA write mode

   byte color, far *colormap;   // source color

   dy=(long)spanheight<<10;   // step
   y0=(viewheight-spanheight)>>1;   // starting pos

// color shade level choose
   if(spec_lt)
      colormap=spec_lt; // special lighttable
   else if(spanheight<viewheight)
      colormap=lt[spanheight>>2];   // from shade table
   else
      colormap=lighttable[0];  // very close: first color

   while(spanwidth>0)
   {
      y=0;
      y2=y0;
      columnofs=spanx>>2; // screen memory offset that comes from x coord

// --------------- * Divider * ------------------
/*
** the following code makes clever VGA write mode switching
** wolud not be needed on any linerar video buffer
*/
      if(spanwidth==1) // only 1px left, don't do any extra work, just draw it!
      {
         byte p=spanx&3;
         VGAMAPBIT(p);
         drawwidth=1;
         spanwidth=0;
      }
      else switch(spanx&3)
      {
      case 0: // run of the quads
         drawwidth=spanwidth>>2;
         if(drawwidth)
         {
            VGAMAPMASK(15);   // xxxx
            spanwidth&=3;
            spanx+=drawwidth<<2;
         }
         else // last bits
         {
            drawwidth=1;
            switch(spanwidth)
            {
            case 2:
               VGAMAPMASK(3);   // xx..
               break;
            case 3:
               VGAMAPMASK(7);   // xxx.
               break;
            }
            spanwidth=0;
         }
         break;
      case 1: // first bits
         drawwidth=1;
         if(spanwidth>=3)
         {
            VGAMAPMASK(14);   // .xxx
            spanwidth-=3;
            spanx+=3;
         }
         else
         {
            VGAMAPMASK(6);   // .xx.
            spanwidth-=2;
            spanx+=2;
         }
         break;
      case 2:
         drawwidth=1;
         VGAMAPMASK(12);   // ..xx
         spanwidth-=2;
         spanx+=2;
         break;
      case 3:
         drawwidth=1;
         VGAMAPMASK(8); // ...x
         spanwidth-=1;
         spanx++;
         break;
      }
// --------------- * Divider * -----------------

      for(v=0; v<64; v++)
      {
         y1=y2;
         y+=dy;
         y2=(y>>16)+y0;

         if(y1>=viewheight) break;   // off the screen
         if(y1==y2 || y2<0) continue;   // nothing to draw
         if(y1<0) y1=0;   // not into the view area
   
         color=src[v];
         if(color==0xFF) // transparent texel 255 in the wolf palette
         {
            if(transparency)
               continue;
            else
               color=0x00; // substitute with black
         }
         else if(transparency==2) // spectre (translucency effect)
            color=(US_RndT()&7)+24; // shades of grey

         color = colormap[color];

         asm mov es,[screenseg]
         _DI=bufferofs+ylookup[y1]+columnofs;
   
         asm mov al,[color]
         asm mov dx,[drawwidth]

         for(; y1<y2 && y1<viewheight; y1++)
         {
            asm mov cx,dx
            asm rep stosb
            asm sub di,dx
            asm add di,80
         }
      }
   }
}

// ------------ * Sprites * ---------------

typedef struct
{
   unsigned short leftpix,rightpix;
   unsigned short dataofs[64];
// table data after dataofs[rightpix-leftpix+1]
}   shape_t;

/* Draw Sprite
**
**   draw sprite, using given sprite shapenum, fixheight and x_center position
** fixheight is in 14.2 fixed point format
*/
void DrawSprite(int shapenum, int xcenter, int fixheight, boolean clip)
{
   shape_t   far *shape;
   byte tex[64], far *src;

   long x, dx;      // screen coords

   int x0, x1, x2, w;   // left sprite edge, texel start & end pos
   int u, v;      // texture coords
   unsigned far *linecmds;
   int height, index;
   boolean leftvis, rightvis;
   boolean trans;
   
   if(clip&FLAG_TRANSLUCENCY) // translucency effect
      trans=2, clip&=~FLAG_TRANSLUCENCY;
   else
      trans=true;
   
   height=(fixheight>>2)&~1;   // height should be odd

   x0=xcenter-(height>>1);   // starting pos
   dx=(long)height<<10;

   shape=PM_GetSpritePage(shapenum);
   src=(byte far *)shape;

   x=0; x2=x0;
   for(u=0; u<64; u++)
   {
      x1=x2;
      x+=dx;
      x2=(x>>16)+x0;
      
      if(u<shape->leftpix) continue;   // skipping free lines
      if(u>shape->rightpix) break;   // end of the sprite
      if(x1>=viewwidth) break;

/* Reconstruction of sprite span */
      linecmds=(unsigned far *)(src+shape->dataofs[u-shape->leftpix]);

      memset(tex, 0xFF, 64); // transparent
      while(linecmds[0])
      {
         index=(linecmds[2]>>1)+linecmds[1];
         for(v=linecmds[2]>>1; v<linecmds[0]>>1; v++)
            tex[v]=src[index++];

         linecmds+=3;
      }

      if(x1==x2 || x2<0) continue;
      if(x1<0) x1=0;   // not into the view area
      w=x2-x1;

      if(w==1)
      {
         if(clip && wallheight[x1]>=fixheight) continue;
         // obscured by closer wall
         DrawSpan(x1, 1, height, tex, trans);
      }
      else
      {
         if(x2>viewwidth) w=viewwidth-x1;

         if(!clip)
         {
            DrawSpan(x1, w, height, tex, trans);
            continue;
         }

         leftvis=(wallheight[x1]<fixheight);
         rightvis=(wallheight[x1+w]<fixheight);

         if(leftvis)
         {
            if(rightvis)
               DrawSpan(x1, w, height, tex, trans);
            else
            {
               while(wallheight[x1+w]>=fixheight) w--;
               DrawSpan(x1, w, height, tex, trans);
               break; // the rest of the shape is gone
            }
         }
         else
         {
            if(rightvis)
            {
               while(wallheight[x1]>=fixheight) x1++, w--;
               DrawSpan(x1, w, height, tex, trans);
            }
            else
               continue;      // totally obscured
         }
      }
   }
}

// --------- * Sorted Spans Stuff * -----------
/*
** Sorted spans are used to draw transparent walls/doors
*/
typedef struct
{
   int x;      // span location
   int fixheight;   // fixed span height in pixels
   byte width;   // span width
   byte tex_page;   // texture page
   byte tex_off;   // texture offset
} span_t;

#define MAX_SPANS 320

span_t far spans[MAX_SPANS];
int n_spans;

void SpansReset(void)
{
   n_spans=0;
}

/*
** Add span. Checks for optimized spans drawing
*/
void SpanAddTrans(int spanx, int fixheight, int page, byte offset)
{
   span_t far *span;
   int n;

   for(span=spans, n=0; n<n_spans; span++, n++)
   {
      if(   span->x+span->width==spanx &&
            span->tex_page==page &&
            span->tex_off==offset &&
            span->fixheight>>3==fixheight>>3)
      {
         span->width++;
         return;
      }
   }

   if(n_spans==MAX_SPANS) Quit("Too Many Spans");

   span->x=spanx;
   span->width=1;
   span->fixheight=fixheight;
   span->tex_page=page;
   span->tex_off=offset;
   n_spans++;
}

// *** spans sorting ***

int SpansCmp(const void *elem1, const void *elem2)
{
   if(((span_t *)elem1)->fixheight==((span_t *)elem2)->fixheight)
      return 0;
   else
      return ((span_t *)elem1)->fixheight>((span_t *)elem2)->fixheight?1:-1;
}

/*
** Draw all spans which are smaller then "maxheight"
*/
void SpansRender(int maxheight)
{
   span_t far *span;
   int n;

   if(!n_spans) return;

   for(span=spans, n=0; n<n_spans; span++, n++)
   {
      if(span->fixheight>maxheight || !span->width) continue;
      DrawSpan(span->x, span->width, ((span->fixheight)>>2)&~1,
         (byte far *)PM_GetPage(span->tex_page)+(span->tex_off<<6), true);
      span->width=0;
   }
}

// ----------- * Solid Spans * ---------------
// wall optimization variables
int lastwallpic;
int lastheight;

unsigned postx, postwidth;
long postsource;

/*
** hititle - negative for vertical walls and positive for horizontal
** wallpic - texture page
** texture - texture column index
** height  - span height
*/
void SpanAddSolid(int wallpic, unsigned texture, unsigned height)
{
   if(postwidth && lastwallpic==wallpic)
   {
      // in the same wall type as last time, so check for optimized draw
      if(texture==(unsigned)postsource)
      {
      // wide scale
         postwidth++;
         wallheight[pixx]=lastheight;
      }
      else
      {
         DrawSpan(postx, postwidth, (lastheight>>2)&~1, (byte far *)postsource, false);
         (unsigned)postsource=texture;
         postx=pixx; postwidth=1;
         wallheight[pixx]=lastheight=height;
      }
   }
   else   // new wall
   {
      if(postwidth) // if not the first scaled post, flush previous
         DrawSpan(postx, postwidth, (lastheight>>2)&~1, (byte far *)postsource, false);

      lastwallpic=wallpic;

      postx=pixx; postwidth=1;
      wallheight[pixx]=lastheight=height;

      *( ((unsigned *)&postsource)+1)=(unsigned)PM_GetPage(wallpic);
      (unsigned)postsource=texture;
   }
}

void SpanFlush(void)
{
   DrawSpan(postx, postwidth, (lastheight>>2)&~1, (byte far *)postsource, false);
   postwidth=0;
}


Now Remove all the HitVertWall, HitHorizWall, HitVertDoor, HitHorizDoor, HitHorizPwall, and HitVertPwall routines, and replace them with this:

::: CODE :::

// ------------- * Raycaster Core * ------------
boolean transdrawn; // if trans column was drawn this ray
boolean   insetupscaling=false;
unsigned DoorIntercept(int door, unsigned intercept)
{
   if(intercept<doorobjlist[door].position) return 1;   // door is opened here
   return ((intercept-doorobjlist[door].position)>>4)&0xFC0;
}
/*
** Checking Intersection of Points on Map for Raycastor
**
** Returns TRUE to Stop tracing current ray
*/
#define DOOR_TYPES    (dr_types)   // each can be horizontal and vertical
// These numbers point to the graphic position in the Vswap of your doors
// Change as required
const byte door_tex[DOOR_TYPES]=
{
   0,   // dr_normal
   6,   // dr_lock1
   6,   // dr_lock2
   6,   // dr_lock3
   6,   // dr_lock4
   4,   // dr_elevator
};
// These numbers point to the position of the Door Sides or Jams in the Vswap
// for each door type... Change as required.
const byte door_sides[DOOR_TYPES]=
{
   2,   // dr_normal
   2,   // dr_lock1
   2,   // dr_lock2
   2,   // dr_lock3
   2,   // dr_lock4
   2,   // dr_elevator
};

/*
** Checking stuff
**
** retruns true to stop tracing current ray
*/
boolean CheckIntersection(int xtile, int ytile, long xglobal, long yglobal, long dx, long dy, boolean vertical, boolean flip)
{
  int wallpic, door_index, tilehit, tileobj; 
  unsigned texture, height, offset;

  tilehit=tilemap[xtile][ytile];
  if(!tilehit) return false; // continue ray
  tileobj=MAPSPOT (xtile,ytile,1);

// ----------- * PushWall * -----------
  if((tilehit&0x80)==0x80) // Check Bit 7 set... Yes - It's a door or Pushwall
  {   
    if(pwallstate && pwallx==xtile && pwally==ytile) // p-wall
    {
      offset=pwallpos<<10;
      if(vertical)
      {
        yglobal+=FixedByFrac(dy, offset);
        if(yglobal>>16!=ytile) return false;
        xglobal=(long)xtile<<16;
        texture=(yglobal>>4)&0xfc0;
        if(flip)
          xglobal+=TILEGLOBAL-offset, texture=0xfc0-texture;
        else
          xglobal+=offset;
      }
      else
      {
        xglobal+=FixedByFrac(dx, offset);
        if(xglobal>>16!=xtile) return false;
        yglobal=(long)ytile<<16;
        texture=(xglobal>>4)&0xfc0;
        if(flip)
          yglobal+=TILEGLOBAL-offset;
        else
          texture=0xfc0-texture, yglobal+=offset;
      }
      wallpic=(pwalltile-1)*2+vertical;
    }
    else // ----- * Door * ------
    {
      door_index=tilehit&0x3F;
      if(vertical)
      {
        yglobal+=dy>>1;   // halftile forward
        if(yglobal>>16!=ytile) return false;
        texture=DoorIntercept(door_index, yglobal&0xFFFF);
        if(texture&1) return false;
        xglobal=((long)xtile<<16)+0x8000;
      }
      else
      {
        xglobal+=dx>>1;   // halftile forward
        if(xglobal>>16!=xtile) return false;
        texture=DoorIntercept(door_index, xglobal&0xFFFF);
        if(texture&1) return false;
        yglobal=((long)ytile<<16)+0x8000;
      }
      wallpic=DOORWALL+door_tex[doorobjlist[door_index].lock]+vertical;
    }
  }
  else if(tileobj==512) // ------------ * Transparent Wall * -----------
  {
    if(transdrawn) return false;
    if(vertical) // transparent vertical wall
    {
      yglobal+=dy>>1;   // halftile forward
      if(yglobal>>16!=ytile) return false;
      xglobal=((long)xtile<<16)+0x8000;
    }
    else
    {
      xglobal+=dx>>1;   // halftile forward
      if(xglobal>>16!=xtile) return false;
      yglobal=((long)ytile<<16)+0x8000;
    }
    texture=((vertical?yglobal:xglobal)>>4)&0xfc0;
    wallpic=((tilehit-1)<<1)+vertical;
  }
  else  // ----------- * usuall Walls * -------------
  {
    texture=((vertical?yglobal:xglobal)>>4)&0xfc0;
    if(vertical)
    {
      xglobal=(long)xtile<<16;
      if(flip) xglobal+=TILEGLOBAL, texture=0xfc0-texture;
    }
    else
    {
      yglobal=(long)ytile<<16;
      if(flip) yglobal+=TILEGLOBAL; else texture=0xfc0-texture;
    }
   // check for adjacent doors
    door_index=(vertical?tilemap[xtile+(flip?1:-1)][ytile]:tilemap[xtile][ytile+(flip?1:-1)]);
    if((door_index&0x80)==0x80 && (!pwallstate || pwallx!=xtile+(vertical?(flip?1:-1):0) || pwally!=ytile+(vertical?0:(flip?1:-1))))
    {
      door_index&=0x3F;
      wallpic=DOORWALL+door_sides[doorobjlist[door_index].lock]+vertical;
    }
    else
      wallpic=((tilehit-1)<<1)+vertical;
   
  }
  height=CalcHeightEx(xglobal, yglobal);
// **** Wall Modifiers - Self Modifying Code :)
  if (tileobj <=403 && tileobj >= 400) // 3 Frame Animated Walls
    wallpic +=(((gamestate.TimeCount>>(405-tileobj))%3)<<1);
  if (tileobj <=407 && tileobj >= 404) // 4 Frame Animated Walls
    wallpic +=(((gamestate.TimeCount>>(407-tileobj))&3)<<1);
  switch(tileobj)
  {
    case 512:
    case 513:
      SpanAddTrans(pixx, height, wallpic, texture>>6);
      if (tileobj == 513) transdrawn= false; else transdrawn=true;
      return false;
    default:
      SpanAddSolid(wallpic, texture, height);
      break;   
  }
  return true;
}

/*
** Casts ray from viewpoint under [rayangle] angle
*/
void CastRay(int rayangle)
{
   int   xinttile, yinttile;
   int xtile, ytile, xtilestep, ytilestep;
   long xintercept, yintercept, xstep, ystep;
   unsigned xpartial, ypartial;

   transdrawn=false;

   if(rayangle<ANG90)      // [0, 90)
   {
      xtilestep= 1;
      ytilestep=-1;
      xstep= finetangent[ANG90-1-rayangle];
      ystep=-finetangent[rayangle];
      xpartial=xpartialup;
      ypartial=ypartialdown;
   }
   else if(rayangle<ANG180)   // [90, 180)
   {
      xtilestep=-1;
      ytilestep=-1;
      xstep=-finetangent[rayangle-ANG90];
      ystep=-finetangent[ANG180-1-rayangle];
      xpartial=xpartialdown;
      ypartial=ypartialdown;
   }
   else if(rayangle<ANG270)   // [180, 270)
   {
      xtilestep=-1;
      ytilestep= 1;
      xstep=-finetangent[ANG270-1-rayangle];
      ystep= finetangent[rayangle-ANG180];
      xpartial=xpartialdown;
      ypartial=ypartialup;
   }
   else         // [270, 360)
   {
      xtilestep=1;
      ytilestep=1;
      xstep=finetangent[rayangle-ANG270];
      ystep=finetangent[ANG360-1-rayangle];
      xpartial=xpartialup;
      ypartial=ypartialup;
   }

// ----- * Init variables * --------
   yintercept=viewy+FixedByFrac(ystep, xpartial);//((ystep*xpartial)>>16); // xpartialbyystep
   yinttile=yintercept>>16;            // high word of yintercept
   xtile=focaltx+xtilestep;
   
   xintercept=viewx+FixedByFrac(xstep, ypartial);//((xstep*ypartial)>>16); // ypartialbyxstep
   xinttile=xintercept>>16;            // high word of xintercept
   ytile=focalty+ytilestep;

// ---------- * CORE LOOP * -----------
   while(1) // weird, but better then Carmack's self modifying stuff
   {
// --- vertical loop
      while(!(ytilestep==-1 && yinttile<=ytile) && !(ytilestep==1 && yinttile>=ytile))
      {
         if(CheckIntersection(xtile, yinttile, xintercept, yintercept, xstep, ystep, true, xtilestep==-1))
            return;

         spotvis[xtile][yinttile]=true;
         xtile+=xtilestep;
         yintercept+=ystep;
         yinttile=yintercept>>16;
      }

// --- horizontal loop
      while(!(xtilestep==-1 && xinttile<=xtile) && !(xtilestep==1 && xinttile>=xtile))
      {
         if(CheckIntersection(xinttile, ytile, xintercept, yintercept, xstep, ystep, false, ytilestep==-1))
            return;
      
         spotvis[xinttile][ytile]=true;
         ytile+=ytilestep;
         xintercept+=xstep;
         xinttile=xintercept>>16;
      }
   }
}

/*
** Straight Port from assembler
*/
void RayCaster(void)
{
   int rayangle;

// trace one ray per screen column
   for(pixx=0; pixx<viewwidth; pixx++)
   {
      rayangle=midangle+pixelangle[pixx]; // ray angle

      if(rayangle<0) rayangle+=FINEANGLES;
      else if(rayangle>=FINEANGLES) rayangle-=FINEANGLES;

      CastRay(rayangle);
   }
}


Ok... Now REMOVE All the Lines from the:

/*
=====================
=
= DrawScaleds
=
= Draws all objects that are visable
=
=====================
*/

To the (under the DrawPlayersHands routine):

//=============================

And replace it with this:

::: CODE :::

// ------------- * Sprites * -------------
#define MAXVISABLE   50

typedef struct
{
   int viewx;
   int viewheight;
   int shapenum;
} visobj_t;

visobj_t vislist[MAXVISABLE];

/*
** visobj compare function
**
** sorts vislist descending
*/
int VisCmp(const void *a, const void *b)
{
   if(((visobj_t *)a)->viewheight==((visobj_t *)b)->viewheight) return 0;
   return ((visobj_t *)a)->viewheight>((visobj_t *)b)->viewheight?1:-1;
}

/*
** DrawScaleds
**
** Draws all objects that are visable
*/
void DrawScaleds(void)
{
   byte *tilespot, *visspot;
   statobj_t   *statptr;
   objtype *obj;
   visobj_t *visptr;
   unsigned spotloc;
   int n, n_vis;

   visptr=vislist;
   n_vis=0;

// process static objects
   for(statptr=statobjlist; statptr!=laststatobj; statptr++)
   {
      if((visptr->shapenum=statptr->shapenum)==-1)
         continue; // object has been deleted

      if(!spotvis[statptr->tilex][statptr->tiley]) continue; // not visable

      if(TransformTile(statptr->tilex, statptr->tiley, &visptr->viewx, &visptr->viewheight) &&
         statptr->flags&FL_BONUS && statptr->tilex==player->tilex && statptr->tiley==player->tiley)
      {
         GetBonus(statptr);
         continue;
      }

      if(!visptr->viewheight) continue; // to close to the object

// Edit Put your Animated Sprite code here!

      if(n_vis<MAXVISABLE)
      {
         visptr++;
         n_vis++;
      }
   }

// process active objects
   for(obj=player->next; obj; obj=obj->next)
   {
      if(!(visptr->shapenum=obj->state->shapenum)) continue; // no shape

      spotloc=(obj->tilex<<6)+obj->tiley;   // optimize: keep in struct?
      visspot=&spotvis[0][0]+spotloc;
      tilespot=&tilemap[0][0]+spotloc;

      //
      // could be in any of the nine surrounding tiles
      //
      if( *visspot
      || ( *(visspot-1) && !*(tilespot-1) )
      || ( *(visspot+1) && !*(tilespot+1) )
      || ( *(visspot-65) && !*(tilespot-65) )
      || ( *(visspot-64) && !*(tilespot-64) )
      || ( *(visspot-63) && !*(tilespot-63) )
      || ( *(visspot+65) && !*(tilespot+65) )
      || ( *(visspot+64) && !*(tilespot+64) )
      || ( *(visspot+63) && !*(tilespot+63) ) )
      {
         obj->active=true;
         TransformActor(obj);
         if(!obj->viewheight) continue; // too close or far away

         visptr->viewx=obj->viewx;
         visptr->viewheight=obj->viewheight;
//         if(visptr->shapenum==-1)
//            visptr->shapenum=obj->temp1; // special shape

         if(obj->state->rotate)
            visptr->shapenum+=CalcRotate(obj);

         if(n_vis<MAXVISABLE)
         {
            visptr++;
            n_vis++;
         }
         obj->flags|=FL_VISABLE;
      }
      else
         obj->flags&=~FL_VISABLE;
   }

// sort visable objects from back to front
   qsort(vislist, n_vis, sizeof(visobj_t), VisCmp);

   for(n=0, visptr=vislist; n<n_vis; n++, visptr++)
   {
      SpansRender(visptr->viewheight);
      DrawSprite(visptr->shapenum, visptr->viewx, visptr->viewheight, true);
   }
   SpansRender(0x7FFF);   // draw remaining spans
}

//============================
/*
** DrawPlayerWeapon
**
** Draw the player's hands
*/
byte weapon_draw_flag; // how to draw weapon

const int weaponsprite[NUMWEAPONS]=
{
   SPR_KNIFEREADY,
   SPR_PISTOLREADY,
   SPR_MACHINEGUNREADY,
   SPR_CHAINREADY
};

void DrawPlayerWeapon(void)
{
#ifndef SPEAR
   if(gamestate.victoryflag)
   {
      if(player->state==&s_deathcam && (TimeCount&32))
         DrawSprite(SPR_DEATHCAM, viewwidth/2, FIX_HEIGHT(viewheight+1), false);
      return;
   }
#endif

// Draw weapon

   if(weapon_draw_flag)
      DrawSprite(weaponsprite[gamestate.weapon]+gamestate.weaponframe, viewwidth/2,
                        FIX_HEIGHT(viewheight+1), weapon_draw_flag==2?FLAG_TRANSLUCENCY:false);

// Draw demo sign
   if(demorecord || demoplayback)
      DrawSprite(SPR_DEMO, viewwidth/2, FIX_HEIGHT(viewheight+1), false);
}
//=============================



Now... Remove the "WallRefresh" routine and replace it with this:

::: CODE :::

/*
** WallRefresh
*/
void WallRefresh (void)
{
// set up variables for this view
  viewangle = player->angle;
  midangle = viewangle*(FINEANGLES/ANGLES);
  viewsin = sintable[viewangle];
  viewcos = costable[viewangle];
  viewx = player->x - FixedByFrac(focallength,viewcos);
  viewy = player->y + FixedByFrac(focallength,viewsin);
  focaltx = viewx>>TILESHIFT;
  focalty = viewy>>TILESHIFT;
  xpartialdown = viewx&(TILEGLOBAL-1);
  if(xpartialdown==0) xpartialup=0xffff; else xpartialup = TILEGLOBAL-xpartialdown;
  ypartialdown = viewy&(TILEGLOBAL-1);
  if(ypartialdown==0) ypartialup=0xffff; else ypartialup = TILEGLOBAL-ypartialdown;
  postwidth=0; // the first pixel is on a new wall
  RayCaster();
  SpanFlush(); // draw last span
}


Now Edit the Beginning of the ThreeDRefresh routine so that it looks like this:

::: CODE :::

void   ThreeDRefresh (void)
{
   int tracedir;

// this wouldn't need to be done except for my debugger/video wierdness
   outportb (SC_INDEX,SC_MAPMASK);

   memset(spotvis, 0, sizeof(spotvis));      // clear out the traced array
   
   spotvis[player->tilex][player->tiley]=1;    // set player spot
   min_wallheight=0xFFFF;                      // reset min_wallheight
   SpansReset();                               // reset span data
   
   bufferofs += screenofs;                     // Set Screen Buffer

   // Special Lighting Check
   if (godmode) spec_lt = lighttable[16]; else spec_lt = NULL;
// weapon draw flags
   weapon_draw_flag=1;          // 1 = draw  2 = transparent 0 = don't draw

   VGAClearScreen ();  // And so on... Only lines above this are changed


So you edit the ThreeDRefresh routine from the top to the "VGAClearScreen" call to make it look like the above.

That's it for the main changes in this file UNLESS you want shaded floors and ceilings when the game draws the original solid coloured ceiling/floor...

If you do then.. you now have to remove everything from the first lines of:

//===================================

unsigned vgaCeiling[]=

To the end of the "VGAClearScreen" routine and replace that with:

::: CODE :::

/*
=====================
=
= ClearScreen
=
=====================
*/
/*
** Draw Solid Ceiling
*/
void DrawCeiling(byte color)
{
   int halfheight, y;
   unsigned w;
   byte c;

   VGAMAPMASK(15);

   halfheight=viewheight>>1;
   w=viewwidth/8;
   for(y=0; y<halfheight; y++)
   {
      if(spec_lt)
         c=spec_lt[color];
      else
         c=lt[(halfheight-y-1)>>1][color];

      asm mov es,[screenseg]
      _DI=bufferofs+ylookup[y];
      asm mov al,[c]
      asm mov ah,al
      asm mov cx,[w]
      asm rep stosw
   }
}

/*
** Draw Solid Floor
*/
void DrawFloor(byte color)
{
   int halfheight, y;
   unsigned w;
   byte c;

   VGAMAPMASK(15);

   halfheight=viewheight>>1;
   w=viewwidth/8;
   for(y=0; y<halfheight; y++)
   {
      if(spec_lt)
         c=spec_lt[color];
      else
         c=lt[y>>1][color];

      asm mov es,[screenseg]
      _DI=bufferofs+ylookup[halfheight+y];
      asm mov al,[c]
      asm mov ah,al
      asm mov cx,[w]
      asm rep stosw
   }
}


Now go back to the ThreeDRefresh routine and change the line:

::: CODE :::

VGAClearScreen ();


to this:

::: CODE :::

DrawCeiling(0x00);       // Clear Ceiling (colour)
DrawFloor(0x19);      // Clear Floor (colour)


The values "0x00" and "0x19" are from the palette as show below:



Where 0x00 = Black and so on... You can set the colours to any value you'd like... If you want them to change based on the level you are on you can do something like this:

::: CODE :::

byte ceilingcolour[6][10]= {
  {0x00,0x19,0x19,0x24,0x56,0x47,0x19,0x38,0x19,0x05}, // Episode 1 Ceiling Colours
  {0x00,0x19,0x19,0x24,0x56,0x47,0x19,0x38,0x19,0x05}, // Episode 2 Ceiling Colours
  {0x00,0x19,0x19,0x24,0x56,0x47,0x19,0x38,0x19,0x05}, // Episode 3 Ceiling Colours
  {0x00,0x19,0x19,0x24,0x56,0x47,0x19,0x38,0x19,0x05}, // Episode 4 Ceiling Colours
  {0x00,0x19,0x19,0x24,0x56,0x47,0x19,0x38,0x19,0x05}, // Episode 5 Ceiling Colours
  {0x00,0x19,0x19,0x24,0x56,0x47,0x19,0x38,0x19,0x05}};// Episode 6 Ceiling Colours

byte floorcolour[6][10]= {
  {0x19,0x19,0x19,0x00,0x19,0x47,0x19,0x38,0x19,0x05}, // Episode 1 Floor Colours
  {0x19,0x19,0x19,0x00,0x19,0x47,0x19,0x38,0x19,0x05}, // Episode 2 Floor Colours
  {0x19,0x19,0x19,0x00,0x19,0x47,0x19,0x38,0x19,0x05}, // Episode 3 Floor Colours
  {0x19,0x19,0x19,0x00,0x19,0x47,0x19,0x38,0x19,0x05}, // Episode 4 Floor Colours
  {0x19,0x19,0x19,0x00,0x19,0x47,0x19,0x38,0x19,0x05}, // Episode 5 Floor Colours
  {0x19,0x19,0x19,0x00,0x19,0x47,0x19,0x38,0x19,0x05}};// Episode 6 Floor Colours

   DrawCeiling(ceilingcolour[gamestate.episode][gamestate.mapon]);   // Clear Ceiling (colour)
   DrawFloor(floorcolour[gamestate.episode][gamestate.mapon]);   // Clear Floor (colour)



With this code... you just change the colour values you want for each of the floors... Use the palette chart above to choose the colours you require.

Now back to the rest of the code changes for using Darkone's raycastor.....

Now open WL_MAIN.C and find the "InitGame" routine.

Remove the Line:

::: CODE :::

SetupWalls ();


And below the line: NewViewSize (viewsize); Add this line:

::: CODE :::

LightTableSetup();


This will enable the lightshading (which is vastly different than Ripper's).

Now remove the SetupWalls routine completely.. and all the other occurances of the name "SetupWalls" from the WL_MAIN.C file.

Now go to the "SetUpViewSize" routine and remove the line that says:

::: CODE :::

   SetupScaling (viewwidth*1.5);


That's it for the wl_main.c file...

Open the "wl_debug.c" file and remove completely the "ShapeTest" routine.

And also remove this code from within that file (DebugKeys):

::: CODE :::

   else if (Keyboard[sc_T])         // T = shape test
   {
      ShapeTest ();
      return 1;
   }


Now to fix some of the Bugs in his code:

Open the WL_ACT1.C file.

Go to the SpawnDoor routine and remove the lines:
::: CODE :::

tilemap[tilex][tiley-1] |= 0x40;
tilemap[tilex][tiley+1] |= 0x40;

and
::: CODE :::
      
tilemap[tilex-1][tiley] |= 0x40;
tilemap[tilex+1][tiley] |= 0x40;


Now change the line:
::: CODE :::

doorposition[doornum] = 0;      // doors start out fully closed


to read:

::: CODE :::

lastdoorobj->position = 0;  // doors start out fully closed


By removing the lines above and some other changes you will make a little further below, you are enabling the use of 90 wall tiles rather than the standard 64 max and all 90 wall tiles can be a pushwall.

Now go to the DoorOpening routine and replace:

::: CODE :::

position = doorposition[door];


with:

::: CODE :::

position = doorobjlist[door].position;


and then at the end of that routine change:

::: CODE :::

doorposition[door] = position;


to:

::: CODE :::
   
doorobjlist[door].position = position;


Now we move onto the DoorClosing routine and replace the same lines we did in the DoorOpen routine. Change:

::: CODE :::

position = doorposition[door];


with:
::: CODE :::

position = doorobjlist[door].position;


And then at the end of the routine change:

::: CODE :::

doorposition[door] = position;


to:

::: CODE :::

doorobjlist[door].position = position;


Now there is one other bug that is still in place... Guards can't see you through transparent walls and neither of you can shoot through them.. To fix that we open the WL_STATE.C file and
find the routine "boolean CheckLine (objtype *ob)".

Change the line:

::: CODE :::

int   x,y;


to look like this:

::: CODE :::

   int   x,y,value2;


Now search a little further down in the routine and find:

::: CODE :::

value = (unsigned)tilemap[x][y];


below that line add:

::: CODE :::

value2=MAPSPOT (x,y,1);   


And then find:

::: CODE :::

if (!value) continue; // Nothing there


and add this above that line:

::: CODE :::

if(value2 == 512) continue; // Transparent Wall   - allow player/guard to react/shoot through

Now we repeat these find a little further on in the same routine so again, look for the next:

::: CODE :::

value = (unsigned)tilemap[x][y];


and below that add:

::: CODE :::

value2=MAPSPOT (x,y,1);   


And then find the line:

::: CODE :::

if (!value) continue;


And above that line add:

::: CODE :::

if(value2 == 512) continue; // Transparent Wall   - allow player/guard to react/shoot through


You will also see two (2) occurances of:

::: CODE :::

         if (intercept>doorposition[value])
            return;


And those 2 lines need to be changed to read:

::: CODE :::

         if (intercept>doorobjlist[value&0x3F].position)
            return;

Now with all of that done... You can save and close all of those files you've just edited.
Now start up Borland C++ (if you aren't in it already - as some of us use different editors to work on the code before we compile)... and go to the project box and highlight the following files (one at a time) and then hit the delete key to remove them from your source.. as they aren't required anymore.... Those files are:

WL_DRW_A.ASM
WL_SCALE.C


Now... if you have done everything correctly.. you can compile, and will now have the ability to do transparent doors and walls and animated walls. You will have to define them in your MAPEDIT "OBJDATA.WL6" file as follows:

0190 c0e0 Mod:3Frame Animated Wall - Slow
0191 c0e0 Mod:3Frame Animated Wall - Normal
0192 c0e0 Mod:3Frame Animated Wall - Fast
0193 c0e0 Mod:3Frame Animated Wall - UltraFast
0194 a0e0 Mod:4Frame Animated Wall - Slow
0195 a0e0 Mod:4Frame Animated Wall - Normal
0196 a0e0 Mod:4Frame Animated Wall - Fast
0197 a0e0 Mod:4Frame Animated Wall - UltraFast
0200 e0e0 Mod:Transparent Wall
0201 d0e0 Mod:Transparent Door

To use these modifiers in Mapedit you have to follow the following order as mapedit will not allow sprite defines to be placed in/on walls (unless it's the Pushwall Modifier). So... to use the modifiers above.. you first place a "Floor Value" on the map where you want this modifier to go... then you place the modifier on the map... then you place the wall or doortype on the modifier.

I will not tell you how to do animated transparent walls or animated transparent doors... but I will say that it requires a little more code and a few more object data defines.

That's about it... This will give you the ability to do transparent walls. Unfortunately, they must be used as "WALL TRANSWALL WALL TRANSWALL WALL" etc... I'm not releasing my fix for that just yet. But with the code... some time... and a lot of studying, you will be able to make the proper changes required to add a new define and fix the problem (I've just given a hint).

I think I've included all the changes made to everything. You will probably find that there are some values defined in various files like WL_DEF.H and such that are no longer required. If this tutorial doesn't work for you... It's up to you to find any variables or things that I've missed... I tried to extract this code from my code as best I could, and again, I think I have included all the changes I made. If I haven't... this will give you a very large headstart on completing the same thing I attempted for WolfAdvanced.

Anyhow... Enjoy your new Transparent Doors and Walls...

Greg
BrotherTank

Edited: Fixed a flaw in the DrawScaleds routine for animated sprites... you will have to define your own code for making animated sprites or dig the rest of it out of Darkone's original source.

Greg
BrotherTank

FINAL EDIT: As of FEB 10, 2005 - The tutorial has been edited and I installed it into a fresh copy of the wolf source. This Works 100% and gives you the ability to use Darkone's Raycastor.

NOTE: Again, this tutorial will break other tutorials. It doesn't require Ripper's "Removing the Scalers" and "Shading" tutorials as those are already part of this. It will not work with Ripper's Directional Sprites Tutorial unless Ripper writes a new tutorial to follow this Raycastor code from Darkone.

Many of the other tutorials will have to be modified to suit this Raycastor code as well. You will soon find that some of the things you need for those other tutorials are no longer part of the code.

As I said previously, this code is NOT for beginners and actually requires that you know the wl_draw.c file VERY well. It does work if you install it properly. I have tested it as posted above and it works just fine.

If you can't get this working now, please don't ask me as you haven't done what the tutorial says to do.

Also, I will not explain to anyone any other changes that I have made to the code reguarding the "Raycastor" OR how to modify any other Tutorials that you can't install because you've installed this!


Edit: 03-15-2007 - Fixed and compressed the code slightly. This is TESTED and WORKING 100% if installed into a Virgin copy of the Wolf3d Software. I may do a little more compression with the ceiling/floor colour selection and edit the tutorial to make it a little neater and take less memory... Smile

Enjoy... Greg Brother Tank Tank


Last edited by BrotherTank on Thu Mar 15, 2007 9:55 pm; edited 13 times in total
TexZK
DieHard SS
DieHard SS


Joined: 07 Feb 2004
Last Visit: 17 Oct 2016

Topics: 19
Posts: 370
Location: Northern Italy
italy.gif

PostPosted: Wed Nov 24, 2004 12:24 pm
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Impressive!!! A whole topic to "rewrite" the engine... Excellent work, Greg! ;-D

Unfortunately it doesn't work with many of Ripper's tutorials, which are in WFF.
andy3012
DieHard Guard
DieHard Guard


Joined: 02 Jul 2004
Last Visit: 15 Feb 2008

Topics: 29
Posts: 292
Location: England
uk.gif

PostPosted: Wed Nov 24, 2004 12:42 pm
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Oooh Very Nice... I wanted to start Fresh on my project anyway, as all the files had started to get messy and buggy....

EDIT:

I am having troubles with the Calc Height function in wl_draw its saying there are undefined functions i.e minwallheight (or something similar) is this just my nasty coding or what?
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Wed Nov 24, 2004 4:26 pm
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

andy3012 wrote:
Oooh Very Nice... I wanted to start Fresh on my project anyway, as all the files had started to get messy and buggy....

EDIT:

I am having troubles with the Calc Height function in wl_draw its saying there are undefined functions i.e minwallheight (or something similar) is this just my nasty coding or what?


Umm again... as I said.. I tried to move everything over but I guess I missed a few variables... minwallheight is a variable. In this case I will add this line:

unsigned min_wallheight;

Again, as it says in the tutorial... It's up to you to fix it if it doesn't work.

Greg
BrotherTank
andy3012
DieHard Guard
DieHard Guard


Joined: 02 Jul 2004
Last Visit: 15 Feb 2008

Topics: 29
Posts: 292
Location: England
uk.gif

PostPosted: Thu Nov 25, 2004 8:21 am
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

ah cheers mate...
Zombie_Plan
DieHard Wolfer
DieHard Wolfer


Joined: 12 Oct 2004
Last Visit: 07 Jun 2016

Topics: 101
Posts: 1614
Location: A hole in the wall
australia.gif

PostPosted: Sun Dec 05, 2004 11:07 pm
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Um, can someone who has got htis to work please send it to me, as I spent almost three days on this and couldn't work out the problems. It really annoyed me. Evil or Very Mad

_________________
Zombieskittles

Welcome to 2016, where DHW still thinks it is okay to ban the world's most popular email service provider, and I can't have an avatar over 10kb
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Thu Feb 10, 2005 6:02 pm
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

The Tutorial HAS been updated. If you previously installed it and DIDN'T get it working because you don't understand the code or didn't know how to fix it, it now works as posted in the first post.

There may be bugs, but those are left over from Darkone's code. It's up to you to remove or fix any problems you might find.

Also Note: This tutorial is not compatible with some other tutorials. YOU will have to adjust them as you see fit. I am not the author of those other tutorials so I will NOT show you how to make them work with this code.

This code is not for beginners! I suggest that anyone using this code make sure that you understand the workings of this new wl_draw.c file completely before you try to make any other changes to the code.

I will say that you can modify Adam Biser's patchwall routines and the other tutorials to work with this code but again, I will NOT do it for you.

With that said, people like DeathsHead and Flamer64 (as examples) should not ask for help when you are using this code. I don't know of anyone else using it other than myself and I will not be your answer guide.

Greg
BrotherTank
Ripper
Code Master - Developer
Code Master - Developer


Joined: 15 Mar 2003
Last Visit: 30 Sep 2008

Topics: 21
Posts: 527
Location: Germany
blank.gif

PostPosted: Mon Feb 14, 2005 8:42 am
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

HiRes modifications for DarkOne's raycaster:

In CheckIntersection() replace all
::: CODE :::
texture=([x OR y]global>>4)&0xFC0;
by
::: CODE :::
texture=([x OR y]global>>2)&0x3f80;

and all
::: CODE :::
texture=0xfc0-texture;
by
::: CODE :::
texture=0x3f80-texture;

Also replace all
::: CODE :::
SpanAddTrans(pixx,height,wallpic,texture>>6);
by
::: CODE :::
SpanAddTrans(pixx,height,wallpic,texture>>7);


In DoorIntercept() replace
::: CODE :::
return ((intercept-doorobjlist[door].position)>>4)&0xFC0;
by
::: CODE :::
return ((intercept-doorobjlist[door].position)>>2)&0x3f80;


In DrawSpan() replace
::: CODE :::
for(v=0; v<64;v++)
{
   y1=y2;
   y+=dy;
   y2=(y>>16)+y0;
by
::: CODE :::
for(v=0; v<128;v++)
{
   y1=y2;
   y+=dy;
   y2=(y>>17)+y0;


In DrawSprite() replace
::: CODE :::
byte tex[64], far *src;
by
::: CODE :::
byte tex[128], far *src;

and
::: CODE :::
for(u=0; u<64;u++)
{
   x1=x2;
   x+=dx;
   x2=(x>>16)+x0;
by
::: CODE :::
for(u=0; u<128;u++)
{
   x1=x2;
   x+=dx;
   x2=(x>>17)+x0;


In SpansRender() replace
::: CODE :::
     DrawSpan(span->x, span->width, ((span->fixheight)>>2)&~1,
         (byte far *)PM_GetPage(span->tex_page)+(span->tex_off<<6), true);
by
::: CODE :::
     DrawSpan(span->x, span->width, ((span->fixheight)>>2)&~1,
         (byte far *)PM_GetPage(span->tex_page)+(span->tex_off<<7), true);


So, that should be enough.
Tell me whether it works or not, I didn't test it at all, as I'm too lazy to try the whole tutorial Mr Green
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Tue Feb 15, 2005 12:56 pm
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

:LOL:

Very good Ripper. Works fine now (installed the sound fix from the updated tutorial).

As for the Raycastor switch... you should give it a go, as I'd like to know how to rework the directional sprites to work with it. I've managed to convert all the other tutorials over (cloudy sky and outside atmosphere) but the directional sprites is eluding me...

Greg
BrotherTank
andy3012
DieHard Guard
DieHard Guard


Joined: 02 Jul 2004
Last Visit: 15 Feb 2008

Topics: 29
Posts: 292
Location: England
uk.gif

PostPosted: Wed Feb 23, 2005 12:12 pm
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Just out of curiosity, i havn't read this post yet, but now that it is fxed and stuff, could you name all of the possible tutorials that will not work with this new engine, or at least you don't know how to do it.
Haasboy
DieHard Officer
DieHard Officer


Joined: 23 Jul 2003
Last Visit: 04 Dec 2017

Topics: 58
Posts: 581
Location: South Africa, Johannesburg
southafrica.gif

PostPosted: Wed Feb 23, 2005 2:10 pm
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

He's explained that already.

BrotherTank wrote:
Also Note: When using this change, you will have to change or modify the tutorials for Textured Ceilings/Floors and Ripper's Starry Sky and Cloudy Sky routines where it does the lightshading. Ripper's Directional Sprites are NOT compatible with this modification. To create Directional Sprites you will have to rewrite the complete code for that tutorial (which is something I haven't even tried at this time). Also, you will NOT be able to use Ripper's shading tutorial or his Removing the Scalers tutorial as well (they aren't needed).

Basically most of Ripper's tutorials don't work with the new Raycastor.

I think that there are a few other tutorials out there that may have to be changed a bit in order for it to work with the code, but they do work.

_________________
Haasboy Engine - Currently under construction (To be used with future mods - F.A.D.E.D. - Mansion X - Rising Evil Series)
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Wed Feb 23, 2005 2:37 pm
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

andy3012 wrote:
Just out of curiosity, i havn't read this post yet, but now that it is fxed and stuff, could you name all of the possible tutorials that will not work with this new engine, or at least you don't know how to do it.


Holy S@#T Batman!!!!!

If you'd read the thread, then you wouldn't have asked. Once again for the reading impared:

Will Not Work:

Ripper's Directional 3d Sprites


Not Required: (as when you change the raycastor these are already done ala Darkone):

Rippers Removing the Scalers
Rippers Shading

Will Work With Adjustment:

Any other tutorial that plays with the WL_DRAW.C file. With these tutorials you will have to adjust them to suit the new raycastor code. That I leave up to you.

BrotherTank


From the Movie SpaceBalls:

DarkHelmet: How many assholes do we have on this ship??
(Many people stand up)....
DarkHelemt: I knew it.... I'm surrounded by assholes.... Keep firing Assholes.....

_________________

The probability of someone watching you is directly related to the Stupidity of your actions
&
The two most abundant things in the Universe are Hydrogen & Stupidity - H.Ellison

Which of those is more relevant to you??
Guest




Last Visit:





PostPosted: Sat Mar 19, 2005 10:08 am
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Brother Tank mentioned that a few code changes could make animated transparent walls and animated transparent doors.

Here is how to do it.
Locate these lines
::: CODE :::

yglobal=((long)ytile<<16)+0x8000;
       wallpic=DOORWALL+door_tex[doorobjlist[door_index].lock];
    }

After add
::: CODE :::

switch(tileobj)
   {
   case 416: // 3frame animation slow door
   case 424: // 3frame animation slow transparent door
      wallpic+=((gamestate.TimeCount>>5)%3)<<1; // 2.1875 fps
      break;
   case 417: // 3frame animation normal door
   case 425: // 3frame animation normal transparent door
      wallpic+=((gamestate.TimeCount>>4)%3)<<1; // 4.375 fps
      break;
   case 418: // 3frame animation fast door
   case 426: // 3frame animation fast transparent door
      wallpic+=((gamestate.TimeCount>>3)%3)<<1; // 8.75 fps
      break;
   case 419: // 3frame animation ultra door
   case 427: // 3frame animation ultra transparent door
      wallpic+=((gamestate.TimeCount>>2)%3)<<1;   // 17.5 fps
      break;
   case 420: // 4frame animation slow door
   case 428: // 4frame animation slow transparent door
      wallpic+=((gamestate.TimeCount>>5)&3)<<1; // 2.1875 fps
      break;
   case 421: // 4frame animation normal door
   case 429: // 4frame animation normal transparent door
      wallpic+=((gamestate.TimeCount>>4)&3)<<1; // 4.375 fps
      break;
   case 422: // 4frame animation fast door
   case 430: // 4frame animation fast transparent door
      wallpic+=((gamestate.TimeCount>>3)&3)<<1; // 8.75 fps
      break;
   case 423: // 4frame animation ultra door
   case 431: // 4frame animation ultra transparent door
      wallpic+=((gamestate.TimeCount>>2)&3)<<1;   // 17.5 fps
      break;
   }

Immediately after you will find these lines
::: CODE :::

 height=CalcHeightEx(xglobal, yglobal);

    if(tileobj == 513 ) // transparent door
          {

Change the if(tileobj==513) // transparent door to this.
::: CODE :::

 if((tileobj>= 423 && tileobj<= 431)||tileobj == 513 ) // transparent door


This will be animated doors and transparent animated doors.
Then replace all the lines from
// ------------ * Wall * -----------
to
// ----------- * usuall * -------------
with this
::: CODE :::

  if(((tileobj==512 || (tileobj >= 408 && tileobj >= 415 ))&& vertical) // transparent vertical wall
   {
      if(transdrawn) return false;
      if(vertical)
      {
    yglobal+=dy>>1;   // halftile forward
    if(yglobal>>16!=ytile) return false;
    xglobal=((long)xtile<<16)+0x8000;
    texture=(yglobal>>4)&0xFC0;
      }

      height=CalcHeightEx(xglobal, yglobal);
      wallpic=((tilehit-1)<<1)+1;
      switch(tileobj)
   {
   case 408: // 3frame animation slow transparent wall
      wallpic+=((gamestate.TimeCount>>5)%3)<<1; // 2.1875 fps
      break;
   case 409: // 3frame animation normal transparent wall
      wallpic+=((gamestate.TimeCount>>4)%3)<<1; // 4.375 fps
      break;
   case 410: // 3frame animation fast transparent wall
      wallpic+=((gamestate.TimeCount>>3)%3)<<1; // 8.75 fps
      break;
   case 411: // 3frame animation ultra transparent wall
      wallpic+=((gamestate.TimeCount>>2)%3)<<1;   // 17.5 fps
      break;
   case 412: // 4frame animation slow transparent wall
      wallpic+=((gamestate.TimeCount>>5)&3)<<1; // 2.1875 fps
      break;
   case 413: // 4frame animation normal transparent wall
      wallpic+=((gamestate.TimeCount>>4)&3)<<1; // 4.375 fps
      break;
   case 414: // 4frame animation fast transparent wall
      wallpic+=((gamestate.TimeCount>>3)&3)<<1; // 8.75 fps
      break;
   case 415: // 4frame animation ultra  transparent wall
      wallpic+=((gamestate.TimeCount>>2)&3)<<1;   // 17.5 fps
      break;
   }
      SpanAddTrans(pixx, height, wallpic, texture>>6);
      transdrawn=true;

      return false;
   }

   if((tileobj==512 || tileobj == 408 || tileobj == 409 || tileobj == 410 || tileobj == 411 || tileobj == 412 || tileobj == 413 || tileobj == 414 || tileobj == 415 ) && !vertical) // transparent horizontal wall
   {
      if(transdrawn) return false;
      if(!vertical)
      {
    xglobal+=dx>>1;   // halftile forward
    if(xglobal>>16!=xtile) return false;
    yglobal=((long)ytile<<16)+0x8000;
    texture=(xglobal>>4)&0xFC0;
      }

      height=CalcHeightEx(xglobal, yglobal);
      wallpic=(tilehit-1)<<1;
      switch(tileobj)
   {
   case 408: // 3frame animation slow transparent wall
      wallpic+=((gamestate.TimeCount>>5)%3)<<1; // 2.1875 fps
      break;
   case 409: // 3frame animation normal transparent wall
      wallpic+=((gamestate.TimeCount>>4)%3)<<1; // 4.375 fps
      break;
   case 410: // 3frame animation fast transparent wall
      wallpic+=((gamestate.TimeCount>>3)%3)<<1; // 8.75 fps
      break;
   case 411: // 3frame animation ultra transparent wall
      wallpic+=((gamestate.TimeCount>>2)%3)<<1;   // 17.5 fps
      break;
   case 412: // 4frame animation slow transparent wall
      wallpic+=((gamestate.TimeCount>>5)&3)<<1; // 2.1875 fps
      break;
   case 413: // 4frame animation normal transparent wall
      wallpic+=((gamestate.TimeCount>>4)&3)<<1; // 4.375 fps
      break;
   case 414: // 4frame animation fast transparent wall
      wallpic+=((gamestate.TimeCount>>3)&3)<<1; // 8.75 fps
      break;
   case 415: // 4frame animation ultra transparent wall
      wallpic+=((gamestate.TimeCount>>2)&3)<<1;   // 17.5 fps
      break;
   }
      SpanAddTrans(pixx, height, wallpic, texture>>6);
      transdrawn=true;

      return false;
   }

Like this you enable transparent animated walls.

To add definitions in mapedit open your objdata file and at the end paste this.
::: CODE :::

0198 30e0 Mod:3Frame Animated Wall - Slow Transwall
0199 30e0 Mod:3Frame Animated Wall - Normal Transwall
019a 30e0 Mod:3Frame Animated Wall - Fast TransWall
019b 30e0 Mod:3Frame Animated Wall - UltraFast Transwall
019c 40e0 Mod:4Frame Animated Wall - Slow Transwall
019d 40e0 Mod:4Frame Animated Wall - Normal Transwall
019e 40e0 Mod:4Frame Animated Wall - Fast Transwall
019f 40e0 Mod:4Frame Animated Wall - UltraFast Transwall
01a0 90e0 Mod:3Frame Animated Door - Slow
01a1 90e0 Mod:3Frame Animated Door - Normal
01a2 90e0 Mod:3Frame Animated Door - Fast
01a3 90e0 Mod:3Frame Animated Door - UltraFast
01a4 60e0 Mod:4Frame Animated Door - Slow
01a5 60e0 Mod:4Frame Animated Door - Normal
01a6 60e0 Mod:4Frame Animated Door - Fast
01a7 60e0 Mod:4Frame Animated Door - UltraFast
01a8 90e0 Mod:3Frame Animated Door - Slow Transparent
01a9 90e0 Mod:3Frame Animated Door - Normal Transparent
01aa 90e0 Mod:3Frame Animated Door - Fast Transparent
01ab 90e0 Mod:3Frame Animated Door - UltraFast Transparent
01ac 60e0 Mod:4Frame Animated Door - Slow Transparent
01ad 60e0 Mod:4Frame Animated Door - Normal Transparent
01ae 60e0 Mod:4Frame Animated Door - Fast Transparent
01af 60e0 Mod:4Frame Animated Door - UltraFast Transparent


Have fun with all these animated transparent walls.

You may also want to know that i got textured floor and ceiling to work with no changes. The modifications in CalcHeightEx(before it was calcheight) are already made.

I still need to add the shading to the textured floor ceiling. But i`ll do that soon.

Also for those newbie coders that want this but have difficulties to do this, in some days i will make available for download on my website a compiled exe and the source with this code.
Guest




Last Visit:





PostPosted: Fri Mar 25, 2005 3:39 am
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

don`t know if you`ve noticed this and i`m looking for a solution now. When you push a wall it will become screen garbage.
andy3012
DieHard Guard
DieHard Guard


Joined: 02 Jul 2004
Last Visit: 15 Feb 2008

Topics: 29
Posts: 292
Location: England
uk.gif

PostPosted: Fri Mar 25, 2005 9:16 am
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Damn this i really love this engine but being a noob coder I just can't get it too work! I'm going to try it again, because knowing me i missed something lol...

Edit:

Yes i got it to compile, but i get this one warning in wl_draw.c

Quote:
Warning WL_Draw.c 32: redefinition of 'VGAMAPMASK' is not identical


and then when i load the game all is fine, until it reaches the "Get psyched Screen" the bar moves a tad and then the game quits out. loaded is in VMD sound to see what the error message is and i get this.
Quote:
The NTVDM CPU has encountered an illegal instruction.
CS:e9ac IP:1aa5 OP:0f 00 00 00 00 chose 'Close to terminate the application.


can anybody lend us a hand? Im going to try messing around with the code, moving stuff, to see if i can get it to work.
Guest




Last Visit:





PostPosted: Sat Mar 26, 2005 12:59 am
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I got the VGAMAPMASK error too. I think it is because it was already defined in WL_def.h . TO fix this problem i added the following line before the declaration VGAMAPMASK in WL_Draw.c

::: CODE :::

#undef VGAMAPMASK
#define VGAMAPMASK(x) asm {cli;mov dx,SC_INDEX;mov al,SC_MAPMASK;mov ah,x;out dx,ax;sti;}


Also if you visit my website in a few days i will add the source code and the compiled exe with this code.
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Sat Mar 26, 2005 7:09 am
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

There are two places in the source where the "VGAMAPMASK" is defined....

The first is in the "wl_draw.c" file (as it states in the tutorial) and the second is that it is already defined in "id_vh.h" file. Chances are that the one in supplied in the tutorial is not exact to the one in the id_vh.h file... ie: different spacing... it's a simple fix to just space the two lines exactly the same.

Greg
BrotherTank
andy3012
DieHard Guard
DieHard Guard


Joined: 02 Jul 2004
Last Visit: 15 Feb 2008

Topics: 29
Posts: 292
Location: England
uk.gif

PostPosted: Sat Mar 26, 2005 11:47 am
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

well that warning has gone and all compiles perfectly, i deleted the two unessary files. And the game still quits out at the get psyched screen, Yawn i might just wait for flamer to relase the compiled source code...
Guest




Last Visit:





PostPosted: Sat Mar 26, 2005 12:18 pm
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Andy i put the raycaster to download from my website. Though i still don`t have a downloads page. You can download it on the project page.

EDIT:
I ADDED IT ANDY. JUST GO HERE http://www.freewebtown.com/wolfingdays/Opsuper.html
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 15:18 ago.

Topics: 160
Posts: 8007
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Sat Mar 26, 2005 7:52 pm
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

OT: Flamer - Your web site is starting to become a pretty interesting page. I'll admit I wasn't very excited about it when I viewed it the very first time, but it's grown and developed since then. Even though the link is displayed every time you post, I still might Bookmark it. Smile
Guest




Last Visit:





PostPosted: Sun Mar 27, 2005 12:27 am
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thanks tripod. But it still has some problems and needs to be developed.
andy3012
DieHard Guard
DieHard Guard


Joined: 02 Jul 2004
Last Visit: 15 Feb 2008

Topics: 29
Posts: 292
Location: England
uk.gif

PostPosted: Sun Mar 27, 2005 12:47 am
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

cool, but what kind of problems, personally i think that their should be like a new forum section dedicated to this engine.

Bugga, i just realised my engine worked all the time, I just didnt copy over any of the new vga files Sick and i just deleted it perminantly. I think ill do it again, at least this time i know what im doing!

Edit: Oh yes, and with the high res thing, it works fine, until i use adams high res vswap, and then the screen goes black (By the way i realised i kept some backed up so Laughing. )

Final Edit: I've decided to give up on using this engine, maybe for another mod after this one, it's just this one is limited on features and i want ones that i don't know how to do with this engine. So in sorry to bug ya Flamer and BT, and thanks for the help
Zombie_Plan
DieHard Wolfer
DieHard Wolfer


Joined: 12 Oct 2004
Last Visit: 07 Jun 2016

Topics: 101
Posts: 1614
Location: A hole in the wall
australia.gif

PostPosted: Tue Mar 29, 2005 2:18 am
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I discovered that with a few obvious tweaks, invisible weapons and light amplification can easily be implemented. Simply find this section of the ThreeDRefresh routine (WL_DRAW.C):

::: CODE :::

   // Special Lighting Check
   if (godmode) spec_lt = lighttable[16]; else spec_lt = NULL;
// weapon draw flags
   weapon_draw_flag=1;          // 1 = draw  2 = transparent 0 = don't draw


And make it look like:

::: CODE :::

   // Special Lighting Check
   if (godmode) spec_lt = lighttable[16]; else spec_lt = NULL;
// weapon draw flags
   weapon_draw_flag=1;          // 1 = draw  2 = transparent 0 = don't draw
   if (gamestate.invisible) weapon_draw_flag=2;                            //invisibility effect
   if (gamestate.light) spec_lt = lighttable[0]; else spec_lt = NULL;  //no shading


Of course, you have to use the invisibility tutorial that BT supplied in a tutorial here, and make the necessary variables, but it works all the same.[/code]

_________________
Zombieskittles

Welcome to 2016, where DHW still thinks it is okay to ban the world's most popular email service provider, and I can't have an avatar over 10kb
Jaapio
Can I Play Daddy
Can I Play Daddy


Joined: 26 Nov 2005
Last Visit: 11 Feb 2009

Topics: 4
Posts: 32

blank.gif

PostPosted: Thu Dec 01, 2005 12:04 pm
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Nice but the gun is not quite transparent.
Zombie_Plan
DieHard Wolfer
DieHard Wolfer


Joined: 12 Oct 2004
Last Visit: 07 Jun 2016

Topics: 101
Posts: 1614
Location: A hole in the wall
australia.gif

PostPosted: Sat Dec 03, 2005 12:29 am
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

It's not really meant to be Laughing . You obviously havnt played Doom before Wink

_________________
Zombieskittles

Welcome to 2016, where DHW still thinks it is okay to ban the world's most popular email service provider, and I can't have an avatar over 10kb
Jaapio
Can I Play Daddy
Can I Play Daddy


Joined: 26 Nov 2005
Last Visit: 11 Feb 2009

Topics: 4
Posts: 32

blank.gif

PostPosted: Sat Dec 03, 2005 6:51 am
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Well I have played doom but the effect is just a little different. You can see through the "transperant" things a litle bit.
Jaapio
Can I Play Daddy
Can I Play Daddy


Joined: 26 Nov 2005
Last Visit: 11 Feb 2009

Topics: 4
Posts: 32

blank.gif

PostPosted: Sun Dec 04, 2005 7:27 am
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Ripper you forgot only one thing:
change:
memset(tex, 0xFF, 64);
to:
memset(tex, 0xFF, 128);
Or you get all messed up sprites.

Greetz J.
Jaapio
Can I Play Daddy
Can I Play Daddy


Joined: 26 Nov 2005
Last Visit: 11 Feb 2009

Topics: 4
Posts: 32

blank.gif

PostPosted: Mon Dec 05, 2005 2:13 pm
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I am trying to make the walls taller but I have a small problem. The bottom row is scalled correct but the upper part is all messedup it is rotated in strips of 5 or 10 pixels instead of 1 or 2 so I got really bad looking top rows in the walls(and doors).
Im using high res textures and I changed in drawspans:
y0=(viewheight-spanheight)>>1;
To:
y0=(viewheight-(spanheight*3))>>1;
and
for(v=0; v<128;v++) // 128 was 64 for low res
To:
for(v=-128; v<128;v++)

Im alsow using the textures on floor and ceiling feature, a changed the draw ofset for the ceiling to match the height of the new walls
(wallheight*3 ) somewhere in its code.

Ill see if I can get an screen shot somehow (printscreen does not seem to work) so you guys can get a bit a better idea of what Im talking about.

Greetz Jaap.

Edit: for the sprites I used an other drawspan function so they do draw normal and not twice.
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 30 Oct 2017

Topics: 55
Posts: 2115
Location: Canada
blank.gif

PostPosted: Mon Dec 05, 2005 8:37 pm
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Jaapio wrote:
Ill see if I can get an screen shot somehow (printscreen does not seem to work) so you guys can get a bit a better idea of what Im talking about.

From what you're saying, I think I can picture what you're talking about. If you still want to make a screenshot, though, try this:

http://diehardwolfers.areyep.com/viewtopic.php?t=2593

Does it give you the same problem if you try to scale 64x64 walls up vertically?
I don't see why you're changing drawspans and wallheight, wouldn't just changing the height perspective in CalcHeight() work?
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Mon Dec 05, 2005 8:58 pm
   Subject: Re: Changing the Raycastor - Very Involved with Many Changes
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

@Chris... You are right... 100%. In order to change the height of any wall he needs to modify the CheckHeight for a new perspective. It's all relative...

@Jaapio: Your perspective will be out completely if you don't adjust for bottom as well as the top. I personally have not tried to stretch the height of the wall, but I do know that Ripper's changes for Hi-Resolution (128x128) sprites works fine and maintains the proper perspective.

Greg
BrotherTank
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Code Tutorials View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 2 Goto page 1, 2  Next
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts [Code] Add Text to Screen at Skill Level select - Chris
Author: Chris
3 2437 Tue Sep 28, 2010 6:59 pm
Tricob View latest post
No new posts [Info] Giving a Guard a Rocket Launcher
Author: Guest
4 193 Fri Jan 23, 2004 1:58 pm
Guest View latest post
No new posts [Code] Changing Weapons -CheckWeaponChange- BrotherTank
Author: BrotherTank
2 2700 Sun Oct 26, 2003 1:21 am
Guest View latest post
No new posts [Code] Removing Signon, PG13, or Intro Screens - Chris
Author: Chris
6 1723 Thu Oct 16, 2003 1:43 pm
Sockman View latest post
No new posts [Help] Different Enemy Dying Frames/Views
Author: Guest
7 607 Tue Jul 29, 2003 3:00 pm
Codetech84 View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group