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] Episodes must be completed in order
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
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 01 Apr 2018

Topics: 22
Posts: 1283
Location: Rauma - Finland
finland.gif

PostPosted: Wed Dec 08, 2010 9:27 am
   Subject: [TUTORIAL] Episodes must be completed in order
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

Here's all the required changes to lock all episodes except the first one and unlocking them as you complete them, this code is from Wolfenstein Reloaded.



Replace/add everything in the red lines, other colors represent old code (To help you locate the correct line).

Add the red line wl_def.h:
::: CODE :::
extern  char     configname[13];
extern  int      unlocked;


Add the red line in wl_main.cpp:
::: CODE :::
int     mouseadjustment;
int     unlocked=1;


Add the red line in wl_main.cpp (ReadConfig)
::: CODE :::
        read(file,&unlocked,sizeof(unlocked));
        read(file,Scores,sizeof(HighScore) * MaxScores);


Add the red line wl_main.cpp (WriteConfig)
::: CODE :::
        write(file,&unlocked,sizeof(unlocked));
        write(file,Scores,sizeof(HighScore) * MaxScores);


Add or replace code marked with red in wl_menu.cpp (CP_NewGame):
::: CODE :::
    DrawNewEpisode ();
    do
    {
        which = HandleMenu (&NewEitems, &NewEmenu[0], NULL);
        switch (which)
        {
            case -1:
                MenuFadeOut ();
                return 0;

            default:
                if (which/2 > unlocked-1)
                {
                    SD_PlaySound (NOWAYSND);
                    Message("You need to unlock\nthis episode by completing\nthe previous episode!");
                    IN_ClearKeysDown();
                    IN_Ack();
                    DrawNewEpisode();
                    which = 0;
                }

                else
                {
                    episode = which / 2;
                    which = 1;
                }
                break;
        }

    }
    while (!which);


Add the red line in wl_menu.cpp (DrawNewEpisode):
::: CODE :::
    SETFONTCOLOR (TEXTCOLOR, BKGDCOLOR);
    DrawMenu (&NewEitems, &NewEmenu[0]);

    for (i = 0; i < 6; i++)
       if (i < unlocked)
          VWB_DrawPic (NE_X + 32, NE_Y + i * 26, C_EPISODE1PIC + i);

    VW_UpdateScreen ();


Add the red lines to wl_inter.cpp (Victory):
::: CODE :::
   Write(18,2,STR_YOUWIN);

   // Unlock new episode
   if (gamestate.episode+1 == unlocked && gamestate.episode < 5)
   {
           Write(1,21,"New episode awarded!");
           unlocked = gamestate.episode+2;
           WriteConfig (); // Insure it is saved...

           SD_PlaySound(BONUS1UPSND);
   }

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 05 Jul 2018

Topics: 87
Posts: 758
Location: Wisconsin
usa.gif

PostPosted: Wed Dec 08, 2010 9:41 pm
   Subject: Re: [TUTORIAL] Episodes must be completed in order
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Yea thats exactly what I said. lol.

I did mine with a new struct, but thats because I have more information thats related.

_________________
I'm back! I missed this community!
Youtube Channel: TreeSapThief

New Site: http://www.treesapthief.com
Twitter: @treesapthief
WSJ
DieHard Officer
DieHard Officer


Joined: 17 Apr 2004
Last Visit: 08 May 2017

Topics: 24
Posts: 521

blank.gif

PostPosted: Thu Dec 09, 2010 12:55 pm
   Subject: [TUTORIAL] Episodes must be completed in order
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thanks for sharing this, Codetech. It could be a useful method of having other unlockable stuff as well (achievements, extra content, etc.)
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 05 Jul 2018

Topics: 87
Posts: 758
Location: Wisconsin
usa.gif

PostPosted: Thu Dec 09, 2010 4:14 pm
   Subject: Re: [TUTORIAL] Episodes must be completed in order
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

This can also be modified to use bitwise functions, just like how the keys work, using (unlocked & (1<<i)) and unlocked |= (1<<i) to be able to unlock (i.e. achievements, episodes, secrets)

_________________
I'm back! I missed this community!
Youtube Channel: TreeSapThief

New Site: http://www.treesapthief.com
Twitter: @treesapthief
Soldat 555
Guest



Last Visit:





PostPosted: Tue Dec 14, 2010 5:49 pm
   Subject: Re: [TUTORIAL] Episodes must be completed in order
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Could you make this into like a episode select/seemless level progression hybrid? Like let's say you start in Ep.1, you can play through to level 60 but once you get to level 11, you can start playing Ep.2 on the select screen and when you do, you'll start at level 11.


Thunderstorm Joshua M@d Wolf Waight Thunderstorm
RichterBelmont12
DieHard Wolfer
DieHard Wolfer


Joined: 14 Aug 2004
Last Visit: 21:28 ago.

Topics: 97
Posts: 1508
Location: New Jersey
usa.gif

PostPosted: Tue Dec 14, 2010 8:19 pm
   Subject: Re: [TUTORIAL] Episodes must be completed in order
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Soldat 555 wrote:
Could you make this into like a episode select/seemless level progression hybrid? Like let's say you start in Ep.1, you can play through to level 60 but once you get to level 11, you can start playing Ep.2 on the select screen and when you do, you'll start at level 11.


Thunderstorm Joshua M@d Wolf Waight Thunderstorm


I wonder How too

_________________
http://www.youtube.com/RichterBelmont12

https://www.facebook.com/RichterBelmont123

https://twitter.com/Richterbelmont6
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 05 Jul 2018

Topics: 87
Posts: 758
Location: Wisconsin
usa.gif

PostPosted: Tue Dec 14, 2010 8:23 pm
   Subject: Re: [TUTORIAL] Episodes must be completed in order
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Well, I did this in fact.

Requires just a bit of change. Although I did not account for the secret levels. Otherwise I just kept it increasing each level. Best thing is to either create something to jump two levels, and the DrawLevel should be E-L so that it is not higher than 10... thats all that really needs to be done.

_________________
I'm back! I missed this community!
Youtube Channel: TreeSapThief

New Site: http://www.treesapthief.com
Twitter: @treesapthief
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 9988 Fri May 26, 2017 8:19 am
Military View latest post
No new posts [WOLF4SDL Help] Blake Stone Style doors
Author: Haasboy
3 2836 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 3047 Mon Jun 02, 2008 3:59 pm
Adam Biser View latest post
No new posts [Help] Problem with Checkweaponchange function (wolf4sdl)
Author: Mortimer
4 3026 Sat May 17, 2008 11:26 am
Mortimer View latest post
No new posts [help] Wolf4sdl's implemented tutorials
Author: Mortimer
6 3073 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