(Tutorial) More secret levels in episodes with Chris Chokan and Wolf3DGuy

Go down

(Tutorial) More secret levels in episodes with Chris Chokan and Wolf3DGuy

Post by Officer-M. John (Admin) on Sun Jun 19, 2016 11:25 am

We have my new routine:More secret levels in episodes. After much time it would normally forming with Chris Chokan and Wolf3DGuy help.

A This tutorial was used. But with minor changes:

http://www.areyep.com/Codingtips/morelvls.html

ID_CA.H:

Code:

#define NUMMAPS         66

WL_INTER.CPP:

Code:

        //
        // Episode One Par Times
        //
        {1.5, "01:30"},
        {2, "02:00"},
        {2, "02:00"},
        {3.5, "03:30"},
        {3, "03:00"},
        {3, "03:00"},
        {2.5, "02:30"},
        {2.5, "02:30"},
        {0, "??:??"},           // Boss level
        {0, "??:??"},           // Secret level
        {0, "??:??"},           // Secret level 2

        //
        // Episode Two Par Times
        //
        {1.5, "01:30"},
        {3.5, "03:30"},
        {3, "03:00"},
        {2, "02:00"},
        {4, "04:00"},
        {6, "06:00"},
        {1, "01:00"},
        {3, "03:00"},
        {0, "??:??"},
        {0, "??:??"},
        {0, "??:??"},          
        
        //
        // Episode Three Par Times
        //
        {1.5, "01:30"},
        {1.5, "01:30"},
        {2.5, "02:30"},
        {2.5, "02:30"},
        {3.5, "03:30"},
        {2.5, "02:30"},
        {2, "02:00"},
        {6, "06:00"},
        {0, "??:??"},
        {0, "??:??"},        

        //
        // Episode Four Par Times
        //
        {2, "02:00"},
        {2, "02:00"},
        {1.5, "01:30"},
        {1, "01:00"},
        {4.5, "04:30"},
        {3.5, "03:30"},
        {2, "02:00"},
        {4.5, "04:30"},
        {0, "??:??"},
        {0, "??:??"},
        {0, "??:??"},          
        
        //
        // Episode Five Par Times
        //
        {2.5, "02:30"},
        {1.5, "01:30"},
        {2.5, "02:30"},
        {2.5, "02:30"},
        {4, "04:00"},
        {3, "03:00"},
        {4.5, "04:30"},
        {3.5, "03:30"},
        {0, "??:??"},
        {0, "??:??"},    
        {0, "??:??"},          

        //
        // Episode Six Par Times
        //
        {6.5, "06:30"},
        {4, "04:00"},
        {4.5, "04:30"},
        {6, "06:00"},
        {5, "05:00"},
        {5.5, "05:30"},
        {5.5, "05:30"},
        {8.5, "08:30"},
        {0, "??:??"},
        {0, "??:??"},
        {0, "??:??"}

#ifdef SPANISH
        Write (30, 12, parTimes[gamestate.episode * 11 + mapon].timestr);
#else
        Write (26, 12, parTimes[gamestate.episode * 11 + mapon].timestr);
#endif

        if (gamestate.TimeCount < parTimes[gamestate.episode * 11 + mapon].time * 4200)
            timeleft = (int32_t) ((parTimes[gamestate.episode * 11 + mapon].time * 4200) / 70 - sec);

WL_PLAY.CPP:

Code:

    //
    // Episode One
    //
    GETTHEM_MUS,
    SEARCHN_MUS,
    POW_MUS,
    SUSPENSE_MUS,
    GETTHEM_MUS,
    SEARCHN_MUS,
    POW_MUS,
    SUSPENSE_MUS,

    ULTIMATE_MUS,               // Boss level
    CORNER_MUS,                 // Secret level
    CORNER_MUS,                 // Secret level 2

    //
    // Episode Two
    //
    NAZI_OMI_MUS,
    PREGNANT_MUS,
    GOINGAFT_MUS,
    HEADACHE_MUS,
    NAZI_OMI_MUS,
    PREGNANT_MUS,
    HEADACHE_MUS,
    GOINGAFT_MUS,

    WARMARCH_MUS,               // Boss level
    DUNGEON_MUS,                // Secret level
    DUNGEON_MUS,                // Secret level 2

    //
    // Episode Three
    //
    INTROCW3_MUS,
    NAZI_RAP_MUS,
    TWELFTH_MUS,
    ZEROHOUR_MUS,
    INTROCW3_MUS,
    NAZI_RAP_MUS,
    TWELFTH_MUS,
    ZEROHOUR_MUS,

    ULTIMATE_MUS,               // Boss level
    PACMAN_MUS,                 // Secret level
    PACMAN_MUS,                 // Secret level 2    

    //
    // Episode Four
    //
    GETTHEM_MUS,
    SEARCHN_MUS,
    POW_MUS,
    SUSPENSE_MUS,
    GETTHEM_MUS,
    SEARCHN_MUS,
    POW_MUS,
    SUSPENSE_MUS,

    WARMARCH_MUS,               // Boss level
    CORNER_MUS,                 // Secret level
    CORNER_MUS,                 // Secret level 2

    //
    // Episode Five
    //
    NAZI_OMI_MUS,
    PREGNANT_MUS,
    GOINGAFT_MUS,
    HEADACHE_MUS,
    NAZI_OMI_MUS,
    PREGNANT_MUS,
    HEADACHE_MUS,
    GOINGAFT_MUS,

    WARMARCH_MUS,               // Boss level
    DUNGEON_MUS,                // Secret level
    DUNGEON_MUS,                // Secret level 2

    //
    // Episode Six
    //
    INTROCW3_MUS,
    NAZI_RAP_MUS,
    TWELFTH_MUS,
    ZEROHOUR_MUS,
    INTROCW3_MUS,
    NAZI_RAP_MUS,
    NAZIS_MUS,
    ZEROHOUR_MUS,

    ULTIMATE_MUS,               // Boss level
    FUNKYOU_MUS,                // Secret level
    FUNKYOU_MUS                 // Secret level 2  

void StartMusic ()
{
    SD_MusicOff ();
    lastmusicchunk = (musicnames) songs[gamestate.mapon + gamestate.episode * 11];
    SD_StartMusic(STARTMUSIC + lastmusicchunk);
}

void ContinueMusic (int offs)
{
    SD_MusicOff ();
    lastmusicchunk = (musicnames) songs[gamestate.mapon + gamestate.episode * 11];
    SD_ContinueMusic(STARTMUSIC + lastmusicchunk, offs);
}

WL_DRAW.CPP:

Code:

byte vgaCeiling[]=
{
#ifndef SPEAR
 0x17,0x1d,0x45,0x20,0x09,0x0,0x04,0x0,0x17,0xbf,0x0,
 0x4e,0x4e,0x4e,0x1d,0x8d,0x4e,0x1d,0x2d,0x1d,0x8d,0x8d,
 0x1d,0x1d,0x1d,0x1d,0x1d,0x2d,0xdd,0x1d,0x1d,0x98,0x98,

 0x1d,0x9d,0x2d,0xdd,0xdd,0x9d,0x2d,0x4d,0x1d,0xdd,0xdd,
 0x7d,0x1d,0x2d,0x2d,0xdd,0xd7,0x1d,0x1d,0x1d,0x2d,0x2d,
 0x1d,0x1d,0x1d,0x1d,0xdd,0xdd,0x7d,0xdd,0xdd,0xdd,0xdd
#else
 0x6f,0x4f,0x1d,0xde,0xdf,0x2e,0x7f,0x9e,0xae,0x7f,
 0x1d,0xde,0xdf,0xde,0xdf,0xde,0xe1,0xdc,0x2e,0x1d,0xdc
#endif
};

