Jump to content


Photo

Doom 3 mod code help


  • Please log in to reply
3 replies to this topic

#1 ReViliTy

ReViliTy

    Member

  • Member
  • PipPip
  • 17 posts

Posted 23 August 2018 - 09:17 PM

Been scouring the net for an active community for doom3 and this was the most active outside of github source codes... so I figured it might be worth a shot.

Looking to see if there is anyone who can give me a hand fixing up the thirdperson cross hair for Doom 3 Ruiner. There are 2 bugs in it. I'm hoping to get a fix included for the upcoming, and long overdue, patch for the mod. This is probably the biggest bug in the mod.

The first bug is from the trace line made to determine the cross hair's position. When playing the mod, type g_debugweapon 1 in the console to show the line used to determine the position and also for the melee combat related additions. When something gets in the way of the line, the cross hair won't update. This is easily duplicated by standing next to a wall or door way and just shooting. I have a hunch the issue is mainly caused by the shoulder camera offsetting the camera. Maybe being able to offset the origin of the line to the right would help?

The other bug deals with launching projectiles from the barrel. When set to 1, the cross hair is always off. to counter act it an offset can be set in the cursor.gui It works alright, but will still be off when looking too high or low because of the weapons barrel position. The only thing I can think of is maybe a flag in the projectiles fired to aim towards it... which could look wierd unless the crosshair position is offset right in the cursor.gui.

Any help would be really appreciated!

We uploaded the source code for the mods years ago on the mod db.
https://www.moddb.co...-2-source-codes

The crosshair is handled in the player cursor.cpp

#2 stgatilov

stgatilov

    Lead Programmer

  • Active Developer
  • PipPipPip
  • 1123 posts

Posted 27 August 2018 - 10:37 PM

It is not easy to build and run your code, because it needs some assets (I guess D3 assets), which e.g. I don't have.

So debugging this requires would considerable effort from TDM coders.

Maybe videos with the problem will help a bit.

 

 

Looking at the sources, I have not found where crosshair is computed.

I see tracer.h/cpp which seems to be used to draw projectile paths. Also I found some relevant code in idWeapon::Event_LaunchProjectiles.

 

In projectile launching code I see:

idVec3 view_pos = playerViewOrigin + playerViewAxis[ 0 ] * 2.0f; // Muzzle pos for translation clip model only-- For barrel Launched projectiles
...
if ( barrelLaunch || tracer || beam ) { // Do not execute this part unless projectile is barrel launched or has a tracer effect.
    gameLocal.clip.Translation( tr, view_pos, view_pos + dir * 4096.0f, NULL, mat3_identity, MASK_SHOT_RENDERMODEL, owner );

It looks like this trace is always launched from view position.

 

There is some code to correct it later:

idVec3 &launch_pos = view_pos;
...
if ( barrelLaunch ){
    launch_pos = muzzle_pos; 
}

But it seems to happen after the first code segment, so probably it does not have effect.

 

Anyway, it would be great to know where crosshair is computed.



#3 duzenko

duzenko

    Advanced Member

  • Active Developer
  • PipPipPip
  • 1810 posts

Posted 28 August 2018 - 03:46 AM

I for one agree that without D3 assets it's just a guess game and who on this forum has those?



#4 ReViliTy

ReViliTy

    Member

  • Member
  • PipPip
  • 17 posts

Posted 28 August 2018 - 09:14 AM

Yes the mod requires doom3 to run. I completely understand not having d3 installed since you guys are standalone. If its a hassle dont worry about as I wouldnt want to hold you guys up any. I do appreciate the effort looking into it. cross hair stuff is located in the playercursor.cpp file

Since posting this topic; a port to dhewm has started. So maybe itll get tackled during or afterwards with a cleaner code on hand. Once again thanks for the look!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users