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       

[tutorial] Transparent ceilings...
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
WLHack
DieHard Wolfer
DieHard Wolfer


Joined: 10 Jul 2005
Last Visit: 18 Jan 2018

Topics: 66
Posts: 1241
Location: Loppi - Finland
finland.gif

PostPosted: Fri Nov 27, 2009 4:19 am
   Subject: [tutorial] Transparent ceilings...
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

This tells you how to make transparent ceiling like in this picture (Well, the picture could have been better but
this just demonstrate that there is no restriction in shapes):


This code is based on Gregs original tutorial and AlumiuNs code
Now if you wonder why I am posting another tutorial, well AlumiuNs code
didn't seem to work at all in my source (read: I propably placed the code
to a totally wrong place) so this might help those with similar problems...

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;
        }
    }
}


To this (add the code in red):
::: 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+(u<<6)+((TEXTURESIZE-1)-v)); // *(src_top+((63-u)<<6)+(63-v))
                    byte color2=*(bottex+(u<<6)+((TEXTURESIZE-1)-v)); // *(bottex+(u<<6)+(63-v))
               

#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



Took a while to get the transparent color work...
First attempt to convert Gregs tutorial ended like this:


Yes, the purple color in the picture is actually the same as the transparent color...


Of course there is better ways to do this...

_________________
False Spear download
False Spear SDL download
Wolfenstein-blog
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: Fri Nov 27, 2009 8:46 pm
   Subject: Re: [tutorial] Transparent ceilings...
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Very well done indeed!

Don't you just love playing with the code and having it do things on the screen that you go.. hmm.. now that's interesting.. can I use this as a feature?? Your top picture almost looks like you were starting to draw the map on the ceiling... but then I realized that you were playing with different textures and shapes... Keep up the good work.

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 [help] Adding teleporters in wolf4sdl
Author: Mortimer
35 10853 Fri May 26, 2017 8:19 am
Military View latest post
No new posts [WOLF4SDL Help] Blake Stone Style doors
Author: Haasboy
3 2998 Sun Jul 20, 2008 7:56 am
Haasboy View latest post
No new posts [Wolf4SDL Help] Inserting a second palette (like in SoD)
Author: Andy_Nonymous
10 3286 Mon Jun 02, 2008 3:59 pm
Adam Biser View latest post
No new posts [Help] Problem with Checkweaponchange function (wolf4sdl)
Author: Mortimer
4 3204 Sat May 17, 2008 11:26 am
Mortimer View latest post
No new posts [help] Wolf4sdl's implemented tutorials
Author: Mortimer
6 3264 Tue May 06, 2008 1:15 pm
Ripper 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