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...


    reenabling no clipping

    Share

    Dark_wizzie
    I am Death Incarnate!
    I am Death Incarnate!

    Male
    Number of posts : 5090
    Age : 22
    Location : USA or Tawain
    Job : Student, Part time Cactuar fanatic
    Hobbie : Planting Cactuars.
    Message : I made this forum when I was 13 High on Drugs
    Registration date : 2007-03-24

    reenabling no clipping

    Post by Dark_wizzie on Sun Apr 29, 2007 1:33 pm

    dome




    Code Editing Tutorials
    Getting the No Clipping cheat back




    You dirty cheater! You want to clip again eh? Well, read on!

    Step 1. Go to your source code directory and open the file
    WL_DEBUG.C .

    Step 2. Go to line 502. You should now see this:

    #ifdef SPEAR %%%

    else if (Keyboard[sc_N]) // N = no clip

    {

    noclip^=1;

    CenterWindow (18,3);

    if (noclip)

    US_PrintCentered ("No clipping ON");

    else

    US_PrintCentered ("No clipping OFF");

    VW_UpdateScreen();

    IN_Ack ();

    return 1;

    }

    #endif %%%

    #if 0 %%%

    else if (Keyboard[sc_O]) // O = overhead

    {

    ViewMap(); %%%

    return 1;

    }

    #endif %%%

    else if (Keyboard[sc_P])

    {

    PicturePause ();

    return 1;

    }


    Step 3. Delete the lines who have an
    %%% sign behind it.

    Step 4. Now the code looks like this:


    else if (Keyboard[sc_N]) // N = no clip

    {

    noclip^=1;

    CenterWindow (18,3);

    if (noclip)

    US_PrintCentered ("No clipping ON");

    else

    US_PrintCentered ("No clipping OFF");

    VW_UpdateScreen();

    IN_Ack ();

    return 1;

    }

    else if (Keyboard[sc_O]) // O = overhead

    {

    return 1;

    }

    else if (Keyboard[sc_P])

    {

    PicturePause ();

    return 1;

    }


    Step 5. Save the file and Compile. Now you can use the No Clip cheat.





    Wolf3d Haven
    Minute Logic Blog

    Asa
    Can I Play, Daddy?
    Can I Play, Daddy?

    Male
    Number of posts : 26
    Age : 61
    Location : Los Angeles, California
    Hobbie : Wolfenstein 3D and Final Fantasy
    Registration date : 2010-08-03

    Re: reenabling no clipping

    Post by Asa on Sat Sep 11, 2010 11:43 am

    I just looked at the code. I found the following:

    Code:

    #ifdef SPEAR <-- remove this line
       else if (Keyboard[sc_N])         // N = no clip
       {
          noclip^=1;
          CenterWindow (18,3);
          if (noclip)
             US_PrintCentered ("No clipping ON");
          else
             US_PrintCentered ("No clipping OFF");
          VW_UpdateScreen();
          IN_Ack ();
          return 1;
       }
    #endif <-- and remove this line to enable clipping in Wolf3D
    #if 0 <-- remove this line
        else if (Keyboard[sc_O])            // O = overhead
        {
            ViewMap(); <-- DO NOT remove this line
            return 1;
        }
    #endif <-- and remove this line to enable overhead map mode

    Your code removed too many lines and affected more than just clipping. Your changes removed the map view function (found at the bottom of the same file).

    If you look at the code from the top of the file, all of the debug codes are specified in a continuous set of "else if" statements. The #ifdef SPEAR/#endif directive segregated the clipping debug to SoD, and the #if 0/#endif took the overhead map view out all together. Removing them a) re-enables clipping in Wolf3D and b) re-enables the overhead map view in both games.

    Well, if I understand the code properly it does, anyway. Unfortunately, I cannot test this. I have not been able to get a copy of Borland C 3.1 to install, and I don't know how to modify the code to work in VC++ (I have the bc31 file but it won't install).

    Asa
    Can I Play, Daddy?
    Can I Play, Daddy?

    Male
    Number of posts : 26
    Age : 61
    Location : Los Angeles, California
    Hobbie : Wolfenstein 3D and Final Fantasy
    Registration date : 2010-08-03

    Re: reenabling no clipping

    Post by Asa on Sat Sep 11, 2010 1:51 pm

    I was looking at the code again, and discovered something. In the previous post, I assumed that #if 0 always returns false, rendering the code segment between the #if directive and the #endif unusable. I don't think I am incorrect here, but I found that the code for calling the ViewMap() function is not the only place that has code contained within a #if 0/#endif container.

    Code:

    #if 0 <-- this one encloses the entire OverheadRefresh() function
    /*
    ===================
    =
    = OverheadRefresh
    =
    ===================
    */

    void OverheadRefresh (void)
    {
       unsigned   x,y,endx,endy,sx,sy;
       unsigned   tile;


       endx = maporgx+VIEWTILEX;
       endy = maporgy+VIEWTILEY;

       for (y=maporgy;y<endy;y++)
          for (x=maporgx;x<endx;x++)
          {
             sx = (x-maporgx)*16;
             sy = (y-maporgy)*16;

             switch (viewtype)
             {
    #if 0 <-- this one the choice of which view
             case mapview:
                tile = *(mapsegs[0]+farmapylookup[y]+x);
                break;

             case tilemapview:
                tile = tilemap[x][y];
                break;

             case visview:
                tile = spotvis[x][y];
                break;
    #endif <-- leaving the only view available the actoratview
             case actoratview:
                tile = (unsigned)actorat[x][y];
                break;
             }

             if (tile<MAXWALLTILES)
                LatchDrawTile(sx,sy,tile);
             else
             {
                LatchDrawChar(sx,sy,NUMBERCHARS+((tile&0xf000)>>12));
                LatchDrawChar(sx+8,sy,NUMBERCHARS+((tile&0x0f00)>>8));
                LatchDrawChar(sx,sy+8,NUMBERCHARS+((tile&0x00f0)>>4));
                LatchDrawChar(sx+8,sy+8,NUMBERCHARS+(tile&0x000f));
             }
          }

    }
    #endif <-- the end of the OverheadRefresh() function

    #if 0 <-- this one encloses the entire ViewMap() function
    /*
    ===================
    =
    = ViewMap
    =
    ===================
    */

    void ViewMap (void)
    {
       boolean      button0held;

       viewtype = actoratview;
    //   button0held = false;


       maporgx = player->tilex - VIEWTILEX/2;
       if (maporgx<0)
          maporgx = 0;
       if (maporgx>MAPSIZE-VIEWTILEX)
          maporgx=MAPSIZE-VIEWTILEX;
       maporgy = player->tiley - VIEWTILEY/2;
       if (maporgy<0)
          maporgy = 0;
       if (maporgy>MAPSIZE-VIEWTILEY)
          maporgy=MAPSIZE-VIEWTILEY;

       do
       {
    //
    // let user pan around
    //
          PollControls ();
          if (controlx < 0 && maporgx>0)
             maporgx--;
          if (controlx > 0 && maporgx<mapwidth-VIEWTILEX)
             maporgx++;
          if (controly < 0 && maporgy>0)
             maporgy--;
          if (controly > 0 && maporgy<mapheight-VIEWTILEY)
             maporgy++;

    #if 0 <-- not sure what this one is enclosing
          if (c.button0 && !button0held)
          {
             button0held = true;
             viewtype++;
             if (viewtype>visview)
                viewtype = mapview;
          }
          if (!c.button0)
             button0held = false;
    #endif

          OverheadRefresh ();

       } while (!Keyboard[sc_Escape]);

       IN_ClearKeysDown ();
    }
    #endif <-- enf of ViewMap() function

    My knowledge of C++ isn't that good. I may be thinking of the #if 0 directive incorrectly, even if I don't think so. If someone could look at this and tell me a) am I correct or incorrect, and b) what the directive really does, I would appreciate it.

    OK. I found the answer, and I was correct. Look here and scroll down to the first reply. It says: "In example 2, #if 0 always evaluates to false and code in that block is excluded." This means that these directives need to be removed for the functions to be included in the compile. Has anyone tried to do this?

    Dr.Zin
    Bring em' On!
    Bring em' On!

    Male
    Number of posts : 180
    Age : 32
    Location : Nowhere
    Message : General Programmer
    World of Tanks Username: ToreHund
    Registration date : 2010-08-11

    Re: reenabling no clipping

    Post by Dr.Zin on Mon Sep 19, 2011 8:49 am

    Ja, I use '#if 0' quite a bit when I want to preserve existing code but write new code. If the new code doesn't work the way I want it to work, I haven't deleted working code so I can just remove the preprocessor directives or change the 0 to a 1.



    If a packet hits a pocket on a socket on a port,
    and the bus is interupted as a very last resort,
    and the address of the memory makes your floppy disk abort
    then the socket packet pocket has an error to report!

    http://radix-16.com/
    Wolf3d Chat

    Sponsored content

    Re: reenabling no clipping

    Post by Sponsored content Today at 4:42 am


      Current date/time is Mon Dec 05, 2016 4:42 am