Wolf3d Haven Forum

Please log in or register. Smile

Join the forum, it's quick and easy

Wolf3d Haven Forum

Please log in or register. Smile

Wolf3d Haven Forum

Would you like to react to this message? Create an account in a few clicks or log in to continue.
Wolf3d Haven Forum

A friendly Wolfenstein 3D community, about Wolfenstein 3D, the game that gave birth to first person shooters...


    [SDL Code] Adding multiple floor colors...

    avatar
    WLHack
    Senior Member
    Senior Member


    Male
    Number of posts : 800
    Age : 35
    Location : Finland
    Registration date : 2007-03-26

    [SDL Code] Adding multiple floor colors... Empty [SDL Code] Adding multiple floor colors...

    Post by WLHack Wed Feb 17, 2010 4:55 am

    Okay, this is rather simple coding change that allow you to have multiple
    solid floor colors:

    In wl_draw.c search for this line
    Code:
    byte vgaCeiling[]=

    Add this block under the "vgaCeiling"-table definition:
    Code:

    //
    // Solid floor colour
    byte vgaFloor[]=
    {
    #ifndef SPEAR
     0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, //episode 1
     0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, //episode 2
     0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, //episode 3

     0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, //episode 4
     0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, //episode 5
     0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19  //episode 6
    #else
     0xd7,0x09,0x03,0xde,0xdf,0x2e,0x7f,0x9e,0xae,0x7f,
     0x1d,0xde,0xdf,0xde,0xdf,0xde,0xe1,0xdc,0x2e,0x1d,0xdc
    #endif
    };

    And then replace the VGAClearScreen-block with this:
    Code:
    /*
    =====================
    =
    = VGAClearScreen
    =
    =====================
    */

    void VGAClearScreen (void)
    {
        byte ceiling=vgaCeiling[gamestate.episode*10+mapon];
        byte floor=vgaFloor[gamestate.episode*10+mapon];
       
        int y;
        byte *ptr = vbuf;
    #ifdef USE_SHADING
        for(y = 0; y < viewheight / 2; y++, ptr += vbufPitch)
            memset(ptr, shadetable[GetShade((viewheight / 2 - y) << 3,0,0,0,0)][ceiling], viewwidth);
        for(; y < viewheight; y++, ptr += vbufPitch)
            memset(ptr, shadetable[GetShade((y - viewheight / 2) << 3,0,0,0,0)][floor], viewwidth); //0x19
    #else
        for(y = 0; y < viewheight / 2; y++, ptr += vbufPitch)
            memset(ptr, ceiling, viewwidth);
        for(; y < viewheight; y++, ptr += vbufPitch)
            memset(ptr, floor, viewwidth); //0x19
    #endif
    }



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

      Current date/time is Thu Nov 21, 2024 5:59 am