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] Adding a "Watch Demo" menu option
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
Aryan_Wolf3D
I am Death Incarnate
I am Death Incarnate


Joined: 21 Jul 2011
Last Visit: 14 Dec 2017

Topics: 6
Posts: 172

blank.gif

PostPosted: Tue Mar 21, 2017 4:26 am
   Subject: [Tutorial] Adding a "Watch Demo" menu option
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

Ever got annoyed by having to wait about half a minute for the demo to start, and wished you could just start it instantly? With this method, you finally can!

First, open up wl_main.cpp, and search for "LastDemo". You should see this:

::: CODE :::
int LastDemo = 0;

Delete this line, then do another search for "LastDemo". You should see this:

::: CODE :::
#ifndef SPEARDEMO
            PlayDemo (LastDemo++%4);
            #else
            PlayDemo (0);
            #endif


            if (playstate == ex_abort)
                break;
            VW_FadeOut();
            if(screenHeight % 200 != 0)
                VL_ClearScreen(0);
StartCPMusic(INTROSONG);

Delete the lines in blue. Next, open up wl_menu.cpp and under this:

::: CODE :::
extern int numEpisodesMissing;

Add this:

::: CODE :::
int LastDemo = 0;

Then under this:

::: CODE :::
//
// PRIVATE PROTOTYPES
//
int CP_ReadThis (int);

Add this:

::: CODE :::
int CP_WatchDemo (int);

Search for "STR_BD", and you should find this:

::: CODE :::
{1, STR_BD, 0},

Change it to this:

::: CODE :::
{1, STR_BD, CP_WatchDemo},

Then search for "string[8]", and you should find this:

::: CODE :::
strcpy (&MainMenu[backtodemo].string[8], STR_GAME);

Change the "8" to "0". Then search again for "string[8]", and you'll find this:

::: CODE :::
strcpy (&MainMenu[backtodemo].string[8], STR_DEMO);

Change it to this:

::: CODE :::
strcpy (&MainMenu[backtodemo].string[0], STR_BD);

After that, search for "CP_NewGame", and above that function, add this:

::: CODE :::

////////////////////////////////////////////////////////////////////
//
// WATCH THE DEMO
//
////////////////////////////////////////////////////////////////////

int CP_WatchDemo (int)
{       
   if (!ingame)
     PlayDemo (LastDemo++%4);
}

Finally, open up foreign.h and change this:

::: CODE :::
#define STR_BD "Back To Demo"

To this:

::: CODE :::
#define STR_BD "Watch Demo"

And this:

::: CODE :::
#define STR_GAME   "Game"

To this:

::: CODE :::
#define STR_GAME   "Back To Game"


(If you don't mind it saying "Back To Demo", don't bother changing any of the string related stuff.)

That's it! Now the title pages will cycle, and the Demo can be selected from the menu.

Maybe someone will find this useful. Wink
Aryan Wolf

_________________
"Way too many #ifdefs in the code!" - John Carmack
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 30 Oct 2017

Topics: 55
Posts: 2115
Location: Canada
blank.gif

PostPosted: Tue Mar 21, 2017 8:38 am
   Subject: Re: [Tutorial] Adding a "Watch Demo" menu option
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Great idea Aryan_Wolf3D! Waiting for demos is a pain. The worst is when you wait then find out the mod doesn't have any. Laughing
Aryan_Wolf3D
I am Death Incarnate
I am Death Incarnate


Joined: 21 Jul 2011
Last Visit: 14 Dec 2017

Topics: 6
Posts: 172

blank.gif

PostPosted: Tue Mar 21, 2017 8:55 am
   Subject: Re: [Tutorial] Adding a "Watch Demo" menu option
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thanks Chris, and yes, I hate waiting for the demo, especially since Wolf3D 1.4 increased the time to wait! Remember how 1.1 just went through the title screen, "fizzlefaded" to the credits page and then started the demo? And when it had finished, it showed the high scores. I much preferred that version of DemoLoop, to be honest... Though I think that they forgot to make the intro song play at one point.

EDIT: Ah yes, it's when you choose the "Back To Demo" option, it keeps on playing the menu song.

_________________
"Way too many #ifdefs in the code!" - John Carmack
fraggeur
DieHard Guard
DieHard Guard


Joined: 31 Dec 2012
Last Visit: 09 Dec 2017

Topics: 11
Posts: 259

blank.gif

PostPosted: Wed Mar 22, 2017 2:38 pm
   Subject: Re: [Tutorial] Adding a "Watch Demo" menu option
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Hahah nice idea indeed. I don't always like waiting for demos, but it adds a bit of "diserving" notion, almost like a religious wait Very Happy
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 1:22 ago.

Topics: 160
Posts: 8008
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Wed Mar 22, 2017 4:08 pm
   Subject: Re: [Tutorial] Adding a "Watch Demo" menu option
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Oddly enough, I did some sort of hack where it would run the self-running demos if you pressed a certain key and held it down. It was ideal for beta-testing, and I programmed it so that it could be "#ifdef"-ed out. As you might have guessed, I don't have the code anymore. Sad
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 Sticky: [Tutorial] Compiling Wolf4SDL with Code::Blocks
Author: dcbasic
90 17488 Wed May 24, 2017 7:53 pm
Falcon*93 View latest post
No new posts [help] Adding teleporters in wolf4sdl
Author: Mortimer
35 7360 Fri May 26, 2017 8:19 am
Military View latest post
No new posts Problem with new Wolf4SDL Demo Releases
Author: BrotherTank
4 1416 Sun Jul 20, 2008 3:57 am
Ripper View latest post
No new posts [Help] Problem with Checkweaponchange function (wolf4sdl)
Author: Mortimer
4 2328 Sat May 17, 2008 11:26 am
Mortimer View latest post
No new posts [SDL] Apply 2nd ScaleFactor to selected (hi-res) vga gfx
Author: Andy_Nonymous
9 3266 Sun Apr 27, 2008 2:30 am
AlumiuN 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