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] Adjusting Player Speed by Chosen Weapon - TekZK
Page 1 of 1
DieHard Wolfers Forum Index -> Code Tutorials 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: 2248
Location: Ontario
canada.gif

PostPosted: Sat Mar 13, 2004 8:39 am
   Subject: [Code] Adjusting Player Speed by Chosen Weapon - TekZK
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Bottom of Posts

This Tutorial is by TekZK (Credit where credit is due)!

Adjusting Player Speed by Chosen Weapon Tutorial

Hello people! This is a tutorial which you can change the player speed in Wolf3D. Carry a larger weapon when running and your speed will be made slower.

Open "WL_PLAY.C", then search for the function called "PollKeyboardMove". Replace that function with this one:

::: CODE :::

void PollKeyboardMove (void)
{
    long double runmove = RUNMOVE*tics,
    basemove = BASEMOVE*tics;

    switch (gamestate.chosenweapon)
    {
        case wp_knife:
        case wp_pistol:
            break;
        case wp_machinegun:
            runmove = runmove/1.25;
            basemove = runmove/2;
            break;
        case wp_chaingun:
            runmove /= 1.5;
            basemove = runmove/2;
            break;
    }

    if (buttonstate[bt_run] )
    {
        if (Keyboard[dirscan[di_north]])
            controly -= runmove;
        if (Keyboard[dirscan[di_south]])
            controly += runmove;
        if (Keyboard[dirscan[di_west]])
            controlx -= runmove;
        if (Keyboard[dirscan[di_east]])
            controlx += runmove;
    }
    else
    {
        if (Keyboard[dirscan[di_north]])
            controly -= basemove;
        if (Keyboard[dirscan[di_south]])
            controly += basemove;
        if (Keyboard[dirscan[di_west]])
            controlx -= basemove;
        if (Keyboard[dirscan[di_east]])
            controlx += basemove;
    }
}


Now search for the function "PollMouseMove" and replace it with this one:

::: CODE :::

void PollMouseMove (void)
{
    int    mousexmove,mouseymove;
    long float cx,cy;

    Mouse(MDelta);
    mousexmove = _CX;
    mouseymove = _DX;

    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);
    }

    switch (gamestate.chosenweapon)
    {
        case wp_knife:
        case wp_pistol:
            break;
        case wp_machinegun:
            cx /= 1.5;
            cy /= 1.5;
            break;
        case wp_chaingun:
            cx /= 2;
            cy /= 2;
            break;
    }

controlx += cx;
controly += cy;
}


Save & compile. Good! Now you can't run so fast with a machinegun or a chaingun in your hands!

TekZK
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Code Tutorials 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 [Code] Blood Splatz Tutorial - Blood Splatters
Author: Dugtrio17
45 16755 Tue Mar 11, 2008 12:02 am
AlumiuN View latest post
No new posts [Code] Display Different Ammo Types on Statusbar-BrotherTank
Author: BrotherTank
1 3324 Fri Feb 11, 2005 9:18 pm
Zombie_Plan View latest post
No new posts [Code] Adding a Frames per Second Counter - Darkone
Author: BrotherTank
0 2458 Sat Mar 13, 2004 2:07 pm
BrotherTank View latest post
No new posts [Code] Changing an Enemies Attack Strength - BrotherTank
Author: BrotherTank
0 2753 Tue Jan 27, 2004 10:29 am
BrotherTank View latest post
No new posts [Code] Changing Weapons -CheckWeaponChange- BrotherTank
Author: BrotherTank
2 3669 Sun Oct 26, 2003 1:21 am
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