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


    [SDL tutorial] Transparent ceilings...

    Share

    WLHack
    Senior Member
    Senior Member

    Male
    Number of posts : 798
    Age : 28
    Location : Finland
    Registration date : 2007-03-26

    [SDL tutorial] Transparent ceilings...

    Post by WLHack on Mon Nov 30, 2009 2:49 am

    Some of you have already seen this in DHW before but I decided to post it here aswell...
    In this tutorial I help you to create transparent ceilings (like in the Lair of Mantis - of coursre
    my routine might differ a lot from the one theJosh used)...

    Open wl_floorceiling.cpp and change the very end of the file from this:
    Code:

                  if (curbottex != lastbottex)

                        {

                            lastbottex = curbottex;

                            bottex = PM_GetTexture(curbottex);

                        }

                        u = (gu >> (TILESHIFT - TEXTURESHIFT)) & (TEXTURESIZE - 1);

                        v = (gv >> (TILESHIFT - TEXTURESHIFT)) & (TEXTURESIZE - 1);

                        unsigned texoffs = (u << TEXTURESHIFT) + (TEXTURESIZE - 1) - v;

    #ifdef USE_SHADING

                        if(curtoptex)

                            vbuf[top_add] = curshades[toptex[texoffs]];

                        if(curbottex)

                            vbuf[bot_add] = curshades[bottex[texoffs]];

    #else

                        if(curtoptex)

                            vbuf[top_add] = toptex[texoffs];

                        if(curbottex)

                            vbuf[bot_add] = bottex[texoffs];

    #endif

                    }

                }

                gu += du;

                gv += dv;

            }

        }

    }

    and replace it with this:

    Code:


                        if (curbottex != lastbottex)

                        {

                            lastbottex = curbottex;

                            bottex = PM_GetTexture(curbottex);

                        }

                        u = (gu >> (TILESHIFT - TEXTURESHIFT)) & (TEXTURESIZE - 1);

                        v = (gv >> (TILESHIFT - TEXTURESHIFT)) & (TEXTURESIZE - 1);

                        unsigned texoffs = (u << TEXTURESHIFT) + (TEXTURESIZE - 1) - v;
                    // Get tranparent:
                        byte color1=*(toptex+texoffs);
                        byte color2=*(bottex+texoffs);
                   

    #ifdef USE_SHADING

                        if(curtoptex){
                            if (color1 != 0xff)
                                vbuf[top_add] = curshades[toptex[texoffs]];

                        }

                        if(curbottex){
                          if (color2 != 0xff)
                              vbuf[bot_add] = curshades[bottex[texoffs]];

                        }
    #else
                        if(curtoptex)
                          if (color1 != 0xff)
                              vbuf[top_add] = toptex[texoffs];

                        if(curbottex)
                          if (color2 != 0xff)
                              vbuf[bot_add] = bottex[texoffs];

    #endif

                    }

                }

                gu += du;

                gv += dv;

            }

        }

    }

    #endif



    Last edited by WLHack on Tue Feb 26, 2013 1:31 am; edited 1 time in total



    Hammer: I can see it now: you and the moon - wear a necktie so I'll know you.
    Building a new webpage...

    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

    Re: [SDL tutorial] Transparent ceilings...

    Post by Dark_wizzie on Mon Nov 30, 2009 3:35 pm

    Hey, how about a screenshot of the new effects? Very Happy



    Wolf3d Haven
    Minute Logic Blog

    WLHack
    Senior Member
    Senior Member

    Male
    Number of posts : 798
    Age : 28
    Location : Finland
    Registration date : 2007-03-26

    Re: [SDL tutorial] Transparent ceilings...

    Post by WLHack on Tue Dec 01, 2009 2:29 am

    I try to post one later this evening...



    Hammer: I can see it now: you and the moon - wear a necktie so I'll know you.
    Building a new webpage...

    thejosh
    Black Cat
    Black Cat

    Number of posts : 13
    Age : 31
    Registration date : 2009-11-20

    Re: [SDL tutorial] Transparent ceilings...

    Post by thejosh on Sat Dec 05, 2009 6:32 pm

    @WLHack wrote: transparent ceilings (like in the Lair of Mantis - of coursre
    my routine might differ a lot from the one theJosh used)...

    I used code by Alumiun for transparent ceilings in my mod, He posted a tutorial on it a while ago at dhw somewhere, if you can find it, that's what my routine looks like Very Happy

    WLHack
    Senior Member
    Senior Member

    Male
    Number of posts : 798
    Age : 28
    Location : Finland
    Registration date : 2007-03-26

    Re: [SDL tutorial] Transparent ceilings...

    Post by WLHack on Sun Dec 06, 2009 5:54 am

    Ah, that one... I tried it out but it didn't seem to do anything (or I just implemented it wrong)...



    Hammer: I can see it now: you and the moon - wear a necktie so I'll know you.
    Building a new webpage...

    Sponsored content

    Re: [SDL tutorial] Transparent ceilings...

    Post by Sponsored content Today at 6:04 am


      Current date/time is Tue Dec 06, 2016 6:04 am