• View unanswered postsView active topics

  • (Solved) (help) DarkOne's Textured floor and ceiling

    Discuss Wolf3D and Wolf3D modding/ports

    Postby Tricob1974 07 Jan 2017, 01:43

    By changing the third plane of your map.
    Tricob1974

     
    Posts: 1377
    Location: Huntsville, Alabama

        

    Postby Officer-Michael John 07 Jan 2017, 16:40

    I changed to the third plane,but can't work. :(
    Officer-Michael John
    User avatar

     
    Posts: 123

        

    Postby Tricob1974 08 Jan 2017, 01:30

    You need to add floor and ceiling tiles, too. And you need to do it to the entire map.
    Tricob1974

     
    Posts: 1377
    Location: Huntsville, Alabama

        

    Postby Officer-Michael John 08 Jan 2017, 16:14

    I gived with Wood texture,but now not work too.
    Officer-Michael John
    User avatar

     
    Posts: 123

        

    Postby Tricob1974 09 Jan 2017, 03:55

    "Not working" doesn't tell me much.
    Tricob1974

     
    Posts: 1377
    Location: Huntsville, Alabama

        

    Postby Officer-Michael John 09 Jan 2017, 16:08

    I selected a texture (floor/ceiling) and I saved with Map Editor. Log and nothing changes. It still remains the problem. I doing something wrong?
    Officer-Michael John
    User avatar

     
    Posts: 123

        

    Postby Tricob1974 10 Jan 2017, 04:32

    You have to put those textures in the map. Go to the 3D Editor and you'll see where you should put them.
    Tricob1974

     
    Posts: 1377
    Location: Huntsville, Alabama

        

    Postby Officer-Michael John 11 Jan 2017, 00:39

    I go to 3D edit and I selected a texture.
    Officer-Michael John
    User avatar

     
    Posts: 123

        

    Postby Tricob1974 11 Jan 2017, 06:01

    You still have to do more. If you're not seeing the texture on the floor or ceiling, then you didn't put it there. You have to put these things in every square of the map that you see.
    Tricob1974

     
    Posts: 1377
    Location: Huntsville, Alabama

        

    Postby Officer-Michael John 11 Jan 2017, 20:23

    I maked a file for DarkOne's Textured floor/ceiling as Multiple floor/ceiling. I not find bug,but I can't get texture only normal floor and ceiling as in Wolf 3D.

    My combination code:

    VERSION.H:

    Code: Select all
    #define USE_DRAWFLATSTEX      // Enables floor and ceiling textures (see wl_drawflatstex.cpp)


    WL_DEF.H:

    Code: Select all
    #ifdef USE_DRAWFLATSTEX
        void DrawFlats(unsigned tex_f, unsigned tex_c);
    #endif


    WL_DRAW.CPP:

    Code: Select all
    #ifdef USE_DRAWFLATSTEX
    #define USE_TEX(page) (0x0000|(page))
    /*
    ** use USE_TEX(n) to use floor/ceiling textures for given level
    ** n should be 1..255 !!!
    ** it is MAP-ID (from FloEdit). First texture goes to floor, second to ceiling
    */

    byte texCeiling[]=
    {
    #ifndef SPEAR
    USE_TEX(1),USE_TEX(2),USE_TEX(3),USE_TEX(4),USE_TEX(5),USE_TEX(6),USE_TEX(7),USE_TEX(8),USE_TEX(9),USE_TEX(10),
    USE_TEX(11),USE_TEX(12),USE_TEX(13),USE_TEX(14),USE_TEX(15),USE_TEX(16),USE_TEX(17),USE_TEX(18),USE_TEX(19),USE_TEX(20),
    USE_TEX(21),USE_TEX(22),USE_TEX(23),USE_TEX(24),USE_TEX(25),USE_TEX(26),USE_TEX(27),USE_TEX(28),USE_TEX(29),USE_TEX(30),

    USE_TEX(31),USE_TEX(32),USE_TEX(33),USE_TEX(34),USE_TEX(35),USE_TEX(36),USE_TEX(37),USE_TEX(38),USE_TEX(39),USE_TEX(40),
    USE_TEX(41),USE_TEX(42),USE_TEX(43),USE_TEX(44),USE_TEX(45),USE_TEX(46),USE_TEX(47),USE_TEX(48),USE_TEX(49),USE_TEX(50),
    USE_TEX(51),USE_TEX(52),USE_TEX(53),USE_TEX(54),USE_TEX(55),USE_TEX(56),USE_TEX(57),USE_TEX(58),USE_TEX(59),USE_TEX(60),
    #else
    USE_TEX(1),USE_TEX(2),USE_TEX(3),USE_TEX(4),USE_TEX(5),USE_TEX(6),USE_TEX(7),USE_TEX(8),USE_TEX(9),USE_TEX(10),
    USE_TEX(11),USE_TEX(12),USE_TEX(13),USE_TEX(14),USE_TEX(15),USE_TEX(16),USE_TEX(17),USE_TEX(18),USE_TEX(19),USE_TEX(20),USE_TEX(21),
    #endif
    };

    /*
    =====================
    =
    = TEXClearScreen
    =
    =====================
    */

    void TEXClearScreen (byte texture)
    {       
        int y;
        byte *ptr = vbuf;
    }   
    #endif   

    #ifdef USE_DRAWFLATSTEX       
        byte texture;
        boolean flats;   
    #endif

    #ifdef USE_DRAWFLATSTEX
        texture=texCeiling[gamestate.episode*10+mapon];
        if((texture>>8)==(texture&0xFF))
        {
              TEXClearScreen(texture);
              flats=false;
        }
        else
        {
              flats=true;
              texture=((texture&0xFF)-1)<<1;
        }
    #endif 

    #ifdef USE_DRAWFLATSTEX
      if(flats)
        DrawFlats(texture, texture+1); // draw textured floor/ceiling
    #endif


    WL_DRAWFLATS.CPP:

    Code: Select all
    #include "version.h"

    #ifdef USE_DRAWFLATSTEX

    #include "wl_def.h"

    // Textured Floor and Ceiling by DarkOne
    void DrawFlats(unsigned tex_f, unsigned tex_c)
    {   
        unsigned   vbufPitch;
        int   min_wallheight;
        byte  color;
        byte  *toptex, *bottex;
        fixed dist;                                // distance to row projection
        fixed tex_step;                            // global step per one screen pixel
        fixed gu, gv, du, dv;                      // global texture coordinates
        int u, v;                                  // local texture coordinates

        int halfheight = viewheight >> 1;
        int y0 = min_wallheight >> 3;              // starting y value
        if(y0 > halfheight)
            return;                                // view obscured by walls
        if(!y0) y0 = 1;                            // don't let division by zero
        unsigned bot_offset0 = vbufPitch * (halfheight + y0);
        unsigned top_offset0 = vbufPitch * (halfheight - y0 - 1);
       
        bottex = PM_GetPage(tex_f); // load floor texture
        toptex = PM_GetPage(tex_c); // load ceiling texture

        // draw horizontal lines
        for(int y = y0, bot_offset = bot_offset0, top_offset = top_offset0;
            y < halfheight; y++, bot_offset += vbufPitch, top_offset -= vbufPitch)
        {
            dist = (heightnumerator / (y + 1)) << 5;
            gu =  viewx + FixedMul(dist, viewcos);
            gv = -viewy + FixedMul(dist, viewsin);
            tex_step = (dist << 8) / viewwidth / 175;
            du =  FixedMul(tex_step, viewsin);
            dv = -FixedMul(tex_step, viewcos);
            gu -= (viewwidth >> 1) * du;
            gv -= (viewwidth >> 1) * dv; // starting point (leftmost)
           
            for(int x = 0, bot_add = bot_offset, top_add = top_offset;
                x < viewwidth; x++, bot_add++, top_add++)
            {
                if(wallheight[x] >> 3 <= y)
                {                   
                        u = (gu >> (TILESHIFT - TEXTURESHIFT)) & (TEXTURESIZE - 1);
                        color = *(toptex+((63-u)<<6)+(63-v));
                        v = (gv >> (TILESHIFT - TEXTURESHIFT)) & (TEXTURESIZE - 1);
                        color = *(bottex+((63-u)<<6)+(63-v));
                }
                gu += du;
                gv += dv;
            }
        } 
    }
    #endif


    WL_DRAWFLATS.CPP Link:http://www.mediafire.com/file/0mw8ky1j2st212d/wl_drawflats.cpp

    Note:This is code tutorial need to correct.
    Officer-Michael John
    User avatar

     
    Posts: 123

        

    PreviousNext

    Return to General Wolf3D/modding Discussion and tutorials


    Who is online

    Users browsing this forum: No registered users and 1 guest