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] Adding a new projectile
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
Zombie_Plan
DieHard Wolfer
DieHard Wolfer


Joined: 12 Oct 2004
Last Visit: 07 Jun 2016

Topics: 101
Posts: 1614
Location: A hole in the wall
australia.gif

PostPosted: Mon Dec 27, 2004 8:14 pm
   Subject: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

This is my tutorial on creating a new projectile. It has been tested, and it works.

Open WL_DEF.C and search for SPR_CHAINATK . You should find:
::: CODE :::

SPR_CHAINREADY,SPR_CHAINATK1,SPR_CHAINATK2,SPR_CHAINATK3,
      SPR_CHAINATK4,


Underneath, add the following:
::: CODE :::

SPR_CHAINREADY,SPR_CHAINATK1,SPR_CHAINATK2,SPR_CHAINATK3,
      SPR_CHAINATK4,
SPR_NEW1, SPR_NEW2, SPR_NEW3,


In the same file, search for needleobj, you should find:
::: CODE :::

   mutantobj,
   needleobj,
   fireobj,
   bjobj,

Add newobj, underneath, to look like:

::: CODE :::

   mutantobj,
   needleobj,
newobj,
   fireobj,
   bjobj,


Next, we need to add the statetypes. Open WL_ACT2.C and search for HYPO . You will get:
::: CODE :::

statetype s_needle1    = {false,SPR_HYPO1,6,T_Projectile,NULL,&s_needle2};
statetype s_needle2    = {false,SPR_HYPO2,6,T_Projectile,NULL,&s_needle3};
statetype s_needle3    = {false,SPR_HYPO3,6,T_Projectile,NULL,&s_needle4};
statetype s_needle4    = {false,SPR_HYPO4,6,T_Projectile,NULL,&s_needle1};


Underneath, add:
::: CODE :::

//
// New Projectile
//

extern   statetype s_newobj1;
extern   statetype s_newobj2;
extern   statetype s_newobj3;

statetype s_newobj1    = {false,SPR_NEW1,6,T_Projectile,NULL,&s_newobj2};
statetype s_newobj2    = {false,SPR_NEW2,6,T_Projectile,NULL,&s_newobj3};
statetype s_newobj3    = {false,SPR_NEW3,6,T_Projectile,NULL,&s_newobj1};



Now, move to the T_GiftThrow Function, and add above it:
::: CODE :::

/*
=================
=
= T_NewObjThrow
=
=================
*/

void T_NewObjThrow (objtype *ob)
{
   long   deltax,deltay;
   float   angle;
   int      iangle;

   deltax = player->x - ob->x;
   deltay = ob->y - player->y;
   angle = atan2 (deltay,deltax);
   if (angle<0)
      angle = M_PI*2+angle;
   iangle = angle/(M_PI*2)*ANGLES;

   GetNewActor ();
   new->state = &s_newobj1;
   new->ticcount = 1;

   new->tilex = ob->tilex;
   new->tiley = ob->tiley;
   new->x = ob->x;
   new->y = ob->y;
   new->obclass = newobj;
   new->dir = nodir;
   new->angle = iangle;
   new->speed = 0x2000l;

   new->flags = FL_NONMARK;
   new->active = true;

   PlaySoundLocActor (BONUS1SND,new);   //Change to the sound you want.
}



Save and compile. Now, enter you editor (I used Flo-Edit) and enter the graphics section. Add three new sprites and choose the grphics you want. I used three of the Angel of Deaths Attack sprites (from SOD). Now in the game, whichever enemy you assign the projectile to, will throw it at you.
One more thing has to be done though. When the projectile hits something, the game crashes. This is because the damage option is not set. Open up WL_ACT.C and search for needleobj . You will get:
::: CODE :::

case needleobj:
         damage = (US_RndT() >>3) + 20;
         break;

Simply add your own damage count for your projectile:
::: CODE :::

case newobj:
         damage = (US_RndT() >>5) + 40;
         break;



To save memory, you could do this instead:
::: CODE :::

case newobj:

case needleobj:
         damage = (US_RndT() >>3) + 20;
         break;

This makes your projectile produce the same damage as Schabbs' Needle.

You don't need to make it use just three sprites, experiment and make it directional (like the rocket) or something.

Hope this helps someone. Smile

Edit; Fixed Some Statetype errors

_________________
Zombieskittles

Welcome to 2016, where DHW still thinks it is okay to ban the world's most popular email service provider, and I can't have an avatar over 10kb


Last edited by Zombie_Plan on Tue Dec 19, 2006 2:50 pm; edited 1 time in total
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 05 Jul 2018

Topics: 87
Posts: 758
Location: Wisconsin
usa.gif

PostPosted: Mon Dec 18, 2006 6:55 pm
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

When the enemy shoots the projectile, and it hits you, it seems to go at you and disappear, how can you get the projectile to explode in front of you like DOOM has it?

Like this:


_________________
I'm back! I missed this community!
Youtube Channel: TreeSapThief

New Site: http://www.treesapthief.com
Twitter: @treesapthief
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 01 Apr 2018

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

PostPosted: Mon Dec 18, 2006 10:32 pm
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Deathwish wrote:
::: CODE :::

//
// New Projectile
//

extern   statetype s_newobj1;
extern   statetype s_newobj2;
extern   statetype s_newobj3;

statetype s_energy1    = {false,SPR_NEW1,6,T_Projectile,NULL,&s_newobj2};
statetype s_energy2    = {false,SPR_NEW2,6,T_Projectile,NULL,&s_newobj3};
statetype s_energy3    = {false,SPR_NEW3,6,T_Projectile,NULL,&s_newobj1};



I wouldn't want to nag, but where it says energy, it's supposed to say newobj. Geek

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
the_fish
Bring 'em On
Bring 'em On


Joined: 18 Nov 2006
Last Visit: 07 Nov 2008

Topics: 12
Posts: 133
Location: England
uk.gif

PostPosted: Tue Dec 19, 2006 11:50 am
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

WTF!? This thread is two years old!

And it's eerily exactly what I'm looking for to implement next. Couldn't it be moved to the Tutorials forum? (with Codetech84's spot Smile )

@insurrectionman: I've never played DOOM (gasp!) but instead of having it explode 'in front of you' couldn't you use SimpleScaleShape to draw an explosion sprite to the view before DrawPlayerWeapon in ThreeDRefresh? You'd have to introduce a few variables to control if you should draw a sprite, where the sprite is drawn and the explosion frame. Not sure if this is the effect you had in mind.

Actually...if you add a 'die' set of statetypes to the projectile's list, you might be able to set up an explosiony thing - just look at the KillActor function to give you some ideas. Not sure how this would look if the projectile 'died' on the same tile as you though.
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 05 Jul 2018

Topics: 87
Posts: 758
Location: Wisconsin
usa.gif

PostPosted: Tue Dec 19, 2006 2:19 pm
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Well, I got it to work once before and I think it has something to do with the Projectile function.

And I decided to write that post in this thread because I didn't want to start another one.

_________________
I'm back! I missed this community!
Youtube Channel: TreeSapThief

New Site: http://www.treesapthief.com
Twitter: @treesapthief
Zombie_Plan
DieHard Wolfer
DieHard Wolfer


Joined: 12 Oct 2004
Last Visit: 07 Jun 2016

Topics: 101
Posts: 1614
Location: A hole in the wall
australia.gif

PostPosted: Tue Dec 19, 2006 2:49 pm
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Codetech84 wrote:
Deathwish wrote:
::: CODE :::

//
// New Projectile
//

extern   statetype s_newobj1;
extern   statetype s_newobj2;
extern   statetype s_newobj3;

statetype s_energy1    = {false,SPR_NEW1,6,T_Projectile,NULL,&s_newobj2};
statetype s_energy2    = {false,SPR_NEW2,6,T_Projectile,NULL,&s_newobj3};
statetype s_energy3    = {false,SPR_NEW3,6,T_Projectile,NULL,&s_newobj1};



I wouldn't want to nag, but where it says energy, it's supposed to say newobj. Geek


O_o who dare res my post~!!!

o and good catch codetech >_>

_________________
Zombieskittles

Welcome to 2016, where DHW still thinks it is okay to ban the world's most popular email service provider, and I can't have an avatar over 10kb
the_fish
Bring 'em On
Bring 'em On


Joined: 18 Nov 2006
Last Visit: 07 Nov 2008

Topics: 12
Posts: 133
Location: England
uk.gif

PostPosted: Tue Dec 19, 2006 3:26 pm
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

@insurrectionman:

No, I wasn't having a go at you for necroposting, I was merely expressing surprise that this hadn't been moved to the tutorials forum. With regard to the exploding projectile...if you've got it to work before chances are declaring an 'explosion' chain of statetypes is the way to go.

::: CODE :::

statetype s_boom1               = {false,SPR_BOOM_1,6,NULL,NULL,&s_boom2};
statetype s_boom2               = {false,SPR_BOOM_2,6,NULL,NULL,&s_boom3};
statetype s_boom3               = {false,SPR_BOOM_3,6,NULL,NULL,NULL};

(+ the appropriate externs - this copied from the original source)

In the T_Projectile function, just below the damage assignment when stuff hits you, there's a line that reads
::: CODE :::

ob->state = NULL;               // mark for removal


Replace this with
::: CODE :::

if (ob->obclass==newobj)   // replace newobj with whatever you called your new projectile
    ob->state=s_boom1;
else
    ob->state=NULL;


I think that might be what you're after. Not sure how it'll look in game though...
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 Dec 19, 2006 6:49 pm
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

the_fish wrote:
@insurrectionman:

No, I wasn't having a go at you for necroposting, I was merely expressing surprise that this hadn't been moved to the tutorials forum. With regard to the exploding projectile...if you've got it to work before chances are declaring an 'explosion' chain of statetypes is the way to go.

...


Surprise... Surprise... Surprise...

Two years later and it's finally been corrected?? And you wonder why it wasn't moved into the Tutorials forum? Read the first post in either of the code forums... I seem to remember saying "working" tutorial... and then PM me.

Anyhow... I'm surprised that it took that long for someone to catch it and point it out.... Oh well... Besides most people were using Paal's tutorial on projectiles...

BrotherTank
Forums Admin
Zombie_Plan
DieHard Wolfer
DieHard Wolfer


Joined: 12 Oct 2004
Last Visit: 07 Jun 2016

Topics: 101
Posts: 1614
Location: A hole in the wall
australia.gif

PostPosted: Wed Dec 20, 2006 2:01 am
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

BrotherTank wrote:
the_fish wrote:
@insurrectionman:

No, I wasn't having a go at you for necroposting, I was merely expressing surprise that this hadn't been moved to the tutorials forum. With regard to the exploding projectile...if you've got it to work before chances are declaring an 'explosion' chain of statetypes is the way to go.

...


Surprise... Surprise... Surprise...

Two years later and it's finally been corrected?? And you wonder why it wasn't moved into the Tutorials forum? Read the first post in either of the code forums... I seem to remember saying "working" tutorial... and then PM me.

Anyhow... I'm surprised that it took that long for someone to catch it and point it out.... Oh well... Besides most people were using Paal's tutorial on projectiles...

BrotherTank
Forums Admin


Ya, honestly it didnt bother me, tutorial seciton or not, its a dreadfully simple coding excersize, and anyone who really wants to learn more usually sifts through both sections anyway Wink but meh, at least corrections are actually being made Surprised lol

_________________
Zombieskittles

Welcome to 2016, where DHW still thinks it is okay to ban the world's most popular email service provider, and I can't have an avatar over 10kb
ronwolf1705
Moderator
<B>Moderator</B>


Joined: 31 Jul 2006
Last Visit: 7:53 ago.

Topics: 72
Posts: 3751

blank.gif

PostPosted: Wed Dec 20, 2006 8:32 am
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

::: CODE :::

ob->state=s_boom1;


should be

::: CODE :::

ob->state = &s_boom1;
the_fish
Bring 'em On
Bring 'em On


Joined: 18 Nov 2006
Last Visit: 07 Nov 2008

Topics: 12
Posts: 133
Location: England
uk.gif

PostPosted: Wed Dec 20, 2006 8:41 am
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Well, working/simple tutorial or not, it still told me where to look to add projectiles to my TC. Didn't see another tutorial on it in the tutorials forum, though i could just have missed it.

Works fine for me, with a bit of improvisation Smile

Maybe I should write a 'tutorial' on statetypes/actor behaviour? They're not that hard to grasp once you dig around a little, but they control a large part of the game and could save some new coders (like me) some time. And would allow more TCs to use more interesting enemies instead of the 5 wolfenstein ones available via cutnpaste.

@ronwolf1705: oops, thats what i meant Embarassed
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 01 Apr 2018

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

PostPosted: Wed Dec 20, 2006 10:36 am
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

ronwolf1705 wrote:
::: CODE :::

ob->state=s_boom1;


should be

::: CODE :::

ob->state = &s_boom1;


Though I would use
::: CODE :::
NewState(ob,&s_boom1);

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


Joined: 12 Oct 2004
Last Visit: 07 Jun 2016

Topics: 101
Posts: 1614
Location: A hole in the wall
australia.gif

PostPosted: Wed Dec 20, 2006 2:58 pm
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

the_fish wrote:
Well, working/simple tutorial or not, it still told me where to look to add projectiles to my TC. Didn't see another tutorial on it in the tutorials forum, though i could just have missed it.

Works fine for me, with a bit of improvisation Smile

Maybe I should write a 'tutorial' on statetypes/actor behaviour? They're not that hard to grasp once you dig around a little, but they control a large part of the game and could save some new coders (like me) some time. And would allow more TCs to use more interesting enemies instead of the 5 wolfenstein ones available via cutnpaste.

@ronwolf1705: oops, thats what i meant Embarassed


well, there are always the tutorials to make enemeis share the same statetypes as a memory saver so you can ave more enemies...

_________________
Zombieskittles

Welcome to 2016, where DHW still thinks it is okay to ban the world's most popular email service provider, and I can't have an avatar over 10kb
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 05 Jul 2018

Topics: 87
Posts: 758
Location: Wisconsin
usa.gif

PostPosted: Wed Dec 20, 2006 7:41 pm
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

After all this I got it to work, which I think the_fish got it right, thanks buddy. Now I am trying to finish up the rest of the game.

_________________
I'm back! I missed this community!
Youtube Channel: TreeSapThief

New Site: http://www.treesapthief.com
Twitter: @treesapthief
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 05 Jul 2018

Topics: 87
Posts: 758
Location: Wisconsin
usa.gif

PostPosted: Fri Dec 22, 2006 7:02 pm
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Now, I am trying to set the damage level, I do not understand the math of the ">>5) +40;" part, the only thing i know is, the smaller the number, the more it hurts you. Can someone shed some light on this to help me a bit?

_________________
I'm back! I missed this community!
Youtube Channel: TreeSapThief

New Site: http://www.treesapthief.com
Twitter: @treesapthief
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 14 Jul 2018

Topics: 55
Posts: 2134
Location: Canada
blank.gif

PostPosted: Fri Dec 22, 2006 9:43 pm
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

insurrectionman wrote:
(US_RndT()>>5) +40;

US_RndT() picks a random number from 0 - 255.
">>5" makes it divide by 2 to the power 5, which is 32.
So, US_RndT()>>5 is the same thing as 256/32 options, which is 8.
This means that it generates a random number from 0 to 7.
Offset it by 40, and now it generates a random number from 40 to 47.

insurrectionman wrote:
(US_RndT()>>3) +20;

US_RndT() picks a random number from 0 - 255.
">>3" makes it divide by 2 to the power 3, which is 8.
So, US_RndT()>>3 is the same thing as 256/8 options, which is 32.
This means that it generates a random number from 0 to 31.
Offset it by 20, and now it generates a random number from 20 to 51.

insurrectionman wrote:
US_RndT();

Random number from 0 to 255.

insurrectionman wrote:
US_RndT()%15;

Random number from 0 to 14.

insurrectionman wrote:
(US_RndT()%100) + 50;

Random number from 50 to 149.

etc.

So, for example, if you want something to damage you between 5 and 20 percent, you could do either one of these:

(US_RndT()>>4) + 5
(US_RndT()%16) + 5
(US_RndT()&15) + 5 (yet another fun option for multiples of 2...)

Bet you didn't know Schabbs needles damage you with a random health between 20 and 51 (or 5-12 on easy skill level, since it's another >>2) then, eh? Cheesy Grin

the_fish wrote:
Maybe I should write a 'tutorial' on statetypes/actor behaviour? They're not that hard to grasp once you dig around a little, but they control a large part of the game and could save some new coders (like me) some time. And would allow more TCs to use more interesting enemies instead of the 5 wolfenstein ones available via cutnpaste.

Sounds cool the_fish. I'd enjoy reading it, since it's a pretty interesting topic for me too.

(p.s. Did you know that one shot of tartar sauce in Burger King's BK Fish adds 25 grams of fat? Buying 3 without tartar is less fat than 1 with! Crazy eh?!!)
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 05 Jul 2018

Topics: 87
Posts: 758
Location: Wisconsin
usa.gif

PostPosted: Sun Jan 28, 2007 3:47 pm
   Subject: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

There is still a problem with this tutorial. The projectile fires but always faces east. The original rocket code works, but I must be missing something. Did I code it wrong, or did the tutorial make an error?

_________________
I'm back! I missed this community!
Youtube Channel: TreeSapThief

New Site: http://www.treesapthief.com
Twitter: @treesapthief
the_fish
Bring 'em On
Bring 'em On


Joined: 18 Nov 2006
Last Visit: 07 Nov 2008

Topics: 12
Posts: 133
Location: England
uk.gif

PostPosted: Sun Jan 28, 2007 4:54 pm
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Needs moar 'true'.

Look at the statetypes for your rocket; the first boolean should read 'true' instead of 'false' for each state, and the sprite listed should be the first (towards you) sprite in the VSWAP, with the next 7 being clockwise rotations thereof.

I think this tutorial was for projectiles with no direction, so the boolean would be set to 'false', and only one sprite declared.

If by 'east' you actually mean east instead of just 'left relative to player direction', then it's a more complex problem that shouldn't really be occurring if you've got the same/similar launch and projectile functions (I would guess launch function, compare it with the one above).

_________________
Mostly away: revising for finals (argh!)
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 05 Jul 2018

Topics: 87
Posts: 758
Location: Wisconsin
usa.gif

PostPosted: Sun Jan 28, 2007 4:57 pm
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I faces eastward on mapwise. If you face west <--- the projectile looks like it is straight. But it always fires like this "--->"

_________________
I'm back! I missed this community!
Youtube Channel: TreeSapThief

New Site: http://www.treesapthief.com
Twitter: @treesapthief
the_fish
Bring 'em On
Bring 'em On


Joined: 18 Nov 2006
Last Visit: 07 Nov 2008

Topics: 12
Posts: 133
Location: England
uk.gif

PostPosted: Mon Jan 29, 2007 3:23 am
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Looks like you're not setting the 'new->dir' correctly (or at all) in the launch function.

...because it's not in the code above. Damn you, Deathwish! *shakes fist* Smile

(not that it should have been, really, but anyway...)

try replacing
::: CODE :::
new->dir = nodir;

with
::: CODE :::
new->dir = ob->dir;
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 05 Jul 2018

Topics: 87
Posts: 758
Location: Wisconsin
usa.gif

PostPosted: Mon Jan 29, 2007 2:16 pm
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Okay, this seems to work. But when he shoots --> it is still diagonal at a diagonal 2 or 8 position |_ or _|. If I am facing northeast, northwest, southeast, or southwest it is straight. So basically this projectile now only shoots in standard north, south, east, and west directions. I looked at my T_MissileThrow function, even did a copy paste replica of it, and still it did not do justice. I think there is something I may have missed, that the rocketobj has it working. I have checked my sprites and everything, it is all accurate.

_________________
I'm back! I missed this community!
Youtube Channel: TreeSapThief

New Site: http://www.treesapthief.com
Twitter: @treesapthief
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 05 Jul 2018

Topics: 87
Posts: 758
Location: Wisconsin
usa.gif

PostPosted: Mon Jan 29, 2007 7:27 pm
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I found the problem. So simple, but so missable. In WL_DRAW.C:

In the CalcRotate function:

if (ob->obclass == rocketobj)
angle = viewangle-180)- ob->angle;
else
angle = (viewangle-180)- dirangle[ob->dir];


This is what makes the rocket shoot correctly. There may be #SPEAR code to it, but I have removed all traces of SOD code from my game, to keep it organized and memory (it actually helps). I changed this to a switch case and placed the default as the bottom line.

_________________
I'm back! I missed this community!
Youtube Channel: TreeSapThief

New Site: http://www.treesapthief.com
Twitter: @treesapthief
Zombie_Plan
DieHard Wolfer
DieHard Wolfer


Joined: 12 Oct 2004
Last Visit: 07 Jun 2016

Topics: 101
Posts: 1614
Location: A hole in the wall
australia.gif

PostPosted: Thu Feb 08, 2007 3:47 am
   Subject: Re: [Tutorial] Adding a new projectile
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

There may be #SPEAR code to it, but I have removed all traces of SOD code from my game, to keep it organized and memory (it actually helps). I changed this to a switch case and placed the default as the bottom line.[/quote]

I havent coded for awhile yes, but any code within #ifdef SPEAR when spear is not defined, will NOT be compiled into the exe, so removing it will not save memory.

_________________
Zombieskittles

Welcome to 2016, where DHW still thinks it is okay to ban the world's most popular email service provider, and I can't have an avatar over 10kb
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 9012 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
No new posts [Info] Alarm Sounding in game?? WSJ...??
Author: Guest
7 309 Tue Jun 17, 2003 10:04 pm
Reivax44 View latest post
No new posts [Info] Silent Gun? - Adding a Silencer
Author: Guest
4 194 Fri Apr 18, 2003 8:34 am
BrotherTank View latest post
No new posts [Info] Adding Locked Doors
Author: Guest
3 244 Thu Apr 17, 2003 6:30 am
Ripper 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