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] Changing Weapons -CheckWeaponChange- BrotherTank
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: 2255
Location: Ontario
canada.gif

PostPosted: Sun Mar 30, 2003 3:09 pm
   Subject: [Code] Changing Weapons -CheckWeaponChange- BrotherTank
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

This is a direct replacement for those long winded "if" statement routines that people have been posting for changing weapons. I find this a little better to work with for Weapons Changing as it allows much more flexibility.

Open the "wl_agent.c" file and search for "void CheckWeaponChange". Replace the routine with the following:

::: CODE :::
void CheckWeaponChange (void)
{  int   kbuttons[5]={sc_1,sc_2,sc_3,sc_4,sc_5};
   int   i;
   for (i=0;i<5;i++)
     if ((Keyboard[kbuttons[i]]) && (i <= gamestate.bestweapon) && (i != gamestate.weapon))
     {
        gamestate.weapon = gamestate.chosenweapon = i;
//  Change weapon sound ala MCS suggestion
        if(gamestate.chosenweapon > 0) SD_PlaySound(MYCHGSND); // Weapon Change Sound
        DrawWeapon ();
        DrawAmmo ();
        return;
     }
}


This could easily be modified to allow for more weapons without all those nasty 'if' statements and also be modified to do the 2 weapons from one key.

I won't do the work for you, but this is a pretty good base to start from.

Greg
BrotherTank


Last edited by BrotherTank on Thu Mar 18, 2004 12:13 pm; edited 7 times in total
Guest




Last Visit:





PostPosted: Sun Apr 13, 2003 4:04 am
   Subject: Re: [Code] Changing Weapons -CheckWeaponChange- BrotherTank
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Very nice routine...Thanks for sharing it with us Smile
Guest




Last Visit:





PostPosted: Sun Oct 26, 2003 1:21 am
   Subject: CheckWeaponChange
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Heh-heh-heh...

I've greatly reduced what the 'CheckWeaponChange' function does in the Totenhammer source. I've set it, mostly, just to holster your weapon and use medical kits. Basicly, I use it as a 'keyboard scan.' It'd probably be wiser for me, and probably more memory friendly, to just add 'if (Keyboard[sc_x])' states to 'WL_PLAY.C,' but what I have, instead, done is added a new 'SwitchTo(weapon)' function. The reason I did this, instead of using 'CheckWeaponChange,' is because when you switch weapons, in AoT, it changes many player stats. e.g. 'silenced' which applies to the knife and Sten. If 'silenced' is true, then when attacking, the player makes no noise.

if (silenced)
madenoise = false;
else
madenoise = true;

See? It also directs what type of ammo the weapon uses with a 'specialammo' status. So in the 'CheckWeaponChange' function:

switch (LastScan)
{
case 1:
SwitchTo (wp_knife);
break;
case 2:
SwitchTo (wp_pistol);
break;
[etc]

You may ask why I actually did this. I really can't remember off hand.. Embarassed I'm just proud of it anyway. I guess that this is just some 'nifty' part of the code for me to share with everyone. Laughing
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] Gun Bobbing or Aminated Weapons - Dugtrio17
Author: Dugtrio17
5 4299 Tue May 06, 2008 10:53 am
Redeemer View latest post
No new posts [Code] Blood Splatz Tutorial - Blood Splatters
Author: Dugtrio17
45 13356 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 2721 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 1983 Sat Mar 13, 2004 2:07 pm
BrotherTank View latest post
No new posts [Code] Changing an Enemies Attack Strength - BrotherTank
Author: BrotherTank
0 2295 Tue Jan 27, 2004 10:29 am
BrotherTank 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