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       

Adding a new weapon
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
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: Sun Jun 13, 2004 2:02 pm
   Subject: Adding a new weapon
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

Adding a New Weapon:
Steps - 19
Sections - 4
Files to edit - wl_def.h / wl_draw.c / wl_agent.c / wl_act1.c / wl_game.c / vswap.* / vga*.*


Hello all, here's a nice tutorial for you to add a new weapon! Please post all comments in this topic!
All code in this tutorial was taken from Projekt Vertilgung Phase I; and if you have anyproblems, please post here!

Remember, all text in red should be added to the shown code, and all text in green should be deleted!

Adding the weapon:

Step 1.
Open up your favourite Wolfenstein TC editor, and go to the graphics section where you can add sprites.
Add 5 sprites at the end of the file (after the chaingun images).
These will be the images shown when using the new gun.

Step 2.
Open wl_def.h
Search for "SPR_CHAINATK4"

Quote:

SPR_CHAINREADY,SPR_CHAINATK1,SPR_CHAINATK2,SPR_CHAINATK3,
SPR_CHAINATK4,

SPR_STENREADY,SPR_STENATK1,SPR_STENATK2,SPR_STENATK3,
SPR_STENATK4,



Step 3.
Search for "wp_chaingun"

Quote:

NUMWEAPONS 5
...
wp_knife,
wp_pistol,
wp_machinegun,
wp_chaingun, //<--make sure you add the comma!
wp_stengun //<-- no comma!

} weapontype;


Step 4.
Open wl_draw.c
Search for "SPR_CHAINREADY"

Quote:

SPR_MACHINEGUNREADY,SPR_CHAINREADY,SPR_STENREADY};


Step 5.
Open wl_agent.c
Search for "attackinfo"

Quote:

{ {6,0,1},{6,2,2},{6,0,3}{6,-1,4} },
{ {6,0,1},{6,1,2},{6,0,3}{6,-1,4} },
{ {6,0,1},{6,1,2},{6,3,3}{6,-1,4} },
{ {6,0,1},{6,1,2},{6,4,3}{6,-1,4} },
{ {6,0,1},{6,1,2},{6,3,3}{6,-1,4} }, //Stengun
};


Step 6.
Search for "wp_chaingun"

Quote:

case wp_chaingun:
SD_PlaySound (ATKGATLINGSND);
break;
case wp_stengun:
//SD_PlaySound(WELLCOMEHERELATERSND);
break;

}


Ok, so now we've added the weapon. You will need an item to pick up for this new weapon...!

Adding the weapon item

Step 7.
Open up your favourite Wolfenstein TC editor, and go to the graphics section where you can add sprites.
Add 1 sprite at the end of the file (after the stengun images you added before).
This will be the image shown as the item before you pick it up!

Step 8.
Open up wl_def.h
Search for "SPR_STENATK"

Quote:

SPR_CHAINREADY,SPR_CHAINATK1,SPR_CHAINATK2,SPR_CHAINATK3,
SPR_CHAINATK4,

SPR_STENREADY,SPR_STENATK1,SPR_STENATK2,SPR_STENATK3,
SPR_STENATK4,

SPR_STENGUN,


Step 9.
Search for "bo_spear"

Quote:

bo_fullheal,
bo_25clip,
bo_stengun,
bo_spear


Step 10.
Open up wl_agent.c
Search for "bo_chaingun:"

Quote:

case bo_chaingun:
....
break;

case bo_stengun:
GiveWeapon (wp_stengun);
//SD_PlaySound(WELLCOMEHERELATERSND);
break;



Step 11.
Open wl_act1.c
Search for "bo_spear:"

Quote:

bo_spear:
bo_stengun:
laststatobj->flags = FL_BONUS;


Step 12.
Go to the top of the file wl_act1.c
Search for "bo_clip2"

Quote:

{SPR_STAT_26,bo_clip2}, // Clip "
{SPR_STENGUN,bo_stengun}, // Stengun "
{-1} // terminator
};


Step 13.
Open wl_game.c
Search for "case 72"

If your using the WOLFENSTEIN code:
Quote:

case 71:
case 72: //Stengun
case 73:
case 74:
case 75:


If your using the SPEAR code:
Quote:

case 71:
case 72:
case 73:
case 74:
case 75:
[color=red]case 76: //Stengun


(In spear, case 72-75 are taken, but in Wolfenstein they aren't defined!)

Now using your favourite wolfenstein editor set a new item called Stengun to id 75. (There will be a tutorial on this soon)

Now we've added the item we need to set the button to change to that weapon! There are many ways of re-writing the 'CheckWeaponChange' function, but if your just adding weapons without complex stuff like sepearate ammo types, this is perfect!

CheckWeaponChange

Step 14.
Open up wl_def.h
Search for "bt_readychaingun"

Quote:

NUMBUTTONS 9
...
bt_readymachinegun,
bt_readychaingun, //<--make sure you add the comma!
bt_readystengun //<-- no comma!

);


That's it for the CheckWeaponChange!

DrawWeapon

Step 15.
Open up your favourite Wolfenstein TC editor, and go to the VGA graphics section where you can add images.
Add 1 image at the end of the file (after the getpsyched image!).
This will be the image shown as the item on the status bar when you've got the gun!

Step 16.
Open up GFXV_WL6 (or GFXV_SOD if using the spear code)
Search for "GETPSYCHEDPIC"

Quote:

GETPSYCHEDPIC, //149
STENGUNPIC, //150
ORDERSCREEN=152,
ERRORSCREEN, //152


Step 17.
Search for "LATCHPICS_LUMP_END"

Quote:

#define LATCHPICS_LUMP_END 150 //Add one for each new image


Step 18.
Search for "NUMPICS"

Quote:

#define NUMPICS 148 //Add one for each new image


Step 19.
Open wl_agent.c
Search for "DrawWeapon"

Quote:

void DrawWeapon (void)
{
if(gamestate.chosenweapon == wp_stengun)
{
StatusDrawPic (32,8,STENGUNPIC);
}
else
{
StatusDrawPic (32,8,KNIFEPIC+gamestate.weapon);
}
}


Adding Sounds Coming later to the tutorial...

_________________
~ James
ZuljinRaynor
DieHard Officer
DieHard Officer


Joined: 17 Jan 2004
Last Visit: 30 May 2018

Topics: 19
Posts: 559

usa.gif

PostPosted: Sun Jun 13, 2004 7:23 pm
   Subject: Re: Adding a new weapon
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

So far so good. Keep up the good work on this tutorial.
Dugtrio17
Code Master
Code Master


Joined: 11 Mar 2003
Last Visit: 03 Oct 2013

Topics: 49
Posts: 903
Location: Seattle
usa.gif

PostPosted: Sun Jun 13, 2004 8:03 pm
   Subject: Re: Adding a new weapon
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

This is the first "complete package" weapon adding tutorial I've seen; should be useful for newbie coders. However, don't forget that you must also increase the first number in brackets before the atkinf structure; that 4 should be however many weapons you've got or you'll get an error when you compile.

_________________
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: Mon Jun 14, 2004 10:56 am
   Subject: Re: Adding a new weapon
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I did write a real naf version, but then split it up so that neubs would understand it...

should be a few additions like


  • Adding Sounds
  • Editing attackinfo
  • Making weapon silent etc...


all updates will be on ingomania.tk when its online!

_________________
~ James
Guest




Last Visit:





PostPosted: Mon Apr 11, 2005 1:05 pm
   Subject: Re: Adding a new weapon
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I have read through your tutorial and understand it, but I am unable to add any extra sprites into the compiler after the chaingun. I am currently using the WDC ( Wolf3d Data Compiler ). Any help would be great!

The-Meister Mr Green
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 03 Dec 2018

Topics: 46
Posts: 2317
Location: USA
usa.gif

PostPosted: Mon Apr 11, 2005 7:52 pm
   Subject: Re: Adding a new weapon
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Well, that looks like a WDC issue. To do this, scroll to the end of your sprites, then click Edit->Add Chunk to End.
You can only add to the end when you are at the end.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
Guest




Last Visit:





PostPosted: Tue Apr 12, 2005 4:45 am
   Subject: Re: Adding a new weapon
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thanks Adam I'll try that! Cheesy Grin
jasonbay
Can I Play Daddy
Can I Play Daddy


Joined: 22 Feb 2008
Last Visit: 12 Mar 2010

Topics: 20
Posts: 48
Location: u.s.a.
usa.gif

Warnings : 1
PostPosted: Fri Feb 22, 2008 10:22 am
   Subject: Re: Adding a new weapon
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

it dosnt work for me

i get 3-4 errors and they are like missing expression and stuff like that

_________________
TheTalentedMrLeo
Forum Administrator
<B>Forum Administrator</B>


Joined: 14 Mar 2003
Last Visit: 13:37 ago.

Topics: 36
Posts: 683
Location: Sometimes in Canada
usa.gif

PostPosted: Fri Feb 22, 2008 12:16 pm
   Subject: Re: Adding a new weapon
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

No one as of yet, in the last three years, has made a complaint about the tutorial, so I would assume the problem is on your end. If you're having trouble, I'd suggest you go back and check to see if you've forgotten to add the expressions.

Also, please don't bump these threads, specifically ones that have been dead for more than a year, unless you have something useful to add to the discussion, such as a modification to the tutorial.

Anyways, welcome back.

Leo
Moderator
thellt
Bring 'em On
Bring 'em On


Joined: 21 Jan 2008
Last Visit: 12 May 2009

Topics: 11
Posts: 85
Location: bloodgulch
usa.gif

PostPosted: Mon Feb 25, 2008 8:16 am
   Subject: Adding a new weapon
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

if you use a tutorial simelar to this one (and it is on a site that has borland c and a couple of other things (the site has blue boxes i cant remember the url...) i will edit this when i find it... ) i found out that it uses the empty key vgagraph. is it possible to change it to one you add at the end of vgagraph?

(sorry for my wierd post) ...

_________________
}{even or }{ellt?

look for helt3d
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 0:40 ago.

Topics: 38
Posts: 2518
Location: Christchurch, New Zealand
newzealand.gif

PostPosted: Mon Feb 25, 2008 12:54 pm
   Subject: Re: Adding a new weapon
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Someone must have left being able to add the extra picture to the end of the VGAGRAPH out of the tutorial. The reason it would use the empty key picture would be because all of the normal weapon pictures are right before the empty key picture, and the DrawWeapon function would just use the picture straight after.
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 12:09 ago.

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

PostPosted: Mon Feb 25, 2008 6:24 pm
   Subject: Re: Adding a new weapon
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Actually, the extra weapon pic is added right *before* the empty key pic, if I'm not mistaken.
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 0:40 ago.

Topics: 38
Posts: 2518
Location: Christchurch, New Zealand
newzealand.gif

PostPosted: Tue Feb 26, 2008 12:33 am
   Subject: Re: Adding a new weapon
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Well, it can be, but a little programming fixes that. Smile
thellt
Bring 'em On
Bring 'em On


Joined: 21 Jan 2008
Last Visit: 12 May 2009

Topics: 11
Posts: 85
Location: bloodgulch
usa.gif

PostPosted: Tue Mar 04, 2008 2:01 pm
   Subject: Re: Adding a new weapon
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

programming? k... where do i just put the pic? (in vga graphix and in the code)

_________________
}{even or }{ellt?

look for helt3d
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 0:40 ago.

Topics: 38
Posts: 2518
Location: Christchurch, New Zealand
newzealand.gif

PostPosted: Tue Mar 04, 2008 4:10 pm
   Subject: Re: Adding a new weapon
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

See steps 15 to 19 of jamez's tutorial for that. Smile
thellt
Bring 'em On
Bring 'em On


Joined: 21 Jan 2008
Last Visit: 12 May 2009

Topics: 11
Posts: 85
Location: bloodgulch
usa.gif

PostPosted: Wed Mar 12, 2008 12:07 pm
   Subject: Adding a new weapon
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Laughing HAHAHAHA! I CAN BE DENSE SOMETIMES... Very Happy thanks!

_________________
}{even or }{ellt?

look for helt3d
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 14841 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 2975 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 2159 Sat Mar 13, 2004 2:07 pm
BrotherTank View latest post
No new posts [Code] Changing an Enemies Attack Strength - BrotherTank
Author: BrotherTank
0 2476 Tue Jan 27, 2004 10:29 am
BrotherTank View latest post
No new posts [Code] Changing Weapons -CheckWeaponChange- BrotherTank
Author: BrotherTank
2 3323 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