News:

One Minute Game Review by The Happy Friar: https://ugetube.com/@OneMinteGameReviews
Also on Rumble: https://rumble.com/c/c-1115371

idTech 4 (aka Doom 3 tech) Discord Server! https://discord.gg/9wtCGHa

Main Menu

Switching Artifact weapon ammo

Started by General_101, February 27, 2017, 03:34:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

General_101

I'm quite new to the Doom 3 modding scene and have for the most part just been messing around with stuff on ROE. I've been wanting to switch the type of ammo the Artifact uses from ammo_bloodstone to ammo_souls to make the artifact usable on some custom maps for ROE. While it does now use soul ammo there seems to be no way to gather soul ammo as killing enemies does not charge the Artifact. I was wondering if anyone knew what I would have to change in order to fix this? Will I have to compile a modified gamex86.dll or can this be fixed by messing with script and def files?

General_101

Not sure how dead this forum is but I'm still hoping for some help tbh. I was looking around and decieded to take a closer look at the source code found this.

/*
=============
idPlayer::AddAIKill
=============
*/
void idPlayer::AddAIKill( void ) {

#ifndef _D3XP

int max_souls;
int ammo_souls;

if ( ( weapon_soulcube < 0 ) || ( inventory.weapons & ( 1 << weapon_soulcube ) ) == 0 ) {
return;
}

assert( hud );


ammo_souls = idWeapon::GetAmmoNumForName( "ammo_souls" );
max_souls = inventory.MaxAmmoForAmmoClass( this, "ammo_souls" );
if ( inventory.ammo[ ammo_souls ] < max_souls ) {
inventory.ammo[ ammo_souls ]++;
if ( inventory.ammo[ ammo_souls ] >= max_souls ) {
hud->HandleNamedEvent( "soulCubeReady" );
StartSound( "snd_soulcube_ready", SND_CHANNEL_ANY, 0, false, NULL );
}
}
#endif
}


I'm assuming this is what actually gives the player ammo when he gets a kill. Only difference is the ifndef_D3XP and endif between ROE and Doom 3. I'm not 100% on what those lines do so if anyone with knowledge could shed some light I would be very grateful.

argoon

#2
Yes unfortunately this forum is not very lively, you could also go to the Dark Mod forum and ask there as well, they use idtech 4, even if a modified version but i'm sure they could help.

About what you asked, that code from my limited c++ Knowledge, seams to detect when the player gains souls and then updates the item number on the the player inventory and screen HUD, if the item (souls) number reaches the max number then it plays the "use me!" sound,  the sound shader is called "snd_soulcube_ready".

Hope this was of any help.

p.s - That code expects that the weapon using the ammo_souls is the weapon_soulcube if not it does nothing.

if ( ( weapon_soulcube < 0 ) || ( inventory.weapons & ( 1 << weapon_soulcube ) ) == 0 ) {
return;
}

   

Also this tutorial could help

https://web.archive.org/web/20100522163257/http://www.doom3world.org/phpbb2/viewtopic.php?t=214

The Happy Friar

the "ifndef_D3XP" means that it only runs if it's NOT using the Doom 3 expansion (which is defined somewhere in code, see here: http://www.cprogramming.com/reference/preprocessor/ifndef.html ).  I'm not a good/great programmer, but seems kinda sill to me to have that in the RoE dll as you're already running it.  :)

Commenting out the code argoon said might do it.  Worth a shot.  Then it could be everything a player kills adds souls, which might be against what you're wanting.  Would be super easy to get souls then.  :)

General_101

#4
Yea, I looked into it and that was what seemed to be going out. The code that seemed to actually run the Soul cube logic was actually grayed out in Visual Studio until I removed those lines so I'm assuming just removing those lines should do the trick.

Looking into compiling a DLL for ROE but I just keep getting errors for whatever reason that causes game-d3xp to fail. Something about Win_input having syntax errors and things in constant? Thanks for the explanations anyway.

This is what I am following so I'm not sure what I'm doing wrong?
https://www.katsbits.com/smforum/index.php?topic=896.0

Edit:
So I managed to get what I assume to be the DLL for ROE but I had issues. At first I couldn't compile game-d3xp because script_compiler.cpp would have an error about const char. I just replaced script_compiler.cpp and script_compiler.h with the  ones from the regular Doom 3 since game was compiling fine and there was little difference between them from what I saw? DoomDLL fails because of win_input for whatever reason but it doesn't seem important because all I want is to modify the gamex86.dll so whatever I guess. After this I can compile everything except DoomDLL and MayaImport which fail. While Maya fails because it seems to be that it can't find Maya I don't know how I would go about fixing DoomDLL. I get about 36 errors from it all about Win_input.cpp.

After that I tested them by removing the DLL and gamexx.pk4s that come with the base game and used the ones I made and everything seemed to work fine from my 20 min testing. I'm confused though because I know I'm probably messing up a lot but the DLL file sizes are almost double the size of the originals. I'm not sure if this is how it is supposed to go down but my ROE DLL is 3.99 MB while the original is around 2.44 MB

After making sure the DLLs actually worked I edited the code to comment out the #ifndef #endif and added the Soulcube to the player.def hoping that would do it. I still don't seem to get souls from enemies after killing them for whatever reason. I'm probably going to see about changing the weapon it needs to be the Bloodstone, change what the Bloodstone needs and defines as ammo, and hope that it works then.

Even if I fix this I need to make this compatible with Sikkmod 1.1 for ROE because I plan on using that and it also makes DLL modifications. Problem is though I'm not sure how to compile it and when I tried all I get are errors related to player.obj.

I might take that suggestion at this point and hit up The Dark Mod forums for help with this. I keep running into brick walls and I'm not smart enough to figure this out on my own. All I wanted is to have the Bloodstone be usable in custom maps by having it use ammo_souls. I'm guessing I'm going to have to add this to the list of stupid things I spend a ton of time on.