Jump to content
The Dark Mod Forums
Sign in to follow this  

Doom 3 mod code help

Recommended Posts

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.



The crosshair is handled in the player cursor.cpp

Share this post

Link to post
Share on other sites

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.

Share this post

Link to post
Share on other sites

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

Amnesty for Bikerdude!

Share this post

Link to post
Share on other sites

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!

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...