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       

[Code] DrawFlats replacement w/Cloudy&Parallaxing Ceilin
Page 1 of 1
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 03, 2004 4:59 pm
   Subject: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ceilin
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

By BrotherTank

Ok.... The title doesn't do this justice.


What this routine does is combine and compact the routines from both Darkone's Ceiling/Floor and Ripper's Cloudy Sky, as well as adding the ability to have parallaxing skies like in Doom. It also allows you to use 2 completely different graphics for ceiling and floor textures and it does all of that with Shading, should you have Rippers shading tutorial installed.

NOTE:To use the Cloudy Sky portion of this routine, you must have installed Ripper's Scalers Tutorial as well as the Cloudy Sky. If not, not to worry as it will not harm things.

This replacement will allow you to have completely different textures on the floor and ceiling, and allow for much greater flexibility. To use it, just remove the original DrawFlats routine from your code, as well as Rippers DrawCloudsAndFlats routine and replace it with the following:

::: CODE :::

/*
**   Textured Ceiling/Floor - By BrotherTank
**                          - Based on Ripper's Cloudy Sky, Darkone's DrawFlats & DrawSky   
**
**   This function replaces the original DrawFlats function with a more functional routine
** and removes the need for duplicate routines/code.  Thus it's more efficient and uses
** less memory. 
**
** which      =  which to draw     0 = Floor  1 = Ceiling  2 = parallaxed ceiling 
**                                 3 = Cloudy Sky (if installed)
**
**   dtex       =  texture to draw
** layered    =  Texture to Layer through texture when it finds colour 255 (transparent)
** repcolour  =  colour to replace in texture when it finds colour 255 (transparent)
**                 and the layered setting is False
** animate    =  0 = No animation
**                 1 = 3 Frame Animation (Normal)   2 = 3 Frame Animation (Fast Speed)   
**                 3 = 4 Frame Animation (Normal)   4 = 4 Frame Animation (Fast Speed)
*/

#ifdef HIRES         // Ripper's Hi-Resolution Tutorial - Self Modify DrawFlats Below
   #define HIRES0    64
   #define HIRES1     6
   #define HIRES2     7
   #define HIRES3   127
   #define HIRES4   128
   #define HIRES5     9
   #define HIRES6     256
   #define HIRES7       8
#else
   #define HIRES0    32
   #define HIRES1     5
   #define HIRES2     6
   #define HIRES3    63
   #define HIRES4    64
   #define HIRES5    10
   #define HIRES6     127   
   #define HIRES7       7
#endif

void DrawFlats (int which, int d_tex, int layered, int repcolour, int animate)
{
   int x, y, y0, halfheight,du0,du1;
   unsigned offset0, offadd, offset, offsetb;
   byte p, color;
   byte far *src_tex, far *src1_tex;
   fixed dist;                  
   fixed tex_step;            
   fixed gu, gv, du, dv;       
   int u, v;                  
#ifdef RAYCASTOR
   byte far *colormap;
#else
   #ifdef SHADE_COUNT
   int shade;
   #endif
#endif
#ifdef ADAMTEXT
   int texx,texy;
   unsigned tex, ltex=0;
#endif

   halfheight=viewheight>>1;
   y0=min_wallheight>>3;      
   if(y0>halfheight) return;   
   if(y0==0) y0=1;
   
   offset0 = 80*(which?(halfheight-y0-1):(halfheight+y0));
   offsetb = (which?-80:80);
   
   switch (which)
   {
#ifndef ADAMTEXT         
      case 0:
      case 1:
      {
         switch (animate)
         {
            case 1:
               d_tex +=   ((gamestate.TimeCount>>4)%3)<<1;
               break;
            case 2:
               d_tex += ((gamestate.TimeCount>>3)%3)<<1;
               break;
            case 3:
               d_tex += ((gamestate.TimeCount>>4)&3)<<1;
               break;
            case 4:
               d_tex += ((gamestate.TimeCount>>3)&3)<<1;
               break;
            default:
               src_tex =PM_GetPage(d_tex);
               break;
         }
         break;
      }
#endif         
      case 2:
         src_tex =PM_GetPage(d_tex);
         du0=HIRES6-((viewangle%VANG90)<<HIRES7)/VANG90;   
         if(layered) du1=(gamestate.TimeCount>>3)&127;
         break;         
   }
   
   if (layered && which != 3) src_tex1=PM_GetPage(layered);
   
   for(p=0; p<4; p++)
   {
      VGAMAPBIT(p);   
      
      for(y=y0, offset=offset0; y<halfheight; y++, offset+=offsetb)
      {

#ifdef RAYCASTOR
         if(spec_lt) colormap=spec_lt; else colormap=lt[y>>(which == 3?1:2)];
#else
   #ifdef SHADE_COUNT
         shade=(y<<(which == 3?3:2))/((maxscaleshl2>>8)+1+LSHADE_flag);
         if(shade>32) shade=32;
         else if(shade<1) shade=1;
         shade=32-shade;
   #endif
#endif
         switch (which)
         {
            case 2:
               v=HIRES0-(y<<HIRES1)/halfheight;
               break;
            default:
               if (!y) 
                  dist=(heightnumerator/y)<<(which == 3?9:6);
               else
                  dist=(heightnumerator/y)<<(which == 3?8:5);
#ifdef CLOUDYSKY
               gu= viewx+FixedByFrac(dist, viewcos)+(which==3?cloudx:0);
               gv=-viewy+FixedByFrac(dist, viewsin)+(which==3?cloudy:0);            
#else
               gu= viewx+FixedByFrac(dist, viewcos);
               gv=-viewy+FixedByFrac(dist, viewsin);
#endif               
               tex_step=(dist<<8)/viewwidth/175;      
               du= FixedByFrac(tex_step, viewsin);
               dv=-FixedByFrac(tex_step, viewcos);
               gu-=((viewwidth>>1)-p)*du;
               gv-=((viewwidth>>1)-p)*dv;
               du<<=2;
               dv<<=2;
               break;
         }         
         
         for(x=p, offadd=offset; x<viewwidth; x+=4, offadd++)
         {
            if(wallheight[x]>>3<=y)
            {
               switch (which)
               {
#ifdef CLOUDYSKY   // Ripper's Cloudy Sky Tutorial Installed
                  case 3:
                     u=(gu>>13)&255; v=(gv>>13)&255;
                     color=(byte far *)skyc+((255-u)<<8)+(255-v));
   #ifdef ADAMTEXT                     
                     tex = 1;
   #endif                     
                     break;
#endif                     
                  case 2:
                     u=((unsigned)x<<7)/viewwidth+du0;
                     color=*(src_tex+((u&HIRES3)<<HIRES2)+(v|(u&HIRES4)>>1));
                     if(color==0xFF && layered)
                     {
                        u+=du1;
                        color=*(src_tex1+((u&HIRES3)<<HIRES2)+(v|(u&HIRES4)>>1));
                     }
#ifdef ADAMTEXT                     
                     tex = 1;
#endif                     
                     break;
                  default:
#ifdef ADAMTEXT   // Adam Biser's Pull Textures from Map   
                     texx = (gu>>TILESHIFT)&63;
                     texy = (-(gv>>TILESHIFT)-1)&63;
   #ifndef ADAMTEXT2      // Floor Texture from Floor Codes
                      tex=MAPSPOT(texx,texy,0);
                      if (tex < AREATILE || tex > AREATILE+NUMAREAS)
                         tex=0; // Default to the first texture if No AREATILE Value.
                     else
                         tex -= AREATILE;
   #else                  // Pull Texture from Gamemaps 3rd Plane
                     if (which==1)
                        tex=MAPSPOT(texx,texy,2)>>8;   // High Bit in WDC for Ceiling
                     else
                        tex=MAPSPOT(texx,texy,2)&0xff; // Low Bit in WDC for Floors
                     if (tex == 0)
                     {
                        d_tex = MAPSPOT(texx,texy,0);
                        if (d_tex < AREATILE && d_tex > 0)
                        {
                           if (texy+1 <=63)
                              tex = MAPSPOT(texx,texy+1,0);   
                        }
                        else tex = 0;
                        
                     }
   #endif
                     switch (animate)
                     {
                        case 1:
                           tex += ((gamestate.TimeCount>>4)%3)<<1;
                           break;
                        case 2:
                           tex += ((gamestate.TimeCount>>3)%3)<<1;
                           break;
                        case 3:
                           tex += ((gamestate.TimeCount>>4)&3)<<1;
                           break;
                        case 4:
                           tex += ((gamestate.TimeCount>>3)&3)<<1;
                           break;
                     }
                     if (tex != ltex && tex != 0)
                     {   
                        ltex=tex;
                        src_tex=PM_GetPage(tex);
                     }                      
#endif                     
                     u=(gu>>HIRES5)&HIRES3; v=(gv>>HIRES5)&HIRES3;
                     color=*(src_tex+((HIRES3-u)<<HIRES2)+(HIRES3-v));
                     if (layered && color = 0xFF)
                     {
                        color = *(src_tex1+((HIRES3-u)<<HIRES2)+(HIRES3-v));   
                     }
                     else if (color = 0xFF) { color = repcolour; }
                     break;
               }
#ifdef RAYCASTOR
               if (gamestate.shading) color = colormap[color];
#else
   #ifdef SHADE_COUNT
               if (gamestate.shading) color = shadetable[shade][color];
   #endif
#endif
#ifdef ADAMTEXT
               if (tex)
               {
#endif               
                  asm  mov es,[screenseg]
                  asm  mov di,[bufferofs]
                  asm  add di,[offadd]
                  asm  mov al,[color]
                  asm  mov es:[di],al
#ifdef ADAMTEXT
               }
#endif                  
            }
            if (which != 2) { gu+=du; gv+=dv; }
         }
      }
   }   
}



With this code you can now call it 2 times.... first to draw the ceiling and then to draw the floor. Use the variables listed at the top of the routine as a reference as to how to pass things to the new replacement, but for a breif example, I will show you the easy way to control this. In the ThreeDRefresh routine, do something like:

::: CODE :::

VGAClearScreen ();

WallRefresh ();
/*    // Remove line if Scalers and Cloudy Sky installed
   tracedir=gamestate.episode*10+mapon;
   if(tracedir>=SKYSEEDS) tracedir=SKYSEEDS-1;
   cloudx+=FixedByFrac(tics*skyspeed[tracedir],sintable[skyangle[tracedir]]);
   cloudy-=FixedByFrac(tics*skyspeed[tracedir],costable[skyangle[tracedir]]);
*/    // Remove line if Scalers and Cloudy Sky installed

switch(gamestate.mapon) // is really mapon - 1
{
   case 0:  // really 1  - Texture 1 for floor -Cloudy Sky Ceiling
       Drawflats (3,0,0,0,0)  //  Draw Cloudy Sky
       Drawflats (0,1,0,0x00,0)  //  Draw Draw Texture 1 on Floor
   case 1:  // really 2  - Texture 1 for floor - Texture 5 Parallaxed on Ceiling
       Drawflats (2,5,1,0,0)  //  Draw Texture 5 Parallaxed with texture 6 layered
       Drawflats (0,1,0,0x00,0)  //  Draw Draw Texture 1 on Floor
   case 2:  // really 3  - Texture 6 for floor - Texture 35 on Ceiling
       Drawflats (1,35,0,0,0)  //  Draw Texture 35 on ceiling
       Drawflats (0,1,0,0,0)  //  Draw Draw Texture 1 on Floor

//..... ...  And so on for each of the levels you have in the game.
}
//
// draw all the scaled images
//



That's all there is to is... you now have only 1 routine that looks after everything. And if you play with it, you can produce some very unique ceiling and floor textures using the layered option and a colour from the wolfenstein colour palette.

Enjoy....

Greg
BrotherTank

Edit: Replaced Original Code with New code which also allows for Animating the ceiling. Code is also much cleaner and now supports Adam's Ceiling/Floor Textures from either "Floor Values" or "Third Plane". It also supports Ripper's Cloudy Sky tutorial (no need for his DrawSkyAndFlats routine). It's also self modifies based on you using Ripper's Hi-Resolution tutorial.

Now edit your version.h file and add the following:

//#define CLOUDYSKY // Uncomment this line if you are using Ripper's Cloudy Sky Tutorial
//#define HIRES // Uncomment this line if you are using Ripper's Hi-Resolution tutorial
//#define ADAMTEXT // Uncomment this line for floor textures to be drawn based on floor codes
//#define ADAMTEXT2 // Uncomment this and ADAMTEXT to allow for the maps 3rd plane to control ceiling/floor textures

Hope this helps...

Greg
BrotherTank


Last edited by BrotherTank on Mon Aug 22, 2005 1:06 pm; edited 3 times in total
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 Jan 24, 2005 2:45 pm
   Subject: Re: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ce
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Just found this post and it sounds quite interesting!
But don't you think a screenshot, showing your cool idea with the layered stuff, would help people to understand and glorify your idea? Mr Green
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 12 Dec 2017

Topics: 46
Posts: 2291
Location: USA
usa.gif

PostPosted: Wed Feb 09, 2005 6:29 am
   Subject: Re: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ce
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I've been looking at trying to implement this into Orb. I got Ripper's cloudy texture tutorial to work fine except for figuring out how to tame the sky seed, etc values (I sometimes get random colors). Anyway... Here are a few things I hit when I copy/pasted the tutorial into my code.

1) The floor appeared in the middle of the screen.
2) The floor was garbled.
3) The clouds look as though the cloud graphic has been stretched across the entire map.

To ungarble the floor and unstretch the clouds, I switched the 8 and the 5 in this code:
::: CODE :::
            case 2:
               dist=((heightnumerator/y)<<5); // Should be 8
(...)
            default:
               dist=((heightnumerator/y)<<8); // Should be 5


To fix the floor location, I changed:
::: CODE :::
     case 0:  // Floor
         offset0 = (halfheight+y0);

to
::: CODE :::
      case 0:  // Floor
         offset0 = 80*(halfheight+y0);


Before these changes, I'd get the Doom Hall of Mirrors effect for the floor.

I also noticed that Orb now tells me that I don't have enough memory on one machine (plays fine on another). I changed the mainmem check in WL_MAIN.C to:
::: CODE :::
   if (mminfo.mainmem < 135000L)// && !MS_CheckParm(DEBUGPARM))

And the game loads without a hitch. I'm sure there's a better value for this, but it was a quick solution.

The second code block needs semicolons and breaks; And the floor for case 2 actually draws texture 6, right?

Other than these slight snags, I like it. The memory thing makes me wonder. But we'll have to test that.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
jamez
I am Death Incarnate
I am Death Incarnate


Joined: 16 Mar 2003
Last Visit: 13 Aug 2016

Topics: 13
Posts: 186
Location: Yorkshire, UK
uk.gif

PostPosted: Mon Feb 21, 2005 4:37 pm
   Subject: Re: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ce
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

How can you be using "DrawFlats" if we are overwriting it?"

My source wants to put a ; at the end of the drawflats and gives me a link error.

Please help me here

_________________
~ James
jamez
I am Death Incarnate
I am Death Incarnate


Joined: 16 Mar 2003
Last Visit: 13 Aug 2016

Topics: 13
Posts: 186
Location: Yorkshire, UK
uk.gif

PostPosted: Wed Feb 23, 2005 5:24 pm
   Subject: Re: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ce
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Where is DrawFlats defined here?

_________________
~ James
jamez
I am Death Incarnate
I am Death Incarnate


Joined: 16 Mar 2003
Last Visit: 13 Aug 2016

Topics: 13
Posts: 186
Location: Yorkshire, UK
uk.gif

PostPosted: Wed Feb 23, 2005 5:36 pm
   Subject: Re: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ce
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

::: CODE :::
 case 0:  // really 1  - Texture 1 for floor -Cloudy Sky Ceiling
       Drawflats (0,2,0,0)  //  Draw Cloudy Sky
       Drawflats (1,0,1,0x00)  //  Draw Draw Texture 1 on Floor
   case 1:  // really 2  - Texture 1 for floor - Texture 5 Parallaxed on Ceiling
       Drawflats (5,3,1,0)  //  Draw Texture 5 Parallaxed with texture 6 layered
       Drawflats (1,0,1,0x00)  //  Draw Draw Texture 1 on Floor
   case 2:  // really 3  - Texture 6 for floor - Texture 35 on Ceiling
       Drawflats (35,1,0,0)  //  Draw Texture 35 on ceiling
       Drawflats (6,0,0,0)  //  Draw Draw Texture 1 on Floor


All the Drawflats should be DrawTexture!

_________________
~ James
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 15 Oct 2017

Topics: 22
Posts: 1281
Location: Rauma - Finland
finland.gif

PostPosted: Sun Mar 20, 2005 9:55 am
   Subject: Re: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ce
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

jamez wrote:
::: CODE :::
 case 0:  // really 1  - Texture 1 for floor -Cloudy Sky Ceiling
       Drawflats (0,2,0,0)  //  Draw Cloudy Sky
       Drawflats (1,0,1,0x00)  //  Draw Draw Texture 1 on Floor
   case 1:  // really 2  - Texture 1 for floor - Texture 5 Parallaxed on Ceiling
       Drawflats (5,3,1,0)  //  Draw Texture 5 Parallaxed with texture 6 layered
       Drawflats (1,0,1,0x00)  //  Draw Draw Texture 1 on Floor
   case 2:  // really 3  - Texture 6 for floor - Texture 35 on Ceiling
       Drawflats (35,1,0,0)  //  Draw Texture 35 on ceiling
       Drawflats (6,0,0,0)  //  Draw Draw Texture 1 on Floor


All the Drawflats should be DrawTexture!


Don't you mean:

::: CODE :::
 case 0:  // really 1  - Texture 1 for floor -Cloudy Sky Ceiling
       DrawTexture (0,2,0,0);  //  Draw Cloudy Sky
       DrawTexture(1,0,1,0x00);  //  Draw Draw Texture 1 on Floor
break;
   case 1:  // really 2  - Texture 1 for floor - Texture 5 Parallaxed on Ceiling
       DrawTexture (5,3,1,0);  //  Draw Texture 5 Parallaxed with texture 6 layered
       DrawTexture (1,0,1,0x00);  //  Draw Draw Texture 1 on Floor
break;
   case 2:  // really 3  - Texture 6 for floor - Texture 35 on Ceiling
       DrawTexture (35,1,0,0);  //  Draw Texture 35 on ceiling
       DrawTexture(6,0,0,0);  //  Draw Draw Texture 1 on Floor
break;


Where were your semicolons and breaks? Razz

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
jamez
I am Death Incarnate
I am Death Incarnate


Joined: 16 Mar 2003
Last Visit: 13 Aug 2016

Topics: 13
Posts: 186
Location: Yorkshire, UK
uk.gif

PostPosted: Tue Apr 05, 2005 3:48 pm
   Subject: Re: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ce
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I just copied BroTanks code, although unless you find out what to change, some things here are wrong...

_________________
~ James
Sporb2000
DieHard SS
DieHard SS


Joined: 27 Dec 2004
Last Visit: 26 May 2009

Topics: 19
Posts: 383
Location: New Zealand - Invercargill
newzealand.gif

PostPosted: Tue Apr 26, 2005 12:42 am
   Subject: Re: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ce
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

i dont get it Confused can ya tell me what files to look in ? i probably missed somthin coz it just sits and spits errors out

_________________
I Like (Brackets)
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 15 Oct 2017

Topics: 22
Posts: 1281
Location: Rauma - Finland
finland.gif

PostPosted: Sun Jul 10, 2005 3:51 am
   Subject: Re: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ce
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

jamez wrote:
I just copied BroTanks code, although unless you find out what to change, some things here are wrong...


Brothertank, please correct the tutorial since you seem to have forgotten something. See my previous post for reference.

Nobody's perfect... Cool

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
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: Sun Aug 21, 2005 11:55 am
   Subject: Re: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ce
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Original Post Updated to allow for addtional settings - If you have installed this code previous to the date on this post, please update your code accordingly as the code is now self modifying as well as allowing for animated textures. It also includes the proper installation of Adam's Textures controlled by either Floor codes or via the 3rd Map Plane...

Enjoy...

Greg
BrotherTank
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 Aug 22, 2005 1:02 pm
   Subject: Re: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ce
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Just a small BugFix.... While the other code is technically correct, it will occasionally draw a wrong texture above a wall where no ceiling texture is defined (sometimes you will see some strange colours at the top edge of the wall). Anyhow... I forgot to take into account Adams shift of the tiles... thus the line:

::: CODE :::
                     if (tex == 0 && (MAPSPOT(texx,texy,0) != 0
                        && MAPSPOT(texx,texy,0)<=90)) tex = MAPSPOT(texx,texy,0);


Should be replaced with this:

::: CODE :::
                     if (tex == 0)
                     {
                        d_tex = MAPSPOT(texx,texy,0);
                        if (d_tex < AREATILE && d_tex > 0)
                        {
                           if (texy+1 <=63)
                              tex = MAPSPOT(texx,texy+1,0);   
                        }
                        else tex = 0;
                        
                     }


Original Tutorial has been updated...

Greg
BrotherTank
Sporb2000
DieHard SS
DieHard SS


Joined: 27 Dec 2004
Last Visit: 26 May 2009

Topics: 19
Posts: 383
Location: New Zealand - Invercargill
newzealand.gif

PostPosted: Sat Nov 05, 2005 12:01 am
   Subject: Re: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ce
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

i cant get this to work , complains about SRC_TEX is an undefined symbol ... do you need other parts or somthing?

_________________
I Like (Brackets)
Ultimator
Registered User
Registered User


Joined: 30 Oct 2005
Last Visit: 17 Jun 2008

Topics: 2
Posts: 22

usa.gif

PostPosted: Tue Jul 04, 2006 4:59 pm
   Subject: Re: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ce
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I get the same error as Sporb2000.
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 12 Dec 2017

Topics: 46
Posts: 2291
Location: USA
usa.gif

PostPosted: Tue Jul 04, 2006 5:59 pm
   Subject: Re: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ce
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Are you sure it doesn't say src_tex1? The reason I ask is:
Quote:
byte far *src_tex, far *src1_tex;

Then:
Quote:
if (layered && which != 3) src_tex1=PM_GetPage(layered);

Quote:
color=*(src_tex1+((u&HIRES3)<<HIRES2)+(v|(u&HIRES4)>>1));

Quote:
color = *(src_tex1+((HIRES3-u)<<HIRES2)+(HIRES3-v));


I would try changing that first "src1_tex" to "src_tex1" and see if that helps...

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
Ultimator
Registered User
Registered User


Joined: 30 Oct 2005
Last Visit: 17 Jun 2008

Topics: 2
Posts: 22

usa.gif

PostPosted: Tue Jul 04, 2006 6:08 pm
   Subject: Re: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ce
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Just as I was about to edit my post saying that exact statement, you made that post. Good to see that my brain still works after all. Thanks. Wink

Now, I'm getting an error about gamestate.shading being an undefined symbol. More on that later, I'm going to try to have a poke at it myself.

EDIT: In addition, I'm getting an "Lvalue required" error with the "if (layered && color = 0xFF)" and "else if (color = 0xFF) { color = repcolour; }". Now, "Lvalue" I do know something about - it's the value to the left of the equal sign. I don't know what could possibly make the compiler think that there ISN'T an Lvalue when the code quite clearly has "color" there. I'll look at the declaration for "color" and see if there's a problem there.
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 09 Dec 2017

Topics: 86
Posts: 752
Location: Wisconsin
usa.gif

PostPosted: Tue Jul 04, 2006 7:53 pm
   Subject: Re: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ce
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

change color = 0xFF to color == 0xFF there should be 2 of them and the gamestate.shading, you can remove that because it isn't really needed. If you need a shading switch, there is another tutorial on it.

_________________
I'm back! I missed this community!
Youtube Channel: TreeSapThief

New Site: http://www.treesapthief.com
Twitter: @treesapthief
Ultimator
Registered User
Registered User


Joined: 30 Oct 2005
Last Visit: 17 Jun 2008

Topics: 2
Posts: 22

usa.gif

PostPosted: Tue Jul 04, 2006 9:02 pm
   Subject: Re: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ce
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I had a few other errors when compiling. One was that DrawFlats() did not have enough arguments. Since I'm just doing multiple textures, I just used 0's for the other three arguments. Then, I had one about _VGABITMAP not existing. I assume that's Raycastor stuff (I've already gotten in too far to do that, though I could always start over on my source). I commented the only reference to VGABITMAP out, and it compiled.

However, now that the code compiles without a hitch, I can't seem to get anything running. So, I've uploaded my source in a .ZIP. If anybody wants to take a look through .9 MB of ugly, retarded but nicely compiling code and figure out what boneheaded mistake I made (most likely in WL_DRAW.C), you're more than welcome to it. I kind of prefer to at least copy and paste/type stuff in myself, but if anybody can get this working, I'd be very appreciative.
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 12 Dec 2017

Topics: 46
Posts: 2291
Location: USA
usa.gif

PostPosted: Wed Jul 05, 2006 5:40 am
   Subject: Re: [Code] DrawFlats replacement w/Cloudy&Parallaxing Ce
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Another thing I notice, but I'm not sure it'll help:
::: CODE :::
         switch (animate)
         {
            case 1:
               d_tex +=   ((gamestate.TimeCount>>4)%3)<<1;
               break;
            case 2:
               d_tex += ((gamestate.TimeCount>>3)%3)<<1;
               break;
            case 3:
               d_tex += ((gamestate.TimeCount>>4)&3)<<1;
               break;
            case 4:
               d_tex += ((gamestate.TimeCount>>3)&3)<<1;
               break;
            default:
               src_tex =PM_GetPage(d_tex);
               break;
         }
         break;

src_tex isn't loaded for cases 1 through 4 so this might be better as:
::: CODE :::
         switch (animate)
         {
            case 1:
               d_tex +=   ((gamestate.TimeCount>>4)%3)<<1;
               break;
            case 2:
               d_tex += ((gamestate.TimeCount>>3)%3)<<1;
               break;
            case 3:
               d_tex += ((gamestate.TimeCount>>4)&3)<<1;
               break;
            case 4:
               d_tex += ((gamestate.TimeCount>>3)&3)<<1;
               break;
         }
         src_tex =PM_GetPage(d_tex);
         break;

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
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 1
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 2439 Tue Sep 28, 2010 6:59 pm
Tricob View latest post
No new posts [Code] Display Different Ammo Types on Statusbar-BrotherTank
Author: BrotherTank
1 2381 Fri Feb 11, 2005 9:18 pm
Zombie_Plan View latest post
No new posts [Code] Changing an Enemies Attack Strength - BrotherTank
Author: BrotherTank
0 1969 Tue Jan 27, 2004 10:29 am
BrotherTank 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 [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