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 6 matches for define

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

Topics tagged under define 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 define 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 - Mon Aug 03, 2020 6:52 am

That makes a whole lot of sense. I will try doing that as well, but I was also thinking that if I knew how to identify the tile16's in the VGAGRAPH file, and how to make sure the VGAHEAD file was updated accordingly, I might be able to save some space by removing the unused tile16's the same way they did in the Alpha. If you look at it, the unused tile16 chunks don't even exist in that file. I think that allowed them to have all of the ones the Alpha used in without having to worry about running out of space.

Also, if you look at SoD, there are images in that game that do not exist in the Wolf3D game (and some of them don't use the same palette). I think if you start mucking with removing images from the file it will have an adverse affect on SoD (I do want to eventually get to adding these mods to SoD, but I have a long way to go before I will be comfortable trying to compile for SoD).

I am going to try reducing the tile8 number from 72 to 35, and I am still trying to sort out how to remove the unused tile16's to see if that makes a difference. The Tile16M's are something I'm thinking about also because when I play in Death Incarnate mode the map shows me objects in the rooms, and I'd like to see the actual object instead of a number. But that is for another day. Let me get the Tile16's figured out first.

BTW, where did you define TILETEST3?


Edit: I just found in the WL_DEF.H file:

#define NUMLATCHPICS    100

Aren't there more than 100 images in the VGAGRAPH file, not including the tile8 and tile16's? (I believe the count was 134). Should I change this number to correspond with that?

Edit2: I see why you said 25 instead of 35. If I change the number to 25, should I also alter the tile8 image to not include the 10 blank images?

Zombie_Plan

Wolf4SDL + WASD - Tue Mar 17, 2020 9:06 am

Hello all!

I come to you today with my barebones knowledge with something small and hacky but hopefully interesting to some; customizable strafe controls in core-Wolf4SDL. The idea is to bring another optional extra feature to the code that will hopefully open mods/Wolf4SDL in general to more people, particularly an audience that might prefer familiar control schemes.

Topics tagged under define on Wolf3d Haven Forum Wasd1 Topics tagged under define on Wolf3d Haven Forum Wasd2

Instead of having options for the joystick, I've set it up to have options to rebind the strafe left and right buttons, as well as the next and previous weapon buttons (Though those could be changed to something else, I just didn't want to waste space).

You can also specifically disable mouse movement in the menu, so that it only controls turning.

In the code itself, everything is behind a #define, so that if you want to keep the classic Joystick/Keyboard controls, that is an option.

Notes:

My code isn't 100% efficient and there is a lot I am not totally happy with, because I know it can be better but I personally lack the skillset. I'll be uploading the source shortly for people to mess with. I'll be posting further with one of the things I'm most unhappy with, but I welcome anyone to look at the code and come up with better solutions.

It would be much better if a more dynamic/better menu system were developed, but this tries to work within those current constraints.

I'd also be interested in how this changes level design for those that design around that control scheme, but that's more of a conceptual idea than anything else.

Download

For those interested in at least testing my changes, here's the [url=http://wolf3d.net/files/wolf4sdlwasd.zip]executable files (For use with the WL6 files of Wolf3D)[/url].

Edit: temporarily pulled because crashing issues.

Edit2: Reuploaded with fixes

[solved]Wolf4SDL - Add more than 8 doors - Mon Feb 11, 2019 9:51 am

Hi!

In WL_GAME.CPP I add some new doors to case number 105 (this is 4 new doors) and everything works fine...

Where is the problem? Well, I found that cases from number 106 are reserved to floors, then I moved case number for more 2 new doors to 144 (this is the first tile after floor tiles).

I used Chaos edit to add textures, tile configuration and put that new doors on map.(There is everything ok. I attached sprinfo)
Everything is ok in WL_DEF.H too:


WL_DEF.H related code:



typedef enum {
    dr_normal,
    dr_lock1,
    dr_lock2,
    dr_lock3,
    dr_lock4,
    dr_elevator,
    dr_lock5,
    dr_lock6,
    dr_lock5keys,
    dr_wood
} door_t;


----------------------------------------------

I have problem with these last two doors.

WL_DRAW.CPP code related to doors:


#define DOORWALL        (PMSpriteStart-30)

.............................

[i].............................[/i]
/*
====================
= HitVertWall - Adjacent textures
====================
*/

            switch(doorobjlist[tilemap[xtile-xtilestep][ytile] & 0x80-1].lock)
            {
               case dr_normal:
                  wallpic = DOORWALL+3;
                  break;

               case dr_lock1:
               case dr_lock2:
               case dr_lock3:
               case dr_lock4:
               case dr_lock5:
               case dr_lock6:
               case dr_lock5keys:
                  wallpic = DOORWALL+11;
                  break;

               case dr_elevator:
                  wallpic = DOORWALL+9;
                  break;

               case dr_wood:
                  wallpic = DOORWALL+29;
                  break;
          }
        }
        else
            wallpic = vertwall[tilehit & ~0x40];


/*
====================
= HitHorizWall - Adjacent textures
====================
*/

switch(doorobjlist[tilemap[xtile][ytile-ytilestep] & 0x80-1].lock)

            {
               case dr_normal:
                  wallpic = DOORWALL+2;
                  break;

               case dr_lock1:
               case dr_lock2:
               case dr_lock3:
               case dr_lock4:
               case dr_lock5:
               case dr_lock6:
               case dr_lock5keys:
                  wallpic = DOORWALL+10;
                  break;

               case dr_elevator:
                  wallpic = DOORWALL+8;
                  break;

               case dr_wood:
                  wallpic = DOORWALL+28;
                  break;
          }
        }
        else
            wallpic = horizwall[tilehit & ~0x40];

/*
====================
= HitHorizDoor
====================
*/

    switch(doorobjlist[doornum].lock)
    {
        case dr_normal:
            doorpage = DOORWALL;
            break;
        case dr_lock1:
            doorpage = DOORWALL+12;
            break;
        case dr_lock2:
            doorpage = DOORWALL+14;
            break;
        case dr_lock3:
            doorpage = DOORWALL+16;
            break;
        case dr_lock4:
            doorpage = DOORWALL+18;
            break;
        case dr_elevator:
            doorpage = DOORWALL+4;
            break;
        case dr_lock5:
            doorpage = DOORWALL+20;
            break;
        case dr_lock6:
            doorpage = DOORWALL+22;
            break;
        case dr_lock5keys:
            doorpage = DOORWALL+24;
            break;
        case dr_wood:
            doorpage = DOORWALL+26;
            break;
    }

/*
====================
= HitVertDoor
====================
*/


    switch(doorobjlist[doornum].lock)
    {
        case dr_normal:
            doorpage = DOORWALL+1;
            break;
        case dr_lock1:
            doorpage = DOORWALL+13;
            break;
        case dr_lock2:
            doorpage = DOORWALL+15;
            break;
        case dr_lock3:
            doorpage = DOORWALL+17;
            break;
        case dr_lock4:
            doorpage = DOORWALL+19;
            break;
        case dr_elevator:
            doorpage = DOORWALL+5;
            break;
        case dr_lock5:
            doorpage = DOORWALL+21;
            break;
        case dr_lock6:
            doorpage = DOORWALL+23;
            break;
        case dr_lock5keys:
            doorpage = DOORWALL+25;
            break;
        case dr_wood:
            doorpage = DOORWALL+27;
            break;
    }

--------------------------------------------------------
WL_GAME.CPP spawn doors code:


if ((tile >= 90 && tile <= 105) || [i](tile >= 144 && tile <= 147))
            {
                // door
                switch (tile)
                {
                    case 90:
                    case 92:
                    case 94:
                    case 96:
                    case 98:
                    case 100:
                    case 102:
                    case 104:
                        SpawnDoor (x,y,1,(tile-90)/2);
                        break;[/i]


                  case 144:
                  case 146:
                        SpawnDoor (x,y,1,(tile-144)/2);
                        break;


                    case 91:
                    case 93:
                    case 95:
                    case 97:
                    case 99:
                    case 101:
                    case 103:
                    case 105:
                        SpawnDoor (x,y,0,(tile-91)/2);
                        break;




[i]                  case 145:
                  case 147:
                        SpawnDoor (x,y,0,(tile-145)/2);
                        break;
[/i]
                }
            }

--------------------------------------------------------

When I run game with this WL_GAME.CPP code, instead of wooden doors there are normal doors, instead of 5-lock doors there are gold key doors for horizontal and silver key doors for vertical.

When I run game with changed values there are no object in game or there are some certain walls..

Thank you.

[solved]Wolf4SDL - How to add a new sounds - Wed Feb 06, 2019 1:27 pm

[SOLUTION]

Use WDC program:
In "Sound Tools" menu use "Add a new sound" wizard to add all of three types for your new sound (PC, Adlib and Digital sound).
In "File" menu, compile all OR compile only "AUDIOT" and "VSWAP".
In AUDIOWL6.H above LASTSOUND add a new sound name.
In WL_MAIN add a new sound name in wolfdigimap after sound number 45(ROSESND).

Of course, don't forget to compile all of these changes. But before that, one more thing.

I did all of these steps already before, but where was my problem...
It is in VERSION.H:
WDC program needs some test folder(different from base folder). So, in that test folder I forgot to change the WOLF3D DATA FILES location.
Every time, when I run the game with compiler or game itself in its folder, the game crushes because I forget to change this line in VERSION.H:
#define DATADIR "/xxx/xxx/.../xxx/Wolf4SDL Folder/"

This line represents location of the WOLF3D data files.
Instead of that address just put:

#define DATADIR ""

OR

#define DATADIR "./"

Finally, now the game is ready for compiling and running with your new sound.

Good luck!

[solved]Wolf4SDL - How to add a new sounds - Mon Feb 04, 2019 6:37 am

Hi Princess Peach!
I know that and I did it before as I wrote in my first post, but that didn't work!
There must be something more to change in the code(I don't know in which files exactly)..
Exactly, I don't understand a NUMSOUNDS and NUMSNDCHUNKS state in code for Wolf4SDL. In Wolf3d source code it was not the case(requires only to increase the values).
My first entailment was that there should be some #define for NUMSOUNDS and NUMSNDCHUNKS or something what is connected with it somewhere in the files, but I didn't find any..
There must be solution in the code for this (for me simple) case, but I'm not that good with Wolf4SDL, so I need help Smile


Back to top

Current date/time is Mon May 20, 2024 5:26 am