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       

[Help] SDL 64+ Wall Tiles
Page 1 of 1
DieHard Wolfers Forum Index -> SDL Code Crackers 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
Dean
Moderator
<B>Moderator</B>


Joined: 10 Jan 2006
Last Visit: 18 Jan 2018

Topics: 52
Posts: 2189
Location: Australia
australia.gif

PostPosted: Sun Jul 27, 2008 4:35 pm
   Subject: Re: [Help] SDL 64+ Wall Tiles
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

It just uses the standard number of walls. The sprite count is increased though.

@ Tricob - Where you've got confused is for a new mod I discussed with you that I've been wanting to make but because of the original engines lack of memory I couldn't do it. I know that SDL would be able to make it possible but I figure that I would need at least 90 for it, more of I could. I just have no idea how to do anything SDL related and it looks complicated to me. Although I can do basic stuff coding just isn't a natural thing to me.

I'd love to work this SDl thing out though. The main problem is that there are things that I would like in the mod that haven't been seen in Wolf before but I'm sure could be done. I really struggle with the normal code let alone SDL.

_________________
The Wolfenstein 3d Blog
The Wolfenstein 3d Blog is now on Facebook!

"Strong minds discuss ideas, average minds discuss events, weak minds discuss people" - Socrates
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 5:46 ago.

Topics: 163
Posts: 8152
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Sun Jul 27, 2008 7:17 pm
   Subject: Re: [Help] SDL 64+ Wall Tiles
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Dean wrote:
I just have no idea how to do anything SDL related and it looks complicated to me.
Well, it's not really that complicated - just time-consuming. I simply compared the differences between the 16-bit code and the SDL code, and it was a little less overwhelming.

As has been said before, the original Wolf3D code isn't much more than very basic C routines and layouts. The big exceptions are the ID_PM, ID_MM, ID_SD, and ID_IN files (I think that's all of them), which you usually won't have to mess around with. IIRC, WolfDX doesn't have any of these files altered; most of my changes were in WL_DEF, WL_MAIN, WL_MENU, WL_ACT1, and WL_AGENT. WL_AGENT was the most intimidating code, I'd say, but only relating to the weapon code. And the WolfDX code is publicly available.

Quote:
Although I can do basic stuff coding just isn't a natural thing to me.
It doesn't have to come naturally. Smile Yes, it helps to start programming at an early age like I did (Elementary School), but it isn't necessary. BASIC has been my forte for quite a while now, and despite working with the Wolfenstein code for over a year, I'm still far less adept with Wolfenstein coding than I am coding in BASIC. I suppose I always will be, but at least it shows a little less today than it did a year ago.

Quote:
I really struggle with the normal code let alone SDL.
I still struggle with the code myself, be it 16-bit or SDL. On the other hand, it's simple lack of experience. I know I won't get better at coding unless I continue to do it. I won't learn a thing by sitting around doing nothing. Smile
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 0:26 ago.

Topics: 38
Posts: 2459
Location: Christchurch, New Zealand
newzealand.gif

PostPosted: Mon Jul 28, 2008 2:11 am
   Subject: Re: [Help] SDL 64+ Wall Tiles
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Wheeee, eternal circle of trial and error! That's how I code. Sometimes it works... with emphasis on the eventually.
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

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

PostPosted: Tue Jul 29, 2008 1:39 am
   Subject: Re: [Help] SDL 64+ Wall Tiles
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Tricob wrote:
Dean, does your mod use the 90 Available Walls code? If so, I have yet to see a code tutorial on enabling this. WolfDX itself lacks this feature, as a matter of fact. Sad


ok.... Its not that difficult really... lol...

Change the value of MAXWALLTILES to 90 in the wl_def.h file..... original is 64

Then in wl_draw.cpp change the routines to look like this:

::: CODE :::

//
//  BrotherTank's 64 Plus Wall values Routine
//
int CheckHighBits (int value)       // Check For Door Bit 7 only
{  // If Pushwall Return False Bit7&6
    if ((value & 0x40) && (value & 0x80))  { return 0; }
    else
    {
        if (value & 0x80) { return 1; }  // Is Door Return True
    }
    return 0;                  // Not Door Return False
}

// Chokan's Check Tiles - Allows for Beside Doors!!
boolean CheckTile (int x, int y, boolean vertical)
{
    if (vertical)
    {
      if ((x > 0) && (tilemap[x-1][y]/64 == 2)
         && (!doorobjlist[tilemap[x-1][y]-128].vertical)) return 1;
      if ((x+1 < MAPSIZE) && (tilemap[x+1][y]/64 == 2)
         && (!doorobjlist[tilemap[x+1][y]-128].vertical)) return 1;
    }
    else
    {
      if ((y > 0) && (tilemap[x][y-1]/64 == 2)
         && (doorobjlist[tilemap[x][y-1]-128].vertical)) return 1;
      if ((y+1 < MAPSIZE) && (tilemap[x][y+1]/64 == 2)
         && (doorobjlist[tilemap[x][y+1]-128].vertical)) return 1;
    }
    return 0;
}

