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       

[Code] Run with Stamina - TekZK
Page 1 of 1
DieHard Wolfers Forum Index -> 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
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

Topics: 153
Posts: 2255
Location: Ontario
canada.gif

PostPosted: Tue Mar 16, 2004 10:14 am
   Subject: [Code] Run with Stamina - TekZK
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

NOTE: This Tutorial is not functioning - Awaiting update from Author


Run with Stamina Tutorial
By TekZK

Hello people! This is a tutorial which you can run only if you have got enough "stamina".

Open "WL_DEF.H" file and search for "Gamestate Structure" block. Look for:
::: CODE :::
typedef struct
{
    int difficulty;
    int mapon;

Add this as the first line above the "int difficulty":
::: CODE :::
    int stamina;


Open "WL_AGENT.C", then search for the block called "Local variables". Add the following line under it (note: You have to add this also in the "WL_PLAY.C" file as well.):

::: CODE :::
void CalcStamina (void);


Still within the "WL_AGENT.C" file go to the end of the file and add this function:
::: CODE :::
/*
===============
=
=    CalcStamina
=
=    this will calculate and draw the current stamina
=
===============
*/

void CalcStamina (void)
{
    int x=201,y2=189,y1;
    long stamtics;

    stamtics+=tics;

    if (gamestate.stamina > 100)
        gamestate.stamina = 100;

    if (stamtics > 90l)
    {
        if (gamestate.stamina < 100)
            gamestate.stamina++;
        else if (gamestate.stamina && buttonstate[bt_run])
            gamestate.stamina--;
        stamtics=0;
    }

    if (gamestate.stamina)
        y1 = y2-(gamestate.stamina/5);
   
    if (gamestate.stamina>5 && gamestate.stamina<100)
    {
        VWB_Vlin(y1,y2,x,12);
        VWB_Vlin(y2-20,y1,x,0);
    }
    else if (gamestate.stamina==100)
    {
        VWB_Vlin(169,y2,x,12);
    }
    else if (gamestate.stamina <=5)
    {
        VWB_Vlin(169,y2,x,0);
    }
}


Now open "WL_PLAY.C" and search for the function "PlayLoop" and then the following code within it:
::: CODE :::
//
// MAKE FUNNY FACE IF BJ DOESN'T MOVE FOR AWHILE
//
#ifdef SPEAR
    funnyticount += tics;
    if (funnyticount > 30l*70)
    {
        funnyticount = 0;
        StatusDrawPic (17,4,BJWAITING1PIC+(US_RndT()&1));
        facecount = 0;
    }
#endif


Add this line directly below the "#endif" statement you found above:
::: CODE :::
CalcStamina();


Now search for the "PollMouseMove" function and locate this code block:

::: CODE :::
controlx += mousexmove*10/(13-mouseadjustment);
controly += mouseymove*20/(13-mouseadjustment);


And replace it with this code:

::: CODE :::
if (buttonstate[bt_run])
{
    controlx = mousexmove*10/(13-mouseadjustment);
    controly = mouseymove*20/(13-mouseadjustment);

    if (gamestate.stamina>=2)
        gamestate.stamina-=2;
    else if (!gamestate.stamina)
        gamestate.stamina=0;
}
else
{
    controlx = mousexmove*5/(13-mouseadjustment);
    controly = mouseymove*10/(13-mouseadjustment);
}



If you applied my "Changing the player speed by the chosen weapon" tutorial then search for:

::: CODE :::
if (buttonstate[bt_run])
{
    cx = mousexmove*10/(13-mouseadjustment);
    cy = mouseymove*20/(13-mouseadjustment);
}
else
{
    cx = mousexmove*5/(13-mouseadjustment);
    cy = mouseymove*10/(13-mouseadjustment);
}


And replace that code with:

::: CODE :::
if (buttonstate[bt_run])
{
    cx = mousexmove*10/(13-mouseadjustment);
    cy = mouseymove*20/(13-mouseadjustment);

    if (gamestate.stamina>=2)
        gamestate.stamina-=2;
    else if (!gamestate.stamina)
        gamestate.stamina=0;
}
else
{
    cx = mousexmove*5/(13-mouseadjustment);
    cy = mouseymove*10/(13-mouseadjustment);
}



Now save and compile. If you want to run, you must have at least 5 stamina unit. The stamina counter is displayed next to the health one. Your stamina will be recharged in a few seconds.

Enjoy - TekZK


Last edited by BrotherTank on Thu Mar 18, 2004 12:05 pm; edited 1 time in total
jamez
I am Death Incarnate
I am Death Incarnate


Joined: 16 Mar 2003
Last Visit: 19 Oct 2017

Topics: 13
Posts: 186
Location: Yorkshire, UK
uk.gif

PostPosted: Tue Mar 16, 2004 12:15 pm
   Subject: Re: [CODE] Run with Stamina - TekZK
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

When I hold shift, and the bar runs down, it gets to the bottom but bj still runs!

_________________
~ James
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

Topics: 153
Posts: 2255
Location: Ontario
canada.gif

PostPosted: Tue Mar 16, 2004 12:32 pm
   Subject: Re: [CODE] Run with Stamina - TekZK
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

jamez wrote:
When I hold shift, and the bar runs down, it gets to the bottom but bj still runs!


Ask TekZK.... Although I posted his routines... I took them directly from the information I was given. You are right... he's missed something in there..

I think you need to look at the "BT_RUN" stuff... and check that if the button is pushed AND Stamina is greater than 5.... then run... else... don't run...

Greg
BrotherTank
jamez
I am Death Incarnate
I am Death Incarnate


Joined: 16 Mar 2003
Last Visit: 19 Oct 2017

Topics: 13
Posts: 186
Location: Yorkshire, UK
uk.gif

PostPosted: Tue Mar 16, 2004 12:40 pm
   Subject: Re: [CODE] Run with Stamina - TekZK
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I guess he knows how to fix this as it works in his mod!

_________________
~ James
Sockman
Don't Hurt Me
Don't Hurt Me


Joined: 19 Jun 2003
Last Visit: 24 Jun 2008

Topics: 3
Posts: 67
Location: City 17
usa.gif

PostPosted: Tue Mar 16, 2004 3:11 pm
   Subject: Re: [CODE] Run with Stamina - TekZK
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

There needs to a be a check for a movement key as well. You can stand still and hold down SHIFT, and the stamina still goes down. This wasn't fixed in his game, either.

_________________
This isn't revenge; it's punishment.
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 01 Apr 2018

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

PostPosted: Thu Mar 18, 2004 12:25 pm
   Subject: Re: [Code] Run with Stamina - TekZK
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I have done this feature to a old project of mine, I made it myself. Not to brag but, it's much better. I could send code for that.
The stamina meter dosen't require any space on status bar.

It just needs to be updated a bit...

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


Joined: 07 Feb 2004
Last Visit: 19 Oct 2016

Topics: 19
Posts: 370
Location: Northern Italy
italy.gif

PostPosted: Thu Mar 18, 2004 12:52 pm
   Subject: Re: [Code] Run with Stamina - TekZK
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

There was a mistake in the tutorial. You should remove 2 stamina units in PollKeyboardMove() even if you didn't applied the "player speed by chosen weapon".
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

Topics: 153
Posts: 2255
Location: Ontario
canada.gif

PostPosted: Thu Mar 18, 2004 5:13 pm
   Subject: Re: [Code] Run with Stamina - TekZK
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

TexZK wrote:
There was a mistake in the tutorial. You should remove 2 stamina units in PollKeyboardMove() even if you didn't applied the "player speed by chosen weapon".


By the looks of it there is more wrong than just that. From what I can tell, there is no adjustment to the player as the stamina falls... nothing at all.. And as for the keyboard, well, there should be polling in all of the keyboard, mouse, and joystick routines...

Time to rethink this one I think... The actual stamina itself seems to work fine. It lowers the more you run, but again, there is no adjustment to the player slowing down ??

Greg
BrotherTank
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 01 Apr 2018

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

PostPosted: Sun May 16, 2004 12:54 am
   Subject: Re: [Code] Run with Stamina - TekZK
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

BrotherTank wrote:
TexZK wrote:
There was a mistake in the tutorial. You should remove 2 stamina units in PollKeyboardMove() even if you didn't applied the "player speed by chosen weapon".


By the looks of it there is more wrong than just that. From what I can tell, there is no adjustment to the player as the stamina falls... nothing at all.. And as for the keyboard, well, there should be polling in all of the keyboard, mouse, and joystick routines...

Time to rethink this one I think... The actual stamina itself seems to work fine. It lowers the more you run, but again, there is no adjustment to the player slowing down ??

Greg
BrotherTank


My version of this, has 'em all. I could write it down, allthough I'm quite slow at making tutorials...

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> 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: [Info] Help for newbie coders! C++ Tutorial
Author: Dugtrio17
20 9014 Sun Jan 10, 2010 12:26 pm
Fragstein3D View latest post
No new posts [Info] Black & White Effect - Tutorial
Author: Guest
10 297 Thu Mar 17, 2005 6:24 pm
Dugtrio17 View latest post
This topic is locked: you cannot edit posts or make replies. [Info] Source code for Darkone's NewWolf Classic
Author: Raistlin
1 1677 Tue Feb 10, 2004 10:18 am
BrotherTank View latest post
No new posts [Info] Making Guards Always Face You - Rotating guards
Author: CoolMario
3 88 Wed Jul 30, 2003 9:31 am
Codetech84 View latest post
No new posts [Info] Swap file decompiler
Author: DarkOne
3 4355 Wed Jul 09, 2003 10:34 pm
Guest 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