void VGAClearScreen (void)
{
    byte ceiling=vgaCeiling[gamestate.episode*11+mapon];

WL_DEBUG.CPP:

Code:

    else if (Keyboard[sc_W])        // W = warp to level
    {
        CenterWindow(26,3);
        PrintY+=6;
#ifndef SPEAR
        US_Print("  Warp to which level(1-11): ");
#else
        US_Print("  Warp to which level(1-21): ");
#endif
        VW_UpdateScreen();
        esc = !US_LineInput (px,py,str,NULL,true,2,0);
        if (!esc)
        {
            level = atoi (str);
#ifndef SPEAR
            if (level>0 && level<12)
#else
            if (level>0 && level<22)
#endif
            {
                gamestate.mapon = level-1;
                playstate = ex_warped;
            }
        }
        return 1;
    }

WL_GAME.CPP:

Code:

//
// ELEVATOR BACK MAPS - REMEMBER (-1)!!
//
//int ElevatorBackTo[]={1,1,7,3,5,3};

US_Print(" Demo number (0-10): ");

#ifdef UPLOAD
    US_Print("  Demo which level(1-11): "); maps = 11;
#else
    US_Print("  Demo which level(1-66): "); maps = 66;
#endif

#ifndef SPEAR
    NewGame (gd_hard,level/11);
    gamestate.mapon = level%11;
#else
    NewGame (gd_hard,0);
    gamestate.mapon = level;
#endif

/*
    Commented out for Wolf 3D
         //
         // COMING BACK FROM SECRET LEVEL
         //
         if (gamestate.mapon == 9)
            gamestate.mapon = ElevatorBackTo[gamestate.episode];   // back from secret
         else
         //
         // GOING TO SECRET LEVEL
         //
         if (playstate == ex_secretlevel)
            gamestate.mapon = 9;
*/

// Real Secret Elevator Levels for Wolf 3D

#define FROMSEC1             0
#define FROMSEC2             9
#define FROMSEC3             11
#define FROMSEC4             20
#define FROMSEC5             28
#define FROMSEC6             31
#define FROMSEC7             35
#define FROMSEC8             40
#define FROMSEC9             48
#define FROMSEC10            50
#define FROMSEC11            57
#define FROMSEC12            60

         //
         // GOING TO SECRET LEVEL
         //
         if (playstate == ex_secretlevel)
            switch(gamestate.mapon)
            {
                                 case FROMSEC1: gamestate.mapon = 9; break;
                                 case FROMSEC2: gamestate.mapon = 10; break;
                                 case FROMSEC3: gamestate.mapon = 20; break;
                                 case FROMSEC4: gamestate.mapon = 21; break;
                                 case FROMSEC5: gamestate.mapon = 31; break;
                                 case FROMSEC6: gamestate.mapon = 32; break;
                                 case FROMSEC7: gamestate.mapon = 42; break;
                                 case FROMSEC8: gamestate.mapon = 43; break;
                                 case FROMSEC9: gamestate.mapon = 53; break;
                                 case FROMSEC10: gamestate.mapon = 54; break;
                                 case FROMSEC11: gamestate.mapon = 64; break;
                                 case FROMSEC12: gamestate.mapon = 65; break;
            }
         else
         //
         // COMING BACK FROM SECRET LEVEL
         //
                        if (gamestate.mapon == 9 || gamestate.mapon == 10 || gamestate.mapon == 20 || gamestate.mapon == 21 || gamestate.mapon == 31 || gamestate.mapon == 32 || gamestate.mapon == 42
                         || gamestate.mapon == 43 || gamestate.mapon == 53 || gamestate.mapon == 54 || gamestate.mapon == 64 || gamestate.mapon == 65)
            switch(gamestate.mapon)
            {
                                 case 9: gamestate.mapon = FROMSEC1+1; break;
                                 case 10: gamestate.mapon = FROMSEC2+1; break;
                                 case 20: gamestate.mapon = FROMSEC3+1; break;
                                 case 21: gamestate.mapon = FROMSEC4+1; break;
                                 case 31: gamestate.mapon = FROMSEC5+1; break;
                                 case 32: gamestate.mapon = FROMSEC6+1; break;
                                 case 42: gamestate.mapon = FROMSEC7+1; break;
                                 case 43: gamestate.mapon = FROMSEC8+1; break;
                                 case 53: gamestate.mapon = FROMSEC9+1; break;
                                 case 54: gamestate.mapon = FROMSEC10+1; break;
                                 case 64: gamestate.mapon = FROMSEC11+1; break;
                                 case 65: gamestate.mapon = FROMSEC12+1; break;
            }
            
#else

#define FROMSECRET1 3
#define FROMSECRET2 11

 //
 // GOING TO SECRET LEVEL
 //
 if (playstate == ex_secretlevel)
 switch(gamestate.mapon)
 {
 case FROMSECRET1: gamestate.mapon = 18; break;
 case FROMSECRET2: gamestate.mapon = 19; break;
 }
 else
 //
 // COMING BACK FROM SECRET LEVEL
 //
 if (gamestate.mapon == 18 || gamestate.mapon == 19)
 switch(gamestate.mapon)
 {
 case 18: gamestate.mapon = FROMSECRET1+1; break;
 case 19: gamestate.mapon = FROMSECRET2+1; break;
 }
#endif            
                    else
                        //
                        // GOING TO NEXT LEVEL
                        //
                        gamestate.mapon++;
                break;

WL_AGENT.CPP:

Code:

/*
===============
=
= DrawLevel
=
===============
*/

void DrawLevel (void)
{
    if(viewsize == 66 && ingame) return;
//#ifdef SPEAR
    if (gamestate.mapon == 65)
        LatchNumber (2,16,2,18);
    else
//#endif
        LatchNumber (2,16,2,gamestate.mapon+1);
}

WL_MAIN.CPP:

Code:

#ifndef SPEAR
        gamestate.episode = (param_tedlevel-1)/11;
        gamestate.mapon = (param_tedlevel-1)%11;
#else
        gamestate.episode = 0;
        gamestate.mapon = param_tedlevel;
#endif


Last edited by Officer-M. John (Admin) on Sun Aug 06, 2017 1:33 pm; edited 1 time in total
avatar
Officer-M. John (Admin)
Admin

Posts : 379
Join date : 2015-10-02
Age : 20

View user profile http://wolf3dfanboys.forumotion.com

Back to top Go down

Re: (Tutorial) More secret levels in episodes with Chris Chokan and Wolf3DGuy

Post by Officer-M. John (Admin) on Mon Dec 26, 2016 7:03 am

Updated 26/12/2016 7:03 am

I found a bug,that you can't go to 1st secret level. I fixed bug.

Note:Some code with originally version working.

New code:

Please you don't deleting int ElevatorBackTo[]= because with this working. (WL_GAME.CPP)
The code is not required DrawLevel I wrote. (WL_AGENT.CPP)

WL_GAME.CPP:

Insert in below int ElevatorBackTo

Code:

int ElevatorBackTo2[]={10,10,10,10,10,10};   

Insert in below COMING BACK FROM SECRET LEVEL part

Code:

                //
                // COMING BACK FROM SECRET LEVEL 2
                //
                if (gamestate.mapon == 10)
                    gamestate.mapon = ElevatorBackTo2[gamestate.episode];    // back from secret 2
                else
                    //
                    // GOING TO SECRET LEVEL 2
                    //
                    if (playstate == ex_secretlevel)
                        gamestate.mapon == 10;


Last edited by Officer-M. John (Admin) on Sun Aug 06, 2017 1:34 pm; edited 2 times in total
avatar
Officer-M. John (Admin)
Admin

Posts : 379
Join date : 2015-10-02
Age : 20

View user profile http://wolf3dfanboys.forumotion.com

Back to top Go down

Re: (Tutorial) More secret levels in episodes with Chris Chokan and Wolf3DGuy

Post by Officer-M. John (Admin) on Mon Dec 26, 2016 12:02 pm

Updated 26/12/2016 12:01 pm

Now have a fully working code.

WL_DEF:

You need to add:

Code:

#define ELEVATORTILE    21
#define ELEVATORTILE2   52 <--new elevator tile on 2nd secret level

    ex_secretlevel,
    ex_secretlevel2 <--secret level 2

WL_AGENT.CPP:

You search ELEVATORTILE and Insert in below this:

Code:

    if (!buttonheld[bt_use] && doornum == ELEVATORTILE2 && elevatorok)
    {
        //
        // use elevator
        //
        buttonheld[bt_use] = true;

        tilemap[checkx][checky]++;              // flip switch
        if (*(mapsegs[0]+(player->tiley<<mapshift)+player->tilex) == ALTELEVATORTILE)
            playstate = ex_secretlevel2;
        else
            playstate = ex_completed;    
        SD_PlaySound (LEVELDONESND);
        SD_WaitSoundDone();
    }

WL_GAME.CPP:

Code:

               //
                // COMING BACK FROM SECRET AND GOING TO SECRET LEVEL
                //            
                if (playstate == ex_secretlevel)
                {
                    if (gamestate.mapon == 9)
                    gamestate.mapon = ElevatorBackTo[gamestate.episode];    
                    gamestate.mapon = 9;
                }
                else if (playstate == ex_secretlevel2)
                {
                    if (gamestate.mapon == 10)
                    gamestate.mapon = ElevatorBackTo2[gamestate.episode];
                    gamestate.mapon = 10;
                }  


Last edited by Officer-M. John (Admin) on Sun Aug 06, 2017 1:37 pm; edited 2 times in total
avatar
Officer-M. John (Admin)
Admin

Posts : 379
Join date : 2015-10-02
Age : 20

View user profile http://wolf3dfanboys.forumotion.com

Back to top Go down

Re: (Tutorial) More secret levels in episodes with Chris Chokan and Wolf3DGuy

Post by Officer-M. John (Admin) on Sat Dec 31, 2016 11:49 am

Updated 31/12/2016 11:48 am

I found a bug,that you can't go back from secret level 1 to normal level.

You go to in WL_GAME.CPP and you add:

Code:

                //
                // COMING BACK FROM SECRET LEVEL
                //
                if (gamestate.mapon == 9)
                    gamestate.mapon = ElevatorBackTo[gamestate.episode];    // back from secret
                else
                    //
                    // GOING TO SECRET LEVEL
                    //
                    if (playstate == ex_secretlevel)
                        gamestate.mapon = 9;
                        
                //
                // COMING BACK FROM SECRET LEVEL 2
                //
                else if (gamestate.mapon == 10)
                    gamestate.mapon = ElevatorBackTo2[gamestate.episode];    // back from secret 2
                else
                    //
                    // GOING TO SECRET LEVEL 2
                    //
                    if (playstate == ex_secretlevel2)
                        gamestate.mapon = 10;  

This code work 100%. I tested in my New Year's Eve mod. Cool
avatar
Officer-M. John (Admin)
Admin

Posts : 379
Join date : 2015-10-02
Age : 20

View user profile http://wolf3dfanboys.forumotion.com

Back to top Go down

Re: (Tutorial) More secret levels in episodes with Chris Chokan and Wolf3DGuy

Post by Officer-M. John (Admin) on Mon Nov 20, 2017 11:05 am

If you want to use normal secret level version as in Wolf 3D? It's code uses normal version with some change:

WL_GAME.CPP:

Code:

int FROMSECRET1, FROMSECRET2;

int ElevatorStart[6][7]= {
{ 0, 10},               // Episode 1
{ 0, 10},               // Episode 2
{ 6, 10},               // Episode 3
{ 2, 10},               // Episode 4
{ 4, 10},               // Episode 5
{ 2, 10}                // Episode 6
};

FROMSECRET1 = ElevatorStart[gamestate.episode][0];
FROMSECRET2 = ElevatorStart[gamestate.episode][1];

//
// GOING TO SECRET LEVEL
//
if (playstate == ex_secretlevel)
{
 
 if (gamestate.mapon == FROMSECRET1)
 gamestate.mapon = 9;
 else if (gamestate.mapon == FROMSECRET2)
 gamestate.mapon = 10;
 
}
else if (gamestate.mapon == 9 || gamestate.mapon == 10)
{

 switch(gamestate.mapon)
 {
 case 9: gamestate.mapon = FROMSECRET1+1; break;
 case 10: gamestate.mapon = FROMSECRET2+1; break;
 }
}
                    else
                        //
                        // GOING TO NEXT LEVEL
                        //
                        gamestate.mapon++;
                break;

Thanks to Chris Chokan again the help.
avatar
Officer-M. John (Admin)
Admin

Posts : 379
Join date : 2015-10-02
Age : 20

View user profile http://wolf3dfanboys.forumotion.com

Back to top Go down

Re: (Tutorial) More secret levels in episodes with Chris Chokan and Wolf3DGuy

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum