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] Don't give 0% ratios for level designer omissions
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
Andy_Nonymous
Moderator
<B>Moderator</B>


Joined: 02 Apr 2003
Last Visit: 17 Feb 2015

Topics: 99
Posts: 589
Location: New Jersey, USA
usa.gif

PostPosted: Sat Jan 05, 2013 7:03 am
   Subject: [Tutorial] Don't give 0% ratios for level designer omissions
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

Here's a simple tutorial for both DOS and SDL that gives the player 100% stats on either treasure or secrets if either one is not present in a level. Why ruin the player's final stats if he actually collected and pushed everything possible? I got this idea from the Macintosh Third Encounter, where a couple of levels (probably secret or boss ones) are treasure- or pushwall-less.

Changes are in blue.

In WL_INTER.CPP's LevelCompleted:
::: CODE :::
        //
        // FIGURE RATIOS OUT BEFOREHAND
        //
        kr = sr = tr = 0;
        if (gamestate.killtotal)
            kr = (gamestate.killcount * 100) / gamestate.killtotal;
        if (gamestate.secrettotal)
            sr = (gamestate.secretcount * 100) / gamestate.secrettotal;
        else                // 100% ratio if there's no secrets!
            sr = 100;
     
        if (gamestate.treasuretotal)
            tr = (gamestate.treasurecount * 100) / gamestate.treasuretotal;
        else                // 100% ratio if there's no treasure!
            tr = 100;
     


This frees the level designer from requiring at least one pushwall and treasure in his design. It is assumed that there will always be at least one enemy, but if not, just add an 'else kr=100;' where appropriate.

Andy
gerolf
DieHard Wolfer
DieHard Wolfer


Joined: 28 Jan 2010
Last Visit: 23 Oct 2018

Topics: 162
Posts: 1084
Location: Alabama
usa.gif

PostPosted: Sat Jan 05, 2013 9:37 pm
   Subject: Re: [Tutorial] Don't give 0% ratios for level designer omissions
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thank you, this is great!

_________________
Dean
Moderator
<B>Moderator</B>


Joined: 10 Jan 2006
Last Visit: 11 Nov 2018

Topics: 53
Posts: 2200
Location: Australia
australia.gif

PostPosted: Sun Jan 06, 2013 2:52 pm
   Subject: Re: [Tutorial] Don't give 0% ratios for level designer omissions
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

This is great, theres been many a time where I've spent time searching a level with no secrets for a secret as it was showing 0% and I was thinking I might have missed something! Nice work Andy.

_________________
... Still alive Razz
Merthsoft
Bring 'em On
Bring 'em On


Joined: 12 May 2004
Last Visit: 25 Apr 2018

Topics: 5
Posts: 97
Location: Wisconsin
usa.gif

PostPosted: Thu Jan 17, 2013 3:10 pm
   Subject: [Tutorial] Don't give 0% ratios for level designer omissions
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Alternately, you can do:
::: CODE :::
        //
        // FIGURE RATIOS OUT BEFOREHAND
        //
        kr = sr = tr = 100;
        if (gamestate.killtotal)
            kr = (gamestate.killcount * 100) / gamestate.killtotal;
        if (gamestate.secrettotal)
            sr = (gamestate.secretcount * 100) / gamestate.secrettotal;
        if (gamestate.treasuretotal)
            tr = (gamestate.treasurecount * 100) / gamestate.treasuretotal;

This'll give the same effect, but is an overall smaller change. The difference is trivial, ultimately, but it makes it so that if you have more ratios along the way, you can follow the same pattern and have smaller code. For example, let's say there's a special kind of kill ratio, like dogs killed or something. Adding it here just means another var and another if, rather than an additional if/else:
::: CODE :::
        //
        // FIGURE RATIOS OUT BEFOREHAND
        //
        kr = sr = tr = dr = 100;
        if (gamestate.killtotal)
            kr = (gamestate.killcount * 100) / gamestate.killtotal;
        if (gamestate.secrettotal)
            sr = (gamestate.secretcount * 100) / gamestate.secrettotal;
        if (gamestate.treasuretotal)
            tr = (gamestate.treasurecount * 100) / gamestate.treasuretotal;
        if (gamestate.dogkilltotal)
            dr = (gamestate.dogcount * 100) / gamestate.dogkilltotal;

_________________
Shaun
WSJ
DieHard Officer
DieHard Officer


Joined: 17 Apr 2004
Last Visit: 30 Nov 2017

Topics: 24
Posts: 521

blank.gif

PostPosted: Fri Jan 18, 2013 3:31 am
   Subject: [Tutorial] Don't give 0% ratios for level designer omissions
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

My preferred method is to have it write "N/A" for the non-existent ratios, and make the kr/sr/tr equal 100 after that part. Because awarding the player a bonus for non-existent work reminds me of the irresponsible executives who got us into the economic crisis. Mr Green
ronwolf1705
Moderator
<B>Moderator</B>


Joined: 31 Jul 2006
Last Visit: 0:04 ago.

Topics: 73
Posts: 3771

blank.gif

PostPosted: Fri Jan 18, 2013 4:10 am
   Subject: Re: [Tutorial] Don't give 0% ratios for level designer omiss
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

WSJ wrote:
Because awarding the player a bonus for non-existent work reminds me of the irresponsible executives who got us into the economic crisis. Mr Green


Right on, brother! Mr Green
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 6:23 ago.

Topics: 165
Posts: 8252
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Fri Jan 18, 2013 6:12 am
   Subject: Re: [Tutorial] Don't give 0% ratios for level designer omiss
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

WSJ wrote:
My preferred method is to have it write "N/A" for the non-existent ratios, and make the kr/sr/tr equal 100 after that part. Because awarding the player a bonus for non-existent work reminds me of the irresponsible executives who got us into the economic crisis. Mr Green
We need a "Like" button for DHWs posts. Too Cool
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 Announcement: Wolf3d & Spear of Destiny Shareware SDL Downloads
Author: BrotherTank
10 16021 Tue Aug 24, 2010 10:18 am
dcbasic View latest post
No new posts Sticky: [Tutorial] Compiling Wolf4SDL with Code::Blocks
Author: dcbasic
90 27517 Wed May 24, 2017 7:53 pm
Falcon*93 View latest post
No new posts Remaking released mod into SDL
Author: Dean
14 4418 Thu Aug 14, 2008 4:58 pm
Dean View latest post
No new posts [Help] Gun Bobbing in SDL
Author: RichterBelmont12
8 3121 Wed Jul 23, 2008 6:37 pm
Tricob View latest post
No new posts [SDL] Apply 2nd ScaleFactor to selected (hi-res) vga gfx
Author: Andy_Nonymous
9 4784 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