/*
====================
=
= HitVertWall
=
= 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 HitVertWall (void)
{
    int wallpic;
    int texture;
    int tileobj = MAPSPOT(xtile,ytile,1);

    texture = ((yintercept+texdelta)>>TEXTUREFROMFIXEDSHIFT)&TEXTUREMASK;
    if (xtilestep == -1)
    {
        texture = TEXTUREMASK-texture;
        xintercept += TILEGLOBAL;
    }

    if(lastside==1 && lastintercept==xtile && lasttilehit==tilehit && !CheckTile (xtile, ytile, 1))
    {
        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 (CheckTile(xtile,ytile,1))
    {                                                               // check for adjacent doors
        ytile = (short)(yintercept>>TILESHIFT);
        if (CheckHighBits(tilemap[xtile-xtilestep][ytile]))
        { wallpic = DOORWALL+3; lasttilehit = 0; }
        else wallpic = vertwall[tilehit];
    }
    else wallpic = vertwall[tilehit];

    postsource = PM_GetTexture(wallpic) + texture;
}


/*
====================
=
= 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;
    int tileobj = MAPSPOT(xtile,ytile,1);

    texture = ((xintercept+texdelta)>>TEXTUREFROMFIXEDSHIFT)&TEXTUREMASK;
    if (ytilestep == -1)
        yintercept += TILEGLOBAL;
    else
        texture = TEXTUREMASK-texture;
    if(lastside==0 && lastintercept==ytile && lasttilehit==tilehit && !CheckTile (xtile, ytile, 0))
    {
        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 (CheckTile (xtile, ytile, 0))
    {                                                               // check for adjacent doors
        xtile = (short)(xintercept>>TILESHIFT);
        if (CheckHighBits(tilemap[xtile][ytile-ytilestep]))
        { wallpic = DOORWALL+2; lasttilehit = 0; }
        else wallpic = horizwall[tilehit];
    }
    else wallpic = horizwall[tilehit];

    postsource = PM_GetTexture(wallpic) + texture;
}


And in the wl_act1.cpp file comment out the lines like this in the Spawndoor routine:

::: CODE :::

    if (vertical)
    {
        *map = *(map-1);                        // set area number
//        tilemap[tilex][tiley-1] |= 0x40;
//        tilemap[tilex][tiley+1] |= 0x40;
    }
    else
    {
        *map = *(map-mapwidth);                                 // set area number
//        tilemap[tilex-1][tiley] |= 0x40;
//        tilemap[tilex+1][tiley] |= 0x40;
    }


That should just about do it...

Let me know how you make out...

Greg
BrotherTank
Raziel
DieHard SS
DieHard SS


Joined: 03 Dec 2005
Last Visit: 03 Dec 2009

Topics: 49
Posts: 485
Location: Israhell
israel.gif

PostPosted: Tue Jul 29, 2008 8:08 am
   Subject: Re: [Help] SDL 64+ Wall Tiles
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

That's the 64 walls tutorial for SDL? Surprised
Can't wait to test it :]

_________________
Raziel A.
Dean
Moderator
<B>Moderator</B>


Joined: 10 Jan 2006
Last Visit: 18 Jan 2018

Topics: 52
Posts: 2189
Location: Australia
australia.gif

PostPosted: Tue Jul 29, 2008 2:37 pm
   Subject: Re: [Help] SDL 64+ Wall Tiles
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Awesome! Thanks BT, this was one of the main things I was going to need!

I appreciate your help Smile

_________________
The Wolfenstein 3d Blog
The Wolfenstein 3d Blog is now on Facebook!

"Strong minds discuss ideas, average minds discuss events, weak minds discuss people" - Socrates
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 5:46 ago.

Topics: 163
Posts: 8152
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Tue Jul 29, 2008 8:55 pm
   Subject: Re: [Help] SDL 64+ Wall Tiles
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thanks, Greg! Very Happy Thumbs Up Too Cool I'll check it out tomorrow, hopefully.

I'm about out of time tonight, due to a late start; severe weather most of the day. Alabama stinks! Smile
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

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

PostPosted: Wed Jul 30, 2008 12:30 am
   Subject: Re: [Help] SDL 64+ Wall Tiles
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I just did that off the top... the code doesn't look any different from the straight original HitVertWall and HitHorzWall routines..... So it is pretty much a straight install. I haven't tested that myself either... But in theory it should work, unless Ripper has changed something in the way that it handles wall tiles and drawing them...

Greg
BrotherTank

Edit: PS.: We should probably move this to it's own thread....

So anyone when you need one of the old Tutorials Converted, start a new thread in the SDL area with the title "[HELP] Tutorial Name Conversion".....

Tank
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

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

PostPosted: Wed Jul 30, 2008 2:04 pm
   Subject: Re: [Help] SDL 64+ Wall Tiles
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

NASA : We have a problem.... lol....

Tried and tested the code that I posted above... which should work (in theory) but it doesn't....
It shows the Walls... The Doors.... But not the Door sides...

Why??

Because if you go down and find the HitVertPWall and HitHorizPWall routines, you will find that they are not used at all in the game. It seems when Ripper converted the wl_drw_a.asm file to C++, he reworked the bit function and just has the game use the HitVertWall and HitHorizWall routines for drawing the pushwalls. That part I don't quite understand. It looks like what he has done will also affect the other tutorials like Patchwalls - Scrolling Walls... And possibly Animated Walls.... Then again, Maybe not?? I do know that in the changes he has made, it completely breaks the 64+ code tutorials... All of them....

Not to worry... It just means a little more code has to be added to check for a few conditions and the 64+ should be ok again. I'll keep plugging away at this end until I get it back functioning. Basically.... I have to figure out Rippers new void AsmRefresh() routine and program a patch to the 64+ wall code...

Greg
BrotherTank
Dean
Moderator
<B>Moderator</B>


Joined: 10 Jan 2006
Last Visit: 18 Jan 2018

Topics: 52
Posts: 2189
Location: Australia
australia.gif

PostPosted: Wed Jul 30, 2008 3:36 pm
   Subject: Re: [Help] SDL 64+ Wall Tiles
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thanks for the help Greg.

I look forward to seeing what you come up with, I know if anyone can find the answer its' you!

_________________
The Wolfenstein 3d Blog
The Wolfenstein 3d Blog is now on Facebook!

"Strong minds discuss ideas, average minds discuss events, weak minds discuss people" - Socrates
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 5:46 ago.

Topics: 163
Posts: 8152
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Wed Jul 30, 2008 10:37 pm
   Subject: Re: [Help] SDL 64+ Wall Tiles
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

BrotherTank wrote:
Because if you go down and find the HitVertPWall and HitHorizPWall routines, you will find that they are not used at all in the game. It seems when Ripper converted the wl_drw_a.asm file to C++, he reworked the bit function and just has the game use the HitVertWall and HitHorizWall routines for drawing the pushwalls. That part I don't quite understand.
I think it's because Ripper's using his Free Pushwalls code. I couldn't help but notice this feature when I ran E1L2 of the non-demo version of WolfDX (The demo runs E1L1 and E1L3 of the full version).

Quote:
Not to worry... It just means a little more code has to be added to check for a few conditions and the 64+ should be ok again. I'll keep plugging away at this end until I get it back functioning. Basically.... I have to figure out Rippers new void AsmRefresh() routine and program a patch to the 64+ wall code...
Ripper gave details saying exactly how to enable 90 walls in Wolf4SDL; you'll find the info in his main Wolf4SDL thread.
Soldat 555
Guest



Last Visit:





PostPosted: Mon Dec 20, 2010 4:42 pm
   Subject: Re: [Help] SDL 64+ Wall Tiles
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

So do you guys know how to fix the "no doorside" thing yet? I used BrotherTank's code but there's still no side in a doorway. I also checked Ripper's "Wolf4SDL released" and saw people ask if a future release of Wolf4SDL would support 90+ walls but didn't find a tutorial... I also found alot of stuff on pushwalls but I don't need any of that.

So any help with what needs to be added to the code? It'd be helpful. Smile


Thunderstorm Joshua M@d Wolf Waight Thunderstorm
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 5:46 ago.

Topics: 163
Posts: 8152
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Mon Dec 20, 2010 6:42 pm
   Subject: Re: [Help] SDL 64+ Wall Tiles
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

This is the tutorial I'm using in my "Base Of Operations" tutorial. Hope it's helpful. Smile
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

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

PostPosted: Tue Dec 21, 2010 12:57 am
   Subject: Re: [Help] SDL 64+ Wall Tiles
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Soldat 555 wrote:
So do you guys know how to fix the "no doorside" thing yet? I used BrotherTank's code but there's still no side in a doorway. I also checked Ripper's "Wolf4SDL released" and saw people ask if a future release of Wolf4SDL would support 90+ walls but didn't find a tutorial... I also found alot of stuff on pushwalls but I don't need any of that.

So any help with what needs to be added to the code? It'd be helpful. Smile


Thunderstorm Joshua M@d Wolf Waight Thunderstorm


I did fix it. I'll have to dig up the source as I've changed computer systems in the last year and I haven't done any major programing in C++ since. All the sources that I was working on were archived, but haven't been moved to the new HD in this system... So give me a day or three and I'll have the fix for you for sure...

Greg
BrotherTank
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

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

PostPosted: Tue Dec 21, 2010 5:57 pm
   Subject: Re: [Help] SDL 64+ Wall Tiles
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

BrotherTank wrote:
I did fix it. I'll have to dig up the source as I've changed computer systems in the last year and I haven't done any major programing in C++ since. All the sources that I was working on were archived, but haven't been moved to the new HD in this system... So give me a day or three and I'll have the fix for you for sure...


Yep... I did in fact fix it... lol... I actually have to remove code because I installed wall patches, the blakestone style doors and all kinds of other little things that I don't think that you want... ie: Animated walls... etc...

So here's the quick stripped down:

In Wl_def.h:

::: CODE :::
#define MAXWALLTILES                      90     // max number of wall tiles


This can be 64 or 90... I just change it to 90 and leave it even if I'm only using 64... as it doesn't care or bother the program any... lol...
Then in Wl_Draw.cpp:


::: CODE :::

// ------------------------------------------------------------------------
//                     64 Plus Wall values Routine
// ------------------------------------------------------------------------
//
//  A means of tricking the system into allowing us access to bit 6
//  ie:  If the wall being checked is a Pushwall, bit's 6 & 7 will be 1
//       If the wall being checked is a Door, then Bit 7 will be 1
//  Chris took BrotherTank's original work and made it better. 
//  Here are those routines:
//
//int CheckHighBits (int value)       // Check For Door Bit 7 only
//{
//   if ((value & 0x40) && (value & 0x80)) // If Pushwall Return False Bit7&6
//      { return 0; }
//   else
//     {
//   if (value & 0x80)        // Is Door Return True
//     { return 1; }
//   else
//     { return 0; }                  // Not Door Return False
//      }
//}
//
//int CheckAdjacentTile (int x, int y)
//{  // Part of 64+ Wall Tiles - Make sure within Map Boundaries
//   // to fix bug of not allowing 64+ in outer edge of map
//   // Checks Adjacent Tile for Bit 7 Set - Door or Pushwall
//   if ((y-1 >= 0) && (tilemap[x][y-1] & 0x80) ||
//      (y+1 <= 63) && (tilemap[x][y+1] & 0x80) ||
//      (x-1 >= 0) && (tilemap[x-1][y] & 0x80) ||
//      (x+1 <= 63) && (tilemap[x+1][y] & 0x80))
//    return 1;
//   else
//    return 0;
//}
//
//
byte CheckHighBits (byte highbit)  // Check For Door Bit 7 only
{
  if (highbit/64 == 2) return 1; else return 0; // True = Bit 7 Set  False = Bit Not Set
}

boolean CheckVertTile (int x, int y)
{
  if (((x > 0) && (tilemap[x-1][y]/64 == 2) &&
       (!doorobjlist[tilemap[x-1][y]-128].vertical)) ||
      ((x+1 < MAPSIZE) && (tilemap[x+1][y]/64 == 2) &&
       (!doorobjlist[tilemap[x+1][y]-128].vertical))) return 1;
  return 0;
}

boolean CheckHorizTile (int x, int y)
{
  if (((y > 0) && (tilemap[x][y-1]/64 == 2) &&
       (doorobjlist[tilemap[x][y-1]-128].vertical)) ||
      ((y+1 < MAPSIZE) && (tilemap[x][y+1]/64 == 2) &&
       (doorobjlist[tilemap[x][y+1]-128].vertical))) return 1;
  return 0;
}


That stuff goes above the HitVert and HitHorzWall Routines in the Wl_draw.cpp file... Then... The Two routines [HitVert & HitHorz] should look like this:

::: CODE :::
/**************************************************************************
**                      Drawing the WALLS                                **
**************************************************************************/
void HitVertWall (void)
{
  int wallpic;
  int texture;

  ytile = (short) (yintercept >> TILESHIFT);
  texture = ((yintercept+texdelta)>>TEXTUREFROMFIXEDSHIFT)&TEXTUREMASK;

  if (xtilestep == -1)
  {
    if(MAPSPOT(xtile,ytile,1) != TILEMIRROR) texture = TEXTUREMASK-texture;
    xintercept += TILEGLOBAL;
  }

  if (lastside==1 && lastintercept==xtile &&
      lasttilehit==tilehit && !CheckVertTile(xtile,ytile) )
  {
    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 > MAXWALLTILES) tilehit = tilehit - MAXWALLTILES;

  wallpic = vertwall[tilehit];

  if (CheckVertTile (xtile,ytile))
  {                                                               // check for adjacent doors
    if (CheckHighBits (tilemap[xtile-xtilestep][ytile]))
    {
      lasttilehit = 0;
      wallpic = DOORWALL+3;
    }
  }
  postsource = PM_GetTexture(wallpic) + texture;
}

void HitHorizWall (void)
{
  int wallpic;
  int texture;
   
  xtile = (short) (xintercept >> TILESHIFT);
  texture = ((xintercept+texdelta)>>TEXTUREFROMFIXEDSHIFT)&TEXTUREMASK;

  if (ytilestep == -1)
    yintercept += TILEGLOBAL;
  else if(MAPSPOT(xtile,ytile,1) != TILEMIRROR)
    texture = TEXTUREMASK-texture;

  if (lastside==0 && lastintercept==ytile &&
      lasttilehit==tilehit && !CheckHorizTile(xtile,ytile) )
  {
    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 > MAXWALLTILES) tilehit = tilehit - MAXWALLTILES;

  wallpic = horizwall[tilehit];

  if (CheckHorizTile(xtile,ytile))
  {                                                // check for adjacent doors
    if (CheckHighBits(tilemap[xtile][ytile-ytilestep]))
    {
      lasttilehit = 0;
      wallpic = DOORWALL+2;
    }
  }
  postsource = PM_GetTexture(wallpic) + texture;
}


And in the wl_act1.cpp file comment out the lines like this in the Spawndoor routine:

::: CODE :::

    if (vertical)
    {
        *map = *(map-1);                        // set area number
//        tilemap[tilex][tiley-1] |= 0x40;
//        tilemap[tilex][tiley+1] |= 0x40;
    }
    else
    {
        *map = *(map-mapwidth);                                 // set area number
//        tilemap[tilex-1][tiley] |= 0x40;
//        tilemap[tilex+1][tiley] |= 0x40;
    }


Now this does include the Tile Mirror update.. So you need to add that define to your Wl_def.h file as well... I use value 102 on the map for that.. it's like the deaf guard floor tile in that it modifies the wall tile that is placed on top of the code...

::: CODE :::
#define TILEMIRROR                102         // Ripper's Tile Mirror


And that's about it...

Greg
BrotherTank
Soldat 555
Guest



Last Visit:





PostPosted: Wed Dec 22, 2010 7:17 pm
   Subject: Re: [Help] SDL 64+ Wall Tiles
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thanks BrotherTank, it works like a charm and awesomely now! Very Happy

... On a side note, there is a weird error with Wall #63 or 64, it seems to be the same error Tricob described in another topic ( http://diehardwolfers.areyep.com/viewtopic.php?t=5142 ) however I'm still able to use the textures for floors and ceilings and that's why I'm not worrying too much of it, I just skip that tile for walls. Smile


Thunderstorm Joshua M@d Wolf Waight Thunderstorm
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

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

PostPosted: Thu Dec 23, 2010 12:23 am
   Subject: Re: [Help] SDL 64+ Wall Tiles
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Ok, I think I know what I did to fix that.. let me dig into the code and compare to a virgin copy of the source... And I'll be able to give you the changes that I made...

Other than that... Good to hear that it is working for you.

Greg
BrotherTank
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

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

PostPosted: Sat Dec 25, 2010 2:01 am
   Subject: Re: [Help] SDL 64+ Wall Tiles
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Soldat 555 wrote:
On a side note, there is a weird error with Wall #63 or 64, it seems to be the same error Tricob described in another topic (Odd Drawn Tile Placement ) however I'm still able to use the textures for floors and ceilings and that's why I'm not worrying too much of it, I just skip that tile for walls. Smile


No problem... The reason for the error is that when Ripper made the conversion to free pushwalls, he kept the value of the pushwalls in motion as 64... which is really tile 63 in the engine as the tiles start at 0... instead of converting it to 255 as Chris had suggested in his code and tutorial.... The other thing that it required was that the AsmRefresh routine be re-arranged to detect the pushwall, doors, and walls in a specific order.. So this is what I did to the original code to make it all work:


In Wl_Draw.cpp, replace the AsmRefresh routine with this one:

::: CODE :::

void AsmRefresh()
{
    int32_t xstep,ystep;
    longword xpartial,ypartial;
    boolean playerInPushwallBackTile = tilemap[focaltx][focalty] == 255;

    for(pixx=0;pixx<viewwidth;pixx++)
    {
        short angl=midangle+pixelangle[pixx];
        if(angl<0) angl+=FINEANGLES;
        if(angl>=3600) angl-=FINEANGLES;
        if(angl<900)
        {
            xtilestep=1;
            ytilestep=-1;
            xstep=finetangent[900-1-angl];
            ystep=-finetangent[angl];
            xpartial=xpartialup;
            ypartial=ypartialdown;
        }
        else if(angl<1800)
        {
            xtilestep=-1;
            ytilestep=-1;
            xstep=-finetangent[angl-900];
            ystep=-finetangent[1800-1-angl];
            xpartial=xpartialdown;
            ypartial=ypartialdown;
        }
        else if(angl<2700)
        {
            xtilestep=-1;
            ytilestep=1;
            xstep=-finetangent[2700-1-angl];
            ystep=finetangent[angl-1800];
            xpartial=xpartialdown;
            ypartial=ypartialup;
        }
        else if(angl<3600)
        {
            xtilestep=1;
            ytilestep=1;
            xstep=finetangent[angl-2700];
            ystep=finetangent[3600-1-angl];
            xpartial=xpartialup;
            ypartial=ypartialup;
        }
        yintercept=FixedMul(ystep,xpartial)+viewy;
        xtile=focaltx+xtilestep;
        xspot=(word)((xtile<<mapshift)+((uint32_t)yintercept>>16));
        xintercept=FixedMul(xstep,ypartial)+viewx;
        ytile=focalty+ytilestep;
        yspot=(word)((((uint32_t)xintercept>>16)<<mapshift)+ytile);
        texdelta=0;

        // Special treatment when player is in back tile of pushwall
        if(playerInPushwallBackTile)
        {
            if(    pwalldir == di_east && xtilestep ==  1
                || pwalldir == di_west && xtilestep == -1)
            {
                int32_t yintbuf = yintercept - ((ystep * (64 - pwallpos)) >> 6);
                if((yintbuf >> 16) == focalty)   // ray hits pushwall back?
                {
                    if(pwalldir == di_east)
                        xintercept = (focaltx << TILESHIFT) + (pwallpos << 10);
                    else
                        xintercept = (focaltx << TILESHIFT) - TILEGLOBAL + ((64 - pwallpos) << 10);
                    yintercept = yintbuf;
                    tilehit = pwalltile;
                    HitVertWall();
                    continue;
                }
            }
            else if(pwalldir == di_south && ytilestep ==  1
                ||  pwalldir == di_north && ytilestep == -1)
            {
                int32_t xintbuf = xintercept - ((xstep * (64 - pwallpos)) >> 6);
                if((xintbuf >> 16) == focaltx)   // ray hits pushwall back?
                {
                    xintercept = xintbuf;
                    if(pwalldir == di_south)
                        yintercept = (focalty << TILESHIFT) + (pwallpos << 10);
                    else
                        yintercept = (focalty << TILESHIFT) - TILEGLOBAL + ((64 - pwallpos) << 10);
                    tilehit = pwalltile;
                    HitHorizWall();
                    continue;
                }
            }
        }

        do
        {
            if(ytilestep==-1 && (yintercept>>16)<=ytile) goto horizentry;
            if(ytilestep==1 && (yintercept>>16)>=ytile) goto horizentry;
vertentry:
            if((uint32_t)yintercept>mapheight*65536-1 || (word)xtile>=mapwidth)
            {
                if(xtile<0) xintercept=0;
                if(xtile>=mapwidth) xintercept=mapwidth<<TILESHIFT;
                if(yintercept<0) yintercept=0;
                if(yintercept>=(mapheight<<TILESHIFT)) yintercept=mapheight<<TILESHIFT;
                yspot=0xffff;
                tilehit=0;
                HitHorizBorder();
                break;
            }
            if(xspot>=maparea) break;
            tilehit=((byte *)tilemap)[xspot];
            if(tilehit)
            {
               if(tilehit==255)
               {
                  if(pwalldir==di_west || pwalldir==di_east)
                  {
                     int32_t yintbuf;
                     int pwallposnorm;
                     int pwallposinv;

                     if(pwalldir==di_west)
                     {
                        pwallposnorm = 64-pwallpos;
                        pwallposinv = pwallpos;
                     }
                     else
                     {
                        pwallposnorm = pwallpos;
                        pwallposinv = 64-pwallpos;
                     }

                     if(pwalldir == di_east && xtile==pwallx && ((uint32_t)yintercept>>16)==pwally
                       || pwalldir == di_west && !(xtile==pwallx && ((uint32_t)yintercept>>16)==pwally))
                     {
                        yintbuf=yintercept+((ystep*pwallposnorm)>>6);
                        if((yintbuf>>16)!=(yintercept>>16)) goto passvert;
                        xintercept=(xtile<<TILESHIFT)+TILEGLOBAL-(pwallposinv<<10);
                        yintercept=yintbuf;
                        tilehit=pwalltile;
                        HitVertWall();
                     }
                     else
                     {
                        yintbuf=yintercept+((ystep*pwallposinv)>>6);
                        if((yintbuf>>16)!=(yintercept>>16)) goto passvert;
                        xintercept=(xtile<<TILESHIFT)-(pwallposinv<<10);
                        yintercept=yintbuf;
                        tilehit=pwalltile;
                        HitVertWall();
                     }
                  }
                  else
                  {
                     int pwallposi = pwallpos;
                     if(pwalldir==di_north) pwallposi = 64-pwallpos;
                     if(pwalldir==di_south && (word)yintercept<(pwallposi<<10)
                        || pwalldir==di_north && (word)yintercept>(pwallposi<<10))
                     {
                        if(((uint32_t)yintercept>>16)==pwally && xtile==pwallx)
                        {
                            if(pwalldir==di_south && (int32_t)((word)yintercept)+ystep<(pwallposi<<10)
                               || pwalldir==di_north && (int32_t)((word)yintercept)+ystep>(pwallposi<<10))
                               goto passvert;
                            if(pwalldir==di_south)
                               yintercept=(yintercept&0xffff0000)+(pwallposi<<10);
                            else
                               yintercept=(yintercept&0xffff0000)-TILEGLOBAL+(pwallposi<<10);
                               xintercept=xintercept-((xstep*(64-pwallpos))>>6);
                               tilehit=pwalltile;
                               HitHorizWall();
                         }
                         else
                         {
                            texdelta = -(pwallposi<<10);
                            xintercept=xtile<<TILESHIFT;
                            tilehit=pwalltile;
                            HitVertWall();
                         }
                      }
                      else
                      {
                         if(((uint32_t)yintercept>>16)==pwally && xtile==pwallx)
                         {
                            texdelta = -(pwallposi<<10);
                            xintercept=xtile<<TILESHIFT;
                            tilehit=pwalltile;
                            HitVertWall();
                         }
                         else
                         {
                            if(pwalldir==di_south && (int32_t)((word)yintercept)+ystep>(pwallposi<<10)
                               || pwalldir==di_north && (int32_t)((word)yintercept)+ystep<(pwallposi<<10))
                               goto passvert;
                            if(pwalldir==di_south)
                               yintercept=(yintercept&0xffff0000)-((64-pwallpos)<<10);
                            else
                               yintercept=(yintercept&0xffff0000)+((64-pwallpos)<<10);
                            xintercept=xintercept-((xstep*pwallpos)>>6);
                            tilehit=pwalltile;
                            HitHorizWall();
                         }
                      }
                   }
                }
                else if(tilehit&0x80)
                {
                   int32_t yintbuf=yintercept+(ystep>>1);
                   if((yintbuf>>16)!=(yintercept>>16))
                      goto passvert;
                   if((word)yintbuf<doorposition[tilehit&0x7f])
                      goto passvert;
                   yintercept=yintbuf;
                   xintercept=(xtile<<TILESHIFT)|0x8000;
                   HitVertDoor();
                }
                else
                {
                   xintercept=xtile<<TILESHIFT;
                   HitVertWall();
                }
                break;
            }
passvert:
            *((byte *)spotvis+xspot)=1;
            xtile+=xtilestep;
            yintercept+=ystep;
            xspot=(word)((xtile<<mapshift)+((uint32_t)yintercept>>16));
        }
        while(1);
        continue;

        do
        {
            if(xtilestep==-1 && (xintercept>>16)<=xtile) goto vertentry;
            if(xtilestep==1 && (xintercept>>16)>=xtile) goto vertentry;
horizentry:
            if((uint32_t)xintercept>mapwidth*65536-1 || (word)ytile>=mapheight)
            {
                if(ytile<0) yintercept=0;
                if(ytile>=mapheight) yintercept=mapheight<<TILESHIFT;
                if(xintercept<0) xintercept=0;
                if(xintercept>=(mapwidth<<TILESHIFT)) xintercept=mapwidth<<TILESHIFT;
                xspot=0xffff;
                tilehit=0;
                HitVertBorder();
                break;
            }
            if(yspot>=maparea) break;
            tilehit=((byte *)tilemap)[yspot];
            if(tilehit)
            {
               if(tilehit==255)
               {
                  if(pwalldir==di_north || pwalldir==di_south)
                  {
                     int32_t xintbuf;
                     int pwallposnorm;
                     int pwallposinv;

                     if(pwalldir==di_north)
                     {
                        pwallposnorm = 64-pwallpos;
                        pwallposinv = pwallpos;
                     }
                     else
                     {
                        pwallposnorm = pwallpos;
                        pwallposinv = 64-pwallpos;
                     }

                     if(pwalldir == di_south && ytile==pwally && ((uint32_t)xintercept>>16)==pwallx
                        || pwalldir == di_north && !(ytile==pwally && ((uint32_t)xintercept>>16)==pwallx))
                     {
                        xintbuf=xintercept+((xstep*pwallposnorm)>>6);
                        if((xintbuf>>16)!=(xintercept>>16)) goto passhoriz;
                        yintercept=(ytile<<TILESHIFT)+TILEGLOBAL-(pwallposinv<<10);
                        xintercept=xintbuf;
                        tilehit=pwalltile;
                        HitHorizWall();
                     }
                     else
                     {
                        xintbuf=xintercept+((xstep*pwallposinv)>>6);
                        if((xintbuf>>16)!=(xintercept>>16)) goto passhoriz;
                        yintercept=(ytile<<TILESHIFT)-(pwallposinv<<10);
                        xintercept=xintbuf;
                        tilehit=pwalltile;
                        HitHorizWall();
                     }
                  }
                  else
                  {
                     int pwallposi = pwallpos;
                     if(pwalldir==di_west) pwallposi = 64-pwallpos;
                     if(pwalldir==di_east && (word)xintercept<(pwallposi<<10)
                        || pwalldir==di_west && (word)xintercept>(pwallposi<<10))
                     {
                        if(((uint32_t)xintercept>>16)==pwallx && ytile==pwally)
                        {
                           if(pwalldir==di_east && (int32_t)((word)xintercept)+xstep<(pwallposi<<10)
                              || pwalldir==di_west && (int32_t)((word)xintercept)+xstep>(pwallposi<<10))
                              goto passhoriz;

                           if(pwalldir==di_east)
                              xintercept=(xintercept&0xffff0000)+(pwallposi<<10);
                           else
                              xintercept=(xintercept&0xffff0000)-TILEGLOBAL+(pwallposi<<10);
                           yintercept=yintercept-((ystep*(64-pwallpos))>>6);
                           tilehit=pwalltile;
                           HitVertWall();
                        }
                        else
                        {
                           texdelta = -(pwallposi<<10);
                           yintercept=ytile<<TILESHIFT;
                           tilehit=pwalltile;
                           HitHorizWall();
                        }
                     }
                     else
                     {
                        if(((uint32_t)xintercept>>16)==pwallx && ytile==pwally)
                        {
                           texdelta = -(pwallposi<<10);
                           yintercept=ytile<<TILESHIFT;
                           tilehit=pwalltile;
                           HitHorizWall();
                        }
                        else
                        {
                           if(pwalldir==di_east && (int32_t)((word)xintercept)+xstep>(pwallposi<<10)
                              || pwalldir==di_west && (int32_t)((word)xintercept)+xstep<(pwallposi<<10))
                              goto passhoriz;

                           if(pwalldir==di_east)
                              xintercept=(xintercept&0xffff0000)-((64-pwallpos)<<10);
                           else
                              xintercept=(xintercept&0xffff0000)+((64-pwallpos)<<10);
                           yintercept=yintercept-((ystep*pwallpos)>>6);
                           tilehit=pwalltile;
                           HitVertWall();
                        }
                     }
                  }
               }
               else if(tilehit&0x80)
               {
                  int32_t xintbuf=xintercept+(xstep>>1);
                  if((xintbuf>>16)!=(xintercept>>16)) goto passhoriz;
                  if((word)xintbuf<doorposition[tilehit&0x7f]) goto passhoriz;
                  xintercept=xintbuf;
                  yintercept=(ytile<<TILESHIFT)+0x8000;
                  HitHorizDoor();
               }
               else
               {
                  yintercept=ytile<<TILESHIFT;
                  HitHorizWall();
               }
               break;
            }
passhoriz:
            *((byte *)spotvis+yspot)=1;
            ytile+=ytilestep;
            xintercept+=xstep;
            yspot=(word)((((uint32_t)xintercept>>16)<<mapshift)+ytile);
        }
        while(1);
    }
}


In Wl_Act1.cpp go to the end of the file and replace the Pushwall Routines with these:

::: CODE :::

void PushWall (int checkx, int checky, int dir)
{
    int oldtile, dx, dy;

    if (pwallstate) return;

    oldtile = tilemap[checkx][checky];
    if (!oldtile) return;

    dx = dirs[dir][0];
    dy = dirs[dir][1];

    if (actorat[checkx+dx][checky+dy])
    {
        SD_PlaySound (NOWAYSND);
        return;
    }
    actorat[checkx+dx][checky+dy] = (objtype *)(uintptr_t) (tilemap[checkx+dx][checky+dy] = oldtile);

    gamestate.secretcount++;
    pwallx = checkx;
    pwally = checky;
    pwalldir = dir;
    pwallstate = 1;
    pwallpos = 0;
    pwalltile = tilemap[pwallx][pwally];
    tilemap[pwallx][pwally] = 255;
    tilemap[pwallx+dx][pwally+dy] = 255;
    *(mapsegs[1]+(pwally<<mapshift)+pwallx) = 0;   // remove P tile info
    *(mapsegs[0]+(pwally<<mapshift)+pwallx) = *(mapsegs[0]+(player->tiley<<mapshift)+player->tilex); // set correct floorcode (BrotherTank's fix)

    SD_PlaySound (PUSHWALLSND);
}



/*
=================
=
= MovePWalls
=
=================
*/

void MovePWalls (void)
{
    int oldblock,oldtile;

    if (!pwallstate) return;

    oldblock = pwallstate/128;

    pwallstate += (word)tics;

    if (pwallstate/128 != oldblock)
    {
        // block crossed into a new block
        oldtile = pwalltile;
        //
        // the tile can now be walked into
        //
        tilemap[pwallx][pwally] = 0;
        actorat[pwallx][pwally] = 0;
        *(mapsegs[0]+(pwally<<mapshift)+pwallx) = player->areanumber+AREATILE;

        int dx=dirs[pwalldir][0], dy=dirs[pwalldir][1];
        //
        // see if it should be pushed farther
        //
        if (pwallstate>=256)            // only move two tiles fix
        {
            //
            // the block has been pushed two tiles
            //
            pwallstate = 0;
            tilemap[pwallx+dx][pwally+dy] = oldtile;
            return;
        }
        else
        {
            int xl,yl,xh,yh;
            xl = (player->x-PLAYERSIZE) >> TILESHIFT;
            yl = (player->y-PLAYERSIZE) >> TILESHIFT;
            xh = (player->x+PLAYERSIZE) >> TILESHIFT;
            yh = (player->y+PLAYERSIZE) >> TILESHIFT;

            pwallx += dx;
            pwally += dy;

            if (actorat[pwallx+dx][pwally+dy]
                || xl<=pwallx+dx && pwallx+dx<=xh && yl<=pwally+dy && pwally+dy<=yh)
            {
                pwallstate = 0;
                tilemap[pwallx][pwally] = oldtile;
                return;
            }
            actorat[pwallx+dx][pwally+dy] = (objtype *)(uintptr_t) (tilemap[pwallx+dx][pwally+dy] = oldtile);
            tilemap[pwallx+dx][pwally+dy] = 255;
        }
    }
    pwallpos = (pwallstate/2)&63;
}


That should be it... Let me know if you have any problems... And for anyone else trying to install the 64+ walls into the SDL code... Use this post and my previous code post in this thread.

Enjoy... And Merry Christmas to all....

Greg
BrotherTank
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> SDL Code Crackers 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 Announcement: Wolf3d & Spear of Destiny Shareware SDL Downloads
Author: BrotherTank
10 14640 Tue Aug 24, 2010 10:18 am
dcbasic View latest post
No new posts Sticky: [Tutorial] Compiling Wolf4SDL with Code::Blocks
Author: dcbasic
90 22956 Wed May 24, 2017 7:53 pm
Falcon*93 View latest post
No new posts Problem with new Wolf4SDL Demo Releases
Author: BrotherTank
4 1688 Sun Jul 20, 2008 3:57 am
Ripper View latest post
No new posts [Help] Problem with Checkweaponchange function (wolf4sdl)
Author: Mortimer
4 3026 Sat May 17, 2008 11:26 am
Mortimer View latest post
No new posts [SDL] Apply 2nd ScaleFactor to selected (hi-res) vga gfx
Author: Andy_Nonymous
9 4247 Sun Apr 27, 2008 2:30 am
AlumiuN 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