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       

Bullet tracing - for SDL!
Page 1 of 2 Goto page 1, 2  Next
DieHard Wolfers Forum Index -> SDL 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
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 1:21 ago.

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

PostPosted: Sun Jul 12, 2009 1:28 am
   Subject: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

That's right, it's my good old DOS bullet tracing code, but I have updated the code to both work properly and be SDL compatible. It should work reasonably quickly, but it could certainly be improved. And don't tell me to just check the actorat table instead of going through the objlist each time - I've tried that and it proved to be quite inaccurate and ineffective (although it did work slightly faster).

Defines -
COLSIZE is the distance from the centre of an enemy that the bullet will collide with that enemy.
STEPDIST is the distance that the bullet moves each step - reducing it will make the collision detection more precise, but it will take longer to compute. For reference, each tile's size is something like 0x8000l.

Variables -
accuracy is the maximum number of degrees that a shot can be off target. Unfortunately, because player->angle is an integer and the sine and cosine tables require an integer index, accuracy must be an integer. I am looking at fixing this, but in the meantime, just use the closest degree that you want. Smile
numshots is the number of shots traced. This is particularly useful for shotguns.

Anyway, in WL_AGENT.CPP, replace your entire GunAttack function with the following:

::: CODE :::

#define COLSIZE 0x4000l
#define STEPDIST 0x800l

void    GunAttack (objtype *ob)
{
    switch (gamestate.weapon)
    {
        case wp_pistol:
            SD_PlaySound (ATKPISTOLSND);
            break;
        case wp_machinegun:
            SD_PlaySound (ATKMACHINEGUNSND);
            break;
        case wp_chaingun:
            SD_PlaySound (ATKGATLINGSND);
            break;
    }

    madenoise = true;

    int32_t         bulletx,bullety;
    short           bangle,damage,accuracy,numshots;
    boolean         hit;
    objtype         *check;

//
// AlumiuN's new weaponry code - trace bullets
//
    switch (gamestate.weapon)
    {
        case wp_pistol: accuracy = 4; numshots = 1; break;
        case wp_machinegun: accuracy = 5; numshots = 1; break;
        case wp_chaingun: accuracy = 9; numshots = 1; break;
    }

    for (int i = 0; i<numshots; i++)
    {
        bulletx = player->x;
        bullety = player->y;
        bangle = player->angle;

        if (accuracy)
        {
            if (US_RndT() > 127)
                bangle -= US_RndT()%(accuracy + 1);
            else
                bangle += US_RndT()%(accuracy + 1);
        }

        hit = false;    // Assume the worst! Oh, and reset the variable. :)

        while(1)
        {
            bulletx += FixedMul(STEPDIST,costable[bangle]);
            bullety -= FixedMul(STEPDIST,sintable[bangle]);

            //
            // check for solid walls
            //
            check = actorat[bulletx >> TILESHIFT][bullety >> TILESHIFT];
            if (check && !ISPOINTER(check) && (uintptr_t)check != 64)
            {
                if ((uintptr_t)check < 128)      // Hit a wall
      {
      // Add any effects that you want to happen when the bullet hits a wall
      }
                else if (doorobjlist[(uintptr_t)check - 128].position < 0xdfff/2)   // Cheap hack - improve later?
      {
      // Add any effects that you want to happen when the bullet hits a door
      }
                hit = true;
            }

            if (hit)
                break;

            check = objlist;
            while (check)
            {
                if (check->flags & FL_SHOOTABLE)
                {
                    if (LABS(bulletx - check->x) < COLSIZE && LABS(bullety - check->y) < COLSIZE)
                    {
                        hit = true;   
                        switch (gamestate.weapon)
                        {
                            case wp_pistol: damage = 10 + US_RndT()%25; break;
                            case wp_machinegun: damage = 8 + US_RndT()%22; break;
                            case wp_chaingun: damage = 6 + US_RndT()%20; break;
                        }
                        DamageActor (check, damage);
                    }
                }
                check = check->next ;
            }

            if (hit)
                break;
        }
    }
}


To add a new weapon to this code, there are several steps to do this (beyond adding the new sprites and sounds). Say that we are going to add a shotgun.

First, add the sound code (in red)-
::: CODE :::

   case wp_chaingun:
            SD_PlaySound (ATKGATLINGSND);
            break;
        case wp_shotgun:
            SD_PlaySound (ATKSHOTGUNSND);
            break;

    }


Next, add the accuracy and number of shots-
::: CODE :::

        case wp_chaingun: accuracy = 9; numshots = 1; break;
        case wp_shotgun: accuracy = 10; numshots = 12; break;
    }


Finally, add the damage code-
::: CODE :::

        case wp_chaingun: damage = 6 + US_RndT()%20; break;
        case wp_shotgun: damage = 2 + US_RndT()%4; break;
    }


Another point to note is that you can add things like sprite effects and sounds to collisions with walls and doors. I'm not going to go into how to create those effects here, but you should be able to figure out how do some cool stuff with it. Smile

EDIT: Fixed the bug that prevented anything with more than one shot from spreading.


Last edited by AlumiuN on Wed Jul 15, 2009 2:53 am; edited 1 time in total
RichterBelmont12
DieHard Wolfer
DieHard Wolfer


Joined: 14 Aug 2004
Last Visit: 13 Sep 2018

Topics: 97
Posts: 1508
Location: New Jersey
usa.gif

PostPosted: Sun Jul 12, 2009 2:50 pm
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I'll try this out

edit: ok One error

wl_agent.cpp: In function `void GunAttack(objtype*)':
wl_agent.cpp:1654: error: 'struct doorobj_t' has no member named 'position'

make.exe: *** [wl_agent.o] Error 1

_________________
http://www.youtube.com/RichterBelmont12

https://www.facebook.com/RichterBelmont123

https://twitter.com/Richterbelmont6
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 31 Aug 2018

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

PostPosted: Sun Jul 12, 2009 3:28 pm
   Subject: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I commented that out, cuz it seemed to me like an added code...

I have used Adam's Blood Splatz tutorial in this, and my bullet puff (like DOOM) is set in the code like so:

::: CODE :::

            //
            // check for solid walls
            //
            check = actorat[bulletx >> TILESHIFT][bullety >> TILESHIFT];
            if (check && !ISPOINTER(check) && (uintptr_t)check != 64)
            {
                if ((uintptr_t)check < 128)      // Hit a wall
            {
            T_BulletPuff (ob);
               // Add any effects that you want to happen when the bullet hits a wall
            }
     //         else if (doorobjlist[(uintptr_t)check - 128].position < 0xdfff/2)   // Cheap hack - improve later?
            {
               // Add any effects that you want to happen when the bullet hits a door
            }
                hit = true;
            }


but the position of the bullet puff is "inside" you. If you shoot while running backwards, you can see it, how can it trace to hit the nearest wall, like a projectile, but it might use the "projectiletrymove" function

using "check" instead of "ob" freezes it up, and it flags the x,y in the function used for the bulletpuff

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

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


Joined: 14 Aug 2004
Last Visit: 13 Sep 2018

Topics: 97
Posts: 1508
Location: New Jersey
usa.gif

PostPosted: Sun Jul 12, 2009 4:32 pm
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

how do you make it soo that you see the puff when it hits the wall

_________________
http://www.youtube.com/RichterBelmont12

https://www.facebook.com/RichterBelmont123

https://twitter.com/Richterbelmont6
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 31 Aug 2018

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

PostPosted: Sun Jul 12, 2009 4:48 pm
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

i'm trying to figure that out right now, I have the function used in Blood Splatz and narrowed it down to the:

newobj->x = ob->x;
newobj->y = ob->y;

and I am trying to use the "ProjectileTryMove" the "//check for solid walls" chunk to try and tell it to find the wall and create its coordinates there, so far i'm unsuccessful, it either freezes or doesn't show at all... or i go back to this and it just shows up exactly where u are standing

_________________
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: 31 Aug 2018

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

PostPosted: Sun Jul 12, 2009 4:59 pm
   Subject: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

How sad of me, less than a minute later I figured it out, okay, here's how I did it, with a nice tutorial included:

Open wl_def.h and add this in the objlist:

::: CODE :::
puffobj


now find:

void A_DeathScream (objtype *ob);

below that add:

void T_BulletPuff (int x,int y,objtype *ob);

Open wl_act2.cpp and add this code, which is my bullet puff code:

::: CODE :::
/*
===================
= Bullet Puff -puffobj
===================
*/
extern   statetype s_puff1;
extern   statetype s_puff2;
extern   statetype s_puff3;
extern   statetype s_puff4;

statetype s_puff1 = {false,SPR_PUFF1,12,NULL,NULL,&s_puff2};
statetype s_puff2 = {false,SPR_PUFF2,12,NULL,NULL,&s_puff3};
statetype s_puff3 = {false,SPR_PUFF3,12,NULL,NULL,&s_puff4};
statetype s_puff4 = {false,SPR_PUFF4,12,NULL,NULL,NULL};

void T_BulletPuff (int x, int y, objtype *ob)
{
   GetNewActor ();
   newobj->state = &s_puff1;
   newobj->ticcount = 1;

   newobj->tilex = ob->tilex;
   newobj->tiley = ob->tiley;
   newobj->x = x;
   newobj->y = y;
   newobj->obclass = puffobj;
   newobj->dir = nodir;
   newobj->angle = north;
   newobj->speed = 0;

   newobj-> flags = FL_NEVERMARK;
   newobj->active = ac_yes;
}


Now in wl_agent.cpp find the GunAttack function and go to this line:
::: CODE :::
            //
            // check for solid walls
            //
            check = actorat[bulletx >> TILESHIFT][bullety >> TILESHIFT];
            if (check && !ISPOINTER(check) && (uintptr_t)check != 64)


now in that if statement where he has all those extra if statements, change it to:

::: CODE :::
 if (check && !ISPOINTER(check) && (uintptr_t)check != 64)
            {
            T_BulletPuff (bulletx,bullety,ob);
                hit = true;
            }


and it works, it will hit the door a little wierd tho, if the door is opening it will hit the open, but I haven't gotten that far with this yet.

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

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


Joined: 14 Aug 2004
Last Visit: 13 Sep 2018

Topics: 97
Posts: 1508
Location: New Jersey
usa.gif

PostPosted: Sun Jul 12, 2009 6:07 pm
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

ok it works but...for the shotgun.....i want it to make it a spread shot.....the shotgun when i shot i see only one puff not 6 or so

ex:

I dont want that..i like it Spread out like a real shotgun will do

_________________
http://www.youtube.com/RichterBelmont12

https://www.facebook.com/RichterBelmont123

https://twitter.com/Richterbelmont6
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 1:21 ago.

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

PostPosted: Mon Jul 13, 2009 1:41 am
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

insurrectionman wrote:
it will hit the door a little wierd tho, if the door is opening it will hit the open, but I haven't gotten that far with this yet.


That's what the position bit was for - the shot will go through if the door is half open. You might have to replace the line:
::: CODE :::
                else if (doorobjlist[(uintptr_t)check - 128].position < 0xdfff/2) 

with:
::: CODE :::
                else if (doorposition[(uintptr_t)check - 128] < 0xdfff/2) 


I can't remember what that table was called in WolfSDL, but in the SonderKommando code, the position was a member of the objlist.

@Richter: Did you remember to change the numshots variable?
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 31 Aug 2018

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

PostPosted: Mon Jul 13, 2009 7:53 am
   Subject: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Yeah, I'll work into that. And the numshots really doesn't do anything, when I tried it, i assume it shot all 6 shots that i put in the code straight... not spread. I don't know if trying to implement the shotgun spray tutorial into this will make it work, I'll play around with it.

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

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


Joined: 14 Aug 2004
Last Visit: 13 Sep 2018

Topics: 97
Posts: 1508
Location: New Jersey
usa.gif

PostPosted: Mon Jul 13, 2009 8:32 am
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

ok i'll be waiting

_________________
http://www.youtube.com/RichterBelmont12

https://www.facebook.com/RichterBelmont123

https://twitter.com/Richterbelmont6
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 31 Aug 2018

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

PostPosted: Mon Jul 13, 2009 5:40 pm
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

well as far as I figured out, the numshots, does NOT spread the shot, I don't know why, workin on it. but i can see the puff ball redrawn several time with my shotgun, and it almost looks like it is coming at you, 3D like. now just have to figure out how to spread the shots and make them visible properly

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

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


Joined: 14 Aug 2004
Last Visit: 13 Sep 2018

Topics: 97
Posts: 1508
Location: New Jersey
usa.gif

PostPosted: Mon Jul 13, 2009 6:28 pm
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Take your time

_________________
http://www.youtube.com/RichterBelmont12

https://www.facebook.com/RichterBelmont123

https://twitter.com/Richterbelmont6
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 1:21 ago.

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

PostPosted: Tue Jul 14, 2009 1:59 am
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Interesting. It is supposed to grab the angle of the bullet again. Although, my bad, it appears that I have made a related error - I'm not resetting bangle to player->angle at the beginning of the for loop. That _may_ have something to do with it, but I don't think so. That would explain why I tried to do it and it failed. Although, it does seem to go through things - maybe we could make a railgun with and accuracy of 0 and a numshots of 100 or something? Very Happy
RichterBelmont12
DieHard Wolfer
DieHard Wolfer


Joined: 14 Aug 2004
Last Visit: 13 Sep 2018

Topics: 97
Posts: 1508
Location: New Jersey
usa.gif

PostPosted: Tue Jul 14, 2009 8:54 am
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

lol that will be cool man

_________________
http://www.youtube.com/RichterBelmont12

https://www.facebook.com/RichterBelmont123

https://twitter.com/Richterbelmont6
TexZK
DieHard SS
DieHard SS


Joined: 07 Feb 2004
Last Visit: 19 Oct 2016

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

PostPosted: Tue Jul 14, 2009 1:30 pm
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

As for spread shot, isn't it possible to make a Quake-like effect by inheriting something from Ripper's snow tutorial?

I mean, when shooting with a shotgun 6 bullets are spread. Imagine they all hit the wall, so they are traced at (x,y) position, and maybe a random z coodinate, resulting each at (x,y,z) position. The modified "snow engine" will draw a puff starting from that position, and maybe raising in next frames ("puffs" flying up). I think this will be WAY better than by using sprites, at least for instant-hit shots. This way, "puffs" are actually "snow flakes" in my proposal, drawn at the correct position if visible (simple depth sorting algorythm needed, maybe generated by the shot tracer).



And, the modified engine might be good to draw a Quake2's railgun-like corkscrew Smile



I don't really know the maths behind the screen positioning in Ripper's snow/rain tutorial - in fact I wasn't able to adapt that code for my zooming tutorial (and floor/ceiling features aren't fixed, too) Sad
So, I must ask help from those who have played on that code longer/better than me, since I haven't coded for such Wolf3D features for a loooong time (and I still don't, due to free time constraints).



FYI: With a complete Object-Oriented source code (Java, C#, even C++ if you're patient enough in re-inventing the wheel Very Happy ) such a tracer can be done in a few lines of code. I hope we'll move to such an architecture in the future. I was thinking about Java & LWJGL, since it's a nice binomial (just like C++ & SDL for us currently). But, these are just my 2 €cents...
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 1:21 ago.

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

PostPosted: Wed Jul 15, 2009 2:50 am
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

@Everyone: Whoops, my bad. I forgot to reset the shot after the loop. Basically, it fires a second bullet from the original bullet's position, modifying that bullets heading, instead of resetting it to the player. I'll update the tutorial, but basically, you just need to move the section:
::: CODE :::

    bulletx = player->x;
    bullety = player->y;
    bangle = player->angle;

inside the for statement at the very beginning. Smile

@Tex: I had that idea too, and it's certainly possible, although I fail at understanding Ripper's crazy two-letter variables. :p
TexZK
DieHard SS
DieHard SS


Joined: 07 Feb 2004
Last Visit: 19 Oct 2016

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

PostPosted: Wed Jul 15, 2009 3:30 am
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

AlumiuN wrote:
accuracy is the maximum number of degrees that a shot can be off target. Unfortunately, because player->angle is an integer and the sine and cosine tables require an integer index, accuracy must be an integer. I am looking at fixing this, but in the meantime, just use the closest degree that you want. Smile

I had written a simple tutorial about having ANGLES = FINEANGLES = 3600 time ago, but I deleted it from the hard disk, and so I haven't posted it on the forum yet. This way you'll obviously have a 0.1° precision instead of 1°, and also makes mouse turning WAAAAAY smoother than now!

That's a bare substitution, but not all the code is using ANGLES, writing 360 and its "magic numbers" (as programmers call them, you know) instead. With VisualStudio it's possible to find all occurrences in the whole workspace, then replacing them in each touched file.
Beware of substituting also the victory tile spin constants Smile

Oh, and you can completely erase the fineangles[] array and such crap by using an unified angles lookup table, and maybe increase subdivisions from 3600 to 36000. The raycaster will surely get some improvements with that, especially for zooming and tight wall projection angles - plus, who cares if we're using about 200KB instead of 20KB... we're not on DOS anymore Very Happy
The only problem would be fixing short integers with long integers in angles computations, if there are any.

In conclusion, with ANGLES = 3600 everything is ok even for DOS (and uses less memory by erasing fineangles[]!), while with 36000 some fixes might be needed.


AlumiuN wrote:
@Tex: I had that idea too, and it's certainly possible, although I fail at understanding Ripper's crazy two-letter variables. :p

D'oh! We're two! Confused Shocked
RichterBelmont12
DieHard Wolfer
DieHard Wolfer


Joined: 14 Aug 2004
Last Visit: 13 Sep 2018

Topics: 97
Posts: 1508
Location: New Jersey
usa.gif

PostPosted: Wed Jul 15, 2009 8:32 am
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

AlumiuN wrote:
@Everyone: Whoops, my bad. I forgot to reset the shot after the loop. Basically, it fires a second bullet from the original bullet's position, modifying that bullets heading, instead of resetting it to the player. I'll update the tutorial, but basically, you just need to move the section:
::: CODE :::

    bulletx = player->x;
    bullety = player->y;
    bangle = player->angle;

inside the for statement at the very beginning. Smile

@Tex: I had that idea too, and it's certainly possible, although I fail at understanding Ripper's crazy two-letter variables. :p


about this

::: CODE :::

    bulletx = player->x;
    bullety = player->y;
    bangle = player->angle;


where do you put it?

_________________
http://www.youtube.com/RichterBelmont12

https://www.facebook.com/RichterBelmont123

https://twitter.com/Richterbelmont6
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 31 Aug 2018

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

PostPosted: Wed Jul 15, 2009 8:38 am
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

right after the

for (int i = 0; i<numshots; i++)
{

he shows it up there

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

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


Joined: 14 Aug 2004
Last Visit: 13 Sep 2018

Topics: 97
Posts: 1508
Location: New Jersey
usa.gif

PostPosted: Wed Jul 15, 2009 9:22 am
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

O_O...ohhhh nvm then

_________________
http://www.youtube.com/RichterBelmont12

https://www.facebook.com/RichterBelmont123

https://twitter.com/Richterbelmont6
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 31 Aug 2018

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

PostPosted: Wed Jul 15, 2009 5:31 pm
   Subject: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Here ya go, shotgun spray at its work:





Also a sneak peak at my DOOM: Legions Revisited mod

OT- the numbers on the bottom are my testing of the "typed cheat codes" i am trying to work on, once I get it 100% i'll post a tutorial on it, right now, i don't have much luck towards it

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

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


Joined: 14 Aug 2004
Last Visit: 13 Sep 2018

Topics: 97
Posts: 1508
Location: New Jersey
usa.gif

PostPosted: Wed Jul 15, 2009 6:25 pm
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Look awsome..Love to beta test it like i did with your last mod

_________________
http://www.youtube.com/RichterBelmont12

https://www.facebook.com/RichterBelmont123

https://twitter.com/Richterbelmont6
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 31 Aug 2018

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

PostPosted: Wed Jul 15, 2009 6:59 pm
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Its running a lot better than that first one i assure you that much

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

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


Joined: 14 Aug 2004
Last Visit: 13 Sep 2018

Topics: 97
Posts: 1508
Location: New Jersey
usa.gif

PostPosted: Wed Jul 15, 2009 7:07 pm
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

ya cause its on a SDL format

_________________
http://www.youtube.com/RichterBelmont12

https://www.facebook.com/RichterBelmont123

https://twitter.com/Richterbelmont6
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 1:21 ago.

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

PostPosted: Thu Jul 16, 2009 2:10 am
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

TexZK wrote:
AlumiuN wrote:
accuracy is the maximum number of degrees that a shot can be off target. Unfortunately, because player->angle is an integer and the sine and cosine tables require an integer index, accuracy must be an integer. I am looking at fixing this, but in the meantime, just use the closest degree that you want. Smile

I had written a simple tutorial about having ANGLES = FINEANGLES = 3600 time ago, but I deleted it from the hard disk, and so I haven't posted it on the forum yet. This way you'll obviously have a 0.1° precision instead of 1°, and also makes mouse turning WAAAAAY smoother than now!

That's a bare substitution, but not all the code is using ANGLES, writing 360 and its "magic numbers" (as programmers call them, you know) instead. With VisualStudio it's possible to find all occurrences in the whole workspace, then replacing them in each touched file.
Beware of substituting also the victory tile spin constants Smile

Oh, and you can completely erase the fineangles[] array and such crap by using an unified angles lookup table, and maybe increase subdivisions from 3600 to 36000. The raycaster will surely get some improvements with that, especially for zooming and tight wall projection angles - plus, who cares if we're using about 200KB instead of 20KB... we're not on DOS anymore Very Happy
The only problem would be fixing short integers with long integers in angles computations, if there are any.

In conclusion, with ANGLES = 3600 everything is ok even for DOS (and uses less memory by erasing fineangles[]!), while with 36000 some fixes might be needed.


Time to use a Find in Files and make everything ANGLES-dependant, then? Smile

EDIT: @Insurrectionman: Looking nice. How many shots are you using, it looks like you could increase them. Smile Also, with your typed cheat codes, try iterating through the letters. If there's only one pressed add it to a buffer and check the whole buffer against a code. If the part in the buffer is not the same as the beginning section of equal length of any of the cheats, discard it and start again. I'll take a look at it tomorrow morning if I can drag myself away for UFO: Enemy Unknown. Razz Smile
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 31 Aug 2018

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

PostPosted: Thu Jul 16, 2009 9:07 am
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

i have... 7 on the shotgun, and 20 on the double barrel, and they seem to be okay, i can tweak around with it, adjust everything better, but not atm, that is on my last todo list

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

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


Joined: 29 Nov 2007
Last Visit: 1:21 ago.

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

PostPosted: Fri Jul 17, 2009 3:58 pm
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Hehe, I used 36 for a double-barreled shotgun. :p
RichterBelmont12
DieHard Wolfer
DieHard Wolfer


Joined: 14 Aug 2004
Last Visit: 13 Sep 2018

Topics: 97
Posts: 1508
Location: New Jersey
usa.gif

PostPosted: Fri Jul 17, 2009 4:49 pm
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Overkill O_O lol

_________________
http://www.youtube.com/RichterBelmont12

https://www.facebook.com/RichterBelmont123

https://twitter.com/Richterbelmont6
RichterBelmont12
DieHard Wolfer
DieHard Wolfer


Joined: 14 Aug 2004
Last Visit: 13 Sep 2018

Topics: 97
Posts: 1508
Location: New Jersey
usa.gif

PostPosted: Wed Sep 23, 2009 11:36 pm
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

ooh one question for the shotgun spry...when you shot the shotgun the bullet Tracing goes in a Straight line I know that because its using the X and Y Axis ...is it possible to make them Scatter..i mean Really Scatter Like the Double Barreled Shotgun from Doom 2 or simple uses the X, Y, And Z Axis

_________________
http://www.youtube.com/RichterBelmont12

https://www.facebook.com/RichterBelmont123

https://twitter.com/Richterbelmont6
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 Sep 24, 2009 1:55 am
   Subject: Re: Bullet tracing - for SDL!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Yes, it is possible! Just increase the Z coordinate, and perhaps turn the smoke darker (as I can see in Doom 2 videos).

What I miss is how to learn anything from Ripper's snow code. There are some things which don't work togther with FOCALLLENGTH, so I cannot adapt that code (and floor/ceiling rendering too) to my zoom tutorial Sad
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> SDL Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 2 Goto page 1, 2  Next
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts Sticky: [Tutorial] Compiling Wolf4SDL with Code::Blocks
Author: dcbasic
90 24559 Wed May 24, 2017 7:53 pm
Falcon*93 View latest post
No new posts [help] Adding teleporters in wolf4sdl
Author: Mortimer
35 10853 Fri May 26, 2017 8:19 am
Military View latest post
No new posts [WOLF4SDL Help] Blake Stone Style doors
Author: Haasboy
3 2998 Sun Jul 20, 2008 7:56 am
Haasboy View latest post
No new posts [Help] Problem with Checkweaponchange function (wolf4sdl)
Author: Mortimer
4 3204 Sat May 17, 2008 11:26 am
Mortimer View latest post
No new posts [SDL] Apply 2nd ScaleFactor to selected (hi-res) vga gfx
Author: Andy_Nonymous
9 4478 Sun Apr 27, 2008 2:30 am
AlumiuN 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