Wolf3d Haven Forum

Please log in or register. Smile

Join the forum, it's quick and easy

Wolf3d Haven Forum

Please log in or register. Smile
Wolf3d Haven Forum

A friendly Wolfenstein 3D community, about Wolfenstein 3D, the game that gave birth to first person shooters...


Search found 3 matches for endif

[solved] Wall Patches in SDL - Sat Dec 11, 2021 6:58 pm

Topics tagged under endif on Wolf3d Haven Forum Right-arrow



Code:
/*
====================
= ApplyPatch2
= Partial Coverage Patches with transparency
= aka 3rd or 4th Index Walls
====================
*/
#ifdef Use_Patch2

byte   patchedwall[PMPageSize];
int      lastpatchnum;
#define FIRSTPATCHTILE   2000
#define NUMPATCHES       1   // This is the number of patch pairs (light/dark) in use.
#define PATCHSTART       DOORWALL-NUMPATCHES*2

unsigned GetPatchNum(boolean useXspot)
{
    // work off xspot/yspot, instead of xtile/ytile
    unsigned spot, x, y;
    (useXspot? spot=xspot : spot=yspot);

    x = (unsigned)((spot+1)/64);
    y = (unsigned)((spot+1)%64) -1;

    spot = MAPSPOT(x,y,1); // adjust for *Planes Exp
// Restrict patch objects to the given range.
   if (spot < FIRSTPATCHTILE || spot >= FIRSTPATCHTILE+NUMPATCHES )
      return 0;
   else
      return spot;

}

boolean ApplyPatch(int wallpic, boolean useXspot)
{
      byte   *scan;
      int    pixel;
      unsigned spot;

   spot = GetPatchNum(useXspot);
   if (spot > 0 && wallpic < DOORWALL) // Don't do door-related textures.
   {
      // Keep track of the patch in memory.
      //   The wall is already stored elsewhere.
      lastpatchnum = spot;
      spot -= FIRSTPATCHTILE;
      // Adjust for light/dark patch sides
      spot = spot * 2 + (lastside?1:0);
      // Load the wall into the byte array first.
    scan = PM_GetTexture(wallpic);
for (pixel=0; pixel>TEXTUREFROMFIXEDSHIFT)&TEXTUREMASK;
    if (xtilestep == -1)
    {
        texture = TEXTUREMASK-texture;
        xintercept += TILEGLOBAL;
    }
#ifdef Use_Patch2
    if(lastside==1 && lastintercept==xtile && lasttilehit==tilehit && !(lasttilehit & BIT_WALL) && GetPatchNum(true)==lastpatchnum)
#else
   if(lastside==1 && lastintercept==xtile && lasttilehit==tilehit && !(lasttilehit & BIT_WALL))
#endif

    {
        if((pixx&3) && texture == lasttexture)
        {
            ScalePost();
            postx = pixx;
            wallheight[pixx] = wallheight[pixx-1];
            return;
        }
        ScalePost();
        wallheight[pixx] = CalcHeight();
        postsource+=texture-lasttexture;
        postwidth=1;
        postx=pixx;
        lasttexture=texture;
        return;
    }

    if(lastside!=-1) ScalePost();

    lastside=1;
    lastintercept=xtile;
    lasttilehit=tilehit;
    lasttexture=texture;
    wallheight[pixx] = CalcHeight();
    postx = pixx;
    postwidth = 1;

    if (tilehit & BIT_WALL)
    {                                                               // check for adjacent doors
        ytile = (short)(yintercept>>TILESHIFT);
        if ( tilemap[xtile-xtilestep][ytile]&BIT_DOOR )
            wallpic = DOORWALL+3;
        else
            wallpic = vertwall[tilehit &BIT_WALL]; // was ~BIT_WALL]; //  *Mod *Max *Flag *!

    }
    else
        wallpic = vertwall[tilehit];
        #ifdef Use_Patch2
        AssignWall (wallpic);  // ?
        if (ApplyPatch (wallpic, true))
                postsource = patchedwall+texture;
        else
                postsource = PM_GetTexture(wallpic)+texture;
#else
    postsource = PM_GetTexture(wallpic) + texture;
#endif

}


Topics tagged under endif on Wolf3d Haven Forum Right-arrow I don't know how or why that code got inserted here on this thread, but that was is not the code I am using in that section, and as far as I understand that code would not even compile.

___________________________________________________________

This is what I have in the relevant section of WL_Draw.cpp

However this your code may be different, I have also used the tut from Chokan to Remove the Hard Coded Limits on Walls and Doors thus mine is a bit different(and my comments.... )
Also dont forget to enable this by placing 
#define UsePatch2   // or whatever name you want
in Version.H

(still semi broken, due to incompatibility with my implementation of removing the hard coded wall and door limits)

[why both... there are reasons] 

/*
====================
= ApplyPatch2
= Partial Coverage Patches with transparency
= aka 3rd or 4th Index Walls
====================
*/
#ifdef Use_Patch2

byte   patchedwall[PMPageSize];
int      lastpatchnum;
#define FIRSTPATCHTILE   2000
#define NUMPATCHES       2   // This is the number of patch pairs (light/dark) in use.
#define PATCHSTART       DOORWALL-NUMPATCHES*2

unsigned GetPatchNum(boolean useXspot)
{
   // work off xspot/yspot, instead of xtile/ytile
   unsigned spot, x, y;
   (useXspot? spot=xspot : spot=yspot);

   x = (unsigned)((spot+1)/64);
   y = (unsigned)((spot+1)%64) -1;

   spot = MAPSPOT(x,y,1);  // adjust for *Planes Exp
// Restrict patch objects to the given range.
  if (spot < FIRSTPATCHTILE || spot >= FIRSTPATCHTILE+NUMPATCHES )
     return 0;
  else
     return spot;

}

boolean ApplyPatch(int wallpic, boolean useXspot)
{
     byte   *scan;
     int    pixel;
     unsigned spot;

  spot = GetPatchNum(useXspot);
  if (spot > 0 && wallpic < DOORWALL) // Don't do door-related textures.
  {
     // Keep track of the patch in memory.
     //   The wall is already stored elsewhere.
     lastpatchnum = spot;
     spot -= FIRSTPATCHTILE;
     // Adjust for light/dark patch sides
     spot = spot * 2 + (lastside?1:0);
     // Load the wall into the byte array first.
   scan = PM_GetTexture(wallpic);
for (pixel=0; pixel>TEXTUREFROMFIXEDSHIFT)&TEXTUREMASK;
   if (xtilestep == -1)
   {
       texture = TEXTUREMASK-texture;
       xintercept += TILEGLOBAL;
   }
#ifdef Use_Patch2
   if(lastside==1 && lastintercept==xtile && lasttilehit==tilehit && !(lasttilehit & BIT_WALL) && GetPatchNum(true)==lastpatchnum)
#else
  if(lastside==1 && lastintercept==xtile && lasttilehit==tilehit && !(lasttilehit & BIT_WALL))
#endif

   {
       if((pixx&3) && texture == lasttexture)
       {
           ScalePost();
           postx = pixx;
           wallheight[pixx] = wallheight[pixx-1];
           return;
       }
       ScalePost();
       wallheight[pixx] = CalcHeight();
       postsource+=texture-lasttexture;
       postwidth=1;
       postx=pixx;
       lasttexture=texture;
       return;
   }

   if(lastside!=-1) ScalePost();

   lastside=1;
   lastintercept=xtile;
   lasttilehit=tilehit;
   lasttexture=texture;
   wallheight[pixx] = CalcHeight();
   postx = pixx;
   postwidth = 1;

   if (tilehit & BIT_WALL)
   {                                                               // check for adjacent doors
       ytile = (short)(yintercept>>TILESHIFT);
       if ( tilemap[xtile-xtilestep][ytile]&BIT_DOOR )
           wallpic = DOORWALL+3;
       else
           #ifdef Ultra_Tex
           wallpic = vertwall[tilehit &BIT_WALL]; 
           #else
           wallpic = vertwall[tilehit &~BIT_WALL]; 
           #endif // Ultra_Tex
   }
   else
       wallpic = vertwall[tilehit];
       #ifdef Use_Patch2
     //  AssignWall (wallpic);  // ?
       if (ApplyPatch (wallpic, true))
               postsource = patchedwall+texture;
       else
               postsource = PM_GetTexture(wallpic)+texture;
#else
   postsource = PM_GetTexture(wallpic) + texture;
#endif

}


/*
====================
=
= HitHorizWall
=
= tilehit bit 7 is 0, because it's not a door tile
= if bit 6 is 1 and the adjacent tile is a door tile, use door side pic
=
====================
*/

void HitHorizWall (void)
{
   int wallpic;
   int texture;

   texture = ((xintercept+texdelta)>>TEXTUREFROMFIXEDSHIFT)&TEXTUREMASK;
   if (ytilestep == -1)
       yintercept += TILEGLOBAL;
   else
       texture = TEXTUREMASK-texture;
#ifdef Use_Patch2
   if(lastside==1 && lastintercept==ytile && lasttilehit==tilehit && !(lasttilehit & BIT_WALL) && lastpatchnum==GetPatchNum(false))
#else
    if(lastside==0 && lastintercept==ytile && lasttilehit==tilehit && !(lasttilehit & BIT_WALL))
#endif

   {
       if((pixx&3) && texture == lasttexture)
       {
           ScalePost();
           postx=pixx;
           wallheight[pixx] = wallheight[pixx-1];
           return;
       }
       ScalePost();
       wallheight[pixx] = CalcHeight();
       postsource+=texture-lasttexture;
       postwidth=1;
       postx=pixx;
       lasttexture=texture;
       return;
   }

   if(lastside!=-1) ScalePost();

   lastside=0;
   lastintercept=ytile;
   lasttilehit=tilehit;
   lasttexture=texture;
   wallheight[pixx] = CalcHeight();
   postx = pixx;
   postwidth = 1;

   if (tilehit & BIT_WALL)
   {                                                               // check for adjacent doors
       xtile = (short)(xintercept>>TILESHIFT);
       if ( tilemap[xtile][ytile-ytilestep]&BIT_DOOR)
           wallpic = DOORWALL+2;
       else
           wallpic = horizwall[tilehit & ~BIT_WALL];
   }
   else
       wallpic = horizwall[tilehit];

       #ifdef Use_Patch2
    //   AssignWall (wallpic);  // ?
       if (ApplyPatch (wallpic, false))
               postsource = patchedwall+texture;
       else
               postsource = PM_GetTexture(wallpic)+texture;
#else
   postsource = PM_GetTexture(wallpic) + texture;
#endif
}

Asa

Reinstating the overhead map function in Wolf3D - Thu Jul 16, 2020 7:36 pm

I inserted the function you provided and commented out the other one. When I compiled it there were more errors than it had before. I decided to start over. After looking at NY00123's code, I realized that he didn't change or add anything, yet the program compiles to an exact duplicate of the original 1.0, and if that's true then that means the map function, as written, should be usable in any newer version if you know what to edit. I went back to a fresh copy of the WL_Debug.C file and began again. I commented each #if 0 and corresponding #endif one at a time and compiled to see what would happen. Everything was fine (as far as no errors in compile or build) until I removed the last one in the ViewMap() function. Now, just because it compiled and built with the other ones commented doesn't mean the map worked, cause it didn't. But the program ran the way it should otherwise. The problem it had in execution is that if you pressed TAB-O, you had to hit ESC twice to go back to the menu and then return to the game before any other cheats would work again. They would work until you pressed TAB-O, then not work until you went back to the menu and returned to the game again. When I removed the last #if 0, the first error came in. It says that the c in c.button0 is an undefined symbol. c.button0 is treated by that code as a boolean value, in the first case testing for it being true and button0held being false (!button0held), and in the second case checking to see if c.button0 is false (!c.button0). Looking at the function, button0held is being defined as a boolean variable and initially set to false. (I had to un-comment that assignment statement.) c.button0 is not defined anywhere in the file, so I am assuming it must be a global variable of some sort, but I haven't found it in any of the files included in the WL_Debug.C file or that are included in the WL_Def.H file. I would like to know where c.button0 is defined, and to understand why that particular part of the ViewMap() function was set to a compiler directive. Can either of you elaborate?

Oh, by not work, I mean that pressing the keys (like TAB-G to toggle god mode) wouldn't do anything until you went back to the menu and returned to the game.

Asa

God Mode sprite and BJ panting sprites - Wed Jul 08, 2020 8:51 am

Wolf3DGuy wrote:The god mode graphs can be found in SoD that's true, those are missing in Wolf3D, by the panting sprites I believe you mean the intermission screen inbetween levels with the ratios showing up and there's BJ breathing and holding his gun, those 2 sprites appear in the PC version as well, you don't have to add those, unless if you have the steam version of the game, for some reason they added one panting sprite twice so BJ is not animated there, strange that's for sure, but I believe you can find those sprites on Spriters Resource.

If you want to make the god mode faces appear in Wolf3D then you have to do more than just adding those 3 sprites in the vga files, I do not know if you work with DOS or ECWolf now. If you're trying to do it in DOS you have to add the faces after the mutant BJ sprite, then in GFXV_WL6.h you have to add the faces there as well afte Anyway, I will look for r MUTANTBJPIC, let's just call them GODMODEFACE1PIC, GODMODEFACE2PIC and GODMODEFACE3PIC. Also you have to raise the value in ORDERSCREEN by 3, do the same with the values for LATCHPICS_LUMP_END, NUMCHUNKS and NUMPICS as well also after the "File offsets for data items" lines too except for STRUCTPIC, STARTFONT, STARTFONTM and STARTPICS. Next, open up WL_AGENT in DrawFace remove the #ifdef SPEAR and the #endif lines. Save both files then compile the new exe, I believe it should work, if you want to add these in ECWolf then I have no idea how to do that, I hate scripting Doom after all! Cool  Laughing


I looked at the shareware SoD and found the god mode sprites there. I wish I hadn't lost the registered versions of the game and both mission packs, but that is the past and I have to deal with things as they are. Anyway, yes, I am referring to the intermission screen. I have version 1.1 of Wolf3D and it does not have the differing panting sprites. It has the same sprite twice. I never got the steam version of any game, so I know it isn't that. If 1.1 was supposed to have them, then somehow my copy was different. Anyway, I will see about locating the second sprite in the location you mentioned.

I never did anything in the way of modding the files before, other than to play around with the mapedit editor. I used MapEdit 8 (not 8.4), and found WDC when I wanted to look at the sprites. I used it to get a copy of the god mode image I used for my avatar here. That was many years ago. I have just begun to look at the sprites again, but I have never tried to insert graphics into the files before. I don't have the same computer I had back then (it was stolen when I had it stored at a friend's house), so I had to download the editors all over again. I went with HWE because it doesn't need DOSBox to run. When I downloaded ECWolf, I found that I had to run a patch on it to bring the files up-to-date (to v1.4 apparently). That patch didn't add anything to the sprites as far as I can tell. From your response, I take it that ECWolf is based more on the DOOM engine than the original WOLF engine?

I see that code changes are necessary to effect these changes. Is there a particular compiler I should use for recompiling the game? I have never written code for a PC app before.


Back to top

Current date/time is Wed May 08, 2024 1:39 pm