Author Topic: How to implement weapon toggle  (Read 1395 times)

0 Members and 1 Guest are viewing this topic.

gameragodzilla

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
  • Doom Newbie
    • View Profile
How to implement weapon toggle
« on: March 11, 2016, 10:42:42 PM »
Hi guys, I'm new here so if this is in the wrong section I apologize.

Now I've been trying to port the RoE Double Barrel Shotgun into Doom 3. I managed to find a mod that works (it's a relatively old one made by someone named Pitt), I managed to get it compatible with the Phrozo particle effects mod that I liked, and I managed to get it to spawn into the maps so it's a natural part of the campaign rather than needing to pull down the console and spawn it. I managed to get everything I want working except for the weapon toggle. Basically, the way RoE handled the DB Shotgun was that you alternated between it and the normal shotgun while pressing 3 and I want to make it work here as well, but for the love of me I can't get it to work. So as a result, I'm just stuck needing to scroll to it rather than actually being able to just select it as normal.

Here's what I have so far: https://www.dropbox.com/sh/fgpscg3h39yvqfg/AAAfhwCuJEnqqcPJgtk0I5L6a?dl=0

Now there were mods out there that managed to get weapon toggle working, but every time I tried using that code, it glitches up and just pushes the DB Shotgun into the 4 key rather than alternating on the 3 key, and everything else is pushed up as well (Machinegun at 5 instead of 4, Chaingun at 6 instead of 5 etc.)

So can anyone help? I've been trying to get this working for a while now and asked around until I found this forum that seems to be populated by experts on the topic. Thanks in advance.

EDIT: Seems to be related to the gamex86.dll (though to people familiar with this, it was probably already obvious). I have no idea how to properly edit that file for my purposes. Any help?

EDIT 2: Okay here's the source code for a mod that has weapon toggle. It has a bunch of other stuff that I don't want, though, like gameplay and graphical tweaks, so I just want to have the weapon toggle: http://www.moddb.com/mods/dentons-enhanced-doom3-v202/downloads/dentons-enhanced-doom3-v202-source-code

Unfortunately, I don't have any programs that can actually modify and compile the code, so is there anyone who can point me to the right direction? Thanks.
« Last Edit: March 12, 2016, 11:21:23 PM by gameragodzilla »

gameragodzilla

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
  • Doom Newbie
    • View Profile
Re: How to implement weapon toggle
« Reply #1 on: March 13, 2016, 06:11:24 AM »
Dunno the policy on double posting here, but I'm trying to use Visual Studio to screw around with the source code for the Denton mod that implemented weapon toggle and I'm getting a bunch of errors.

Here's what I'm getting: http://imgur.com/drT4rmL

I downloaded the full Doom 3 SDK and the only thing I modified was using the player.cpp and player.h files from the Denton mod, because player.cpp is where the weapon toggle stuff is implemented, and I'm getting errors in the Simd.cpp files and something about "The command ".\TypeInfo\typeinfo.exe :VCEnd" exited with code 3." which appears multiple times.

Anyone know how to help? I'm a total noob at this.

Here's the Denton mod source code I'm using btw: http://www.moddb.com/mods/dentons-enhanced-doom3-v202/downloads/dentons-enhanced-doom3-v202-source-code

I'm JUST trying to get weapon toggle. None of the other stuff like bloom or gameplay changes or whatever.

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 851
  • Karma: +41/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: How to implement weapon toggle
« Reply #2 on: March 13, 2016, 08:29:29 AM »
You're using MSVC Community 2015?  I had the same issues, I had to install 2013 to get it to work.  This thread has Community 2013 compile ready D3 GPL (engine + dll) code: http://idtechforums.fuzzylogicinc.com/index.php?topic=380.0

2015 removed/optimized some headers that D3 needed and I don't know enough to fix issues like that.

BielBdeLuna

  • Full Member
  • ***
  • Posts: 242
  • Karma: +8/-20
  • Doom Newbie
    • View Profile
    • my Github repositories
Re: How to implement weapon toggle
« Reply #3 on: March 13, 2016, 10:44:04 AM »
IIRC all the code was in the player.cpp of D3XP
you need to implement a change of the token read in the player.def (take a look in the d3xp player def, you'll see that the toggle system is added via a special token)

gameragodzilla

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
  • Doom Newbie
    • View Profile
Re: How to implement weapon toggle
« Reply #4 on: March 13, 2016, 12:58:31 PM »
You're using MSVC Community 2015?  I had the same issues, I had to install 2013 to get it to work.  This thread has Community 2013 compile ready D3 GPL (engine + dll) code: http://idtechforums.fuzzylogicinc.com/index.php?topic=380.0

2015 removed/optimized some headers that D3 needed and I don't know enough to fix issues like that.

Huh, okay then. I'll try to look at the 2013 one and see how well it works. Thank you.

EDIT: It gives me less errors, but it's still giving me errors. And I'm using the Community 2013 version.

http://imgur.com/XUv7aUz

Did I do something wrong with the uninstallation? I just uninstalled the Visual Studio 2015 stuff. Did I need to uninstall anything else?
« Last Edit: March 13, 2016, 02:58:15 PM by gameragodzilla »

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 851
  • Karma: +41/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: How to implement weapon toggle
« Reply #5 on: March 13, 2016, 04:10:47 PM »
I left 2015 installed as I have some projects for that.

The first error means it's missing a needed library.  When I installed 2013 I installed the 8.1 SDK (an option when you install, or can install by running the installer again).  Once that's done then 2nd error should disappear.  I checked and that lib is included with my 8.1 SDK.

You need the DX SDK too.  Once you install that you'll need to June 2010 one (I think it's the last).  Check out here for the paths you'll need to setup & how to do it (might already be done in the project file I zipped): http://www.moddb.com/company/apgsoftware/tutorials/how-to-compile-doom-3-with-visual-studio-2010.

gameragodzilla

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
  • Doom Newbie
    • View Profile
Re: How to implement weapon toggle
« Reply #6 on: March 13, 2016, 04:20:57 PM »
https://dev.windows.com/en-us/downloads/windows-8-1-sdk

Is this the 8.1 SDK (sorry, I'm a total coding noob)?

Also, I looked at the ModDB instructions and it's a bit hard to follow for me.

Thanks for helping me, btw.

EDIT: I installed the SDK and the same errors remain. Do I need to do something in Visual Studio to get it working?
« Last Edit: March 13, 2016, 04:41:37 PM by gameragodzilla »

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 851
  • Karma: +41/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: How to implement weapon toggle
« Reply #7 on: March 13, 2016, 04:52:25 PM »
This is the DX one: https://www.microsoft.com/en-us/download/details.aspx?id=6812

The one included with the Windows 8.1 SDK doesn't have the stuff needed for D3 GPL to compile. This is the part of the moddb tutorial that's needed to get the SDK working:
Quote
Go to DoomDLL Project -> right click -> Properties -> VC++ Directories -> left click over “Includes Directories” combobox and left click, , and paste ALL the address were yo have instaled the DXSDK (e.g. “C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include”), repeat for the “Library Directories” (e.g. C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86).REMEBER!!!, even you have windows 7 64 bits, everything should be 32 bits based code.


gameragodzilla

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
  • Doom Newbie
    • View Profile
Re: How to implement weapon toggle
« Reply #8 on: March 13, 2016, 04:58:16 PM »
This is the DX one: https://www.microsoft.com/en-us/download/details.aspx?id=6812

The one included with the Windows 8.1 SDK doesn't have the stuff needed for D3 GPL to compile. This is the part of the moddb tutorial that's needed to get the SDK working:
Quote
Go to DoomDLL Project -> right click -> Properties -> VC++ Directories -> left click over “Includes Directories” combobox and left click, , and paste ALL the address were yo have instaled the DXSDK (e.g. “C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include”), repeat for the “Library Directories” (e.g. C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86).REMEBER!!!, even you have windows 7 64 bits, everything should be 32 bits based code.

That bit of instruction is what I didn't really understand. Do I have to copy the address from Windows Explorer and paste it in there or something? I wasn't really sure what I was supposed to do there.

EDIT: Nevermind, I'm an idiot. Just didn't read properly.

EDIT 2: And I got like 300 errors after I changed those addresses. :\

I'm getting those "Cannot open include file: ‘afxwin.h'" errors, but I can't seem to get them to disappear despite following the instructions there. Then again, I'm not using Visual Studio 2010, so I didn't really know where exactly to put the folder.

EDIT 3: Here are the Player files that I think should get weapon toggle to work. Can you compile it on your system since mine's clearly not working and then give me the gamex86.dll and binary.conf files? Thanks.
« Last Edit: March 13, 2016, 06:50:06 PM by gameragodzilla »

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 851
  • Karma: +41/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: How to implement weapon toggle
« Reply #9 on: March 13, 2016, 09:17:13 PM »
Here's the dll.

Can you paste the text of the errors?  Use the [ code ] bracket things for easier reading.

gameragodzilla

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
  • Doom Newbie
    • View Profile
Re: How to implement weapon toggle
« Reply #10 on: March 13, 2016, 09:31:47 PM »
Here's the dll.

Can you paste the text of the errors?  Use the [ code ] bracket things for easier reading.

http://imgur.com/XDnWDOu

Well here are the errors displayed. Everything after the first few is the repeat of the same error. It was apparently anticipated in the guide you gave me but I can't seem to get it to leave.

THANK YOU for the gamex86.dll though. I'll try to see if it works.

EDIT: Argh, it doesn't seem to be working. Do you know why? I even flat out replaced the standard gamex86.dll in the base folder and it still isn't working. Is there something wrong with my Player code? I copied weapon toggle from the Denton mod.

EDIT 2: NEVERMIND, I GOT IT WORKING. Apparently, putting the modified gamex86.dll into the DentonDll.pk4 file worked. Don't know why, but it did. THANKS A LOT FOR THE HELP!

EDIT 3: Okay, weird bug. The weapon toggle works perfectly, but for some reason pressing the PDA Tab just keeps selecting the PDA instead of actually switching between it and the previous weapon. I think something might've glitched up with the modified weapon positioning. You know what's going on?

The flashlight, which is also supposed to cycle between it and the previous weapon, works perfectly fine, but the PDA is glitching up for some reason. Is it because it's at weapon13 in my code? If it is, why is it screwing up now?

EDIT 4: Another minor point seems to be the DB Shotgun and normal Shotgun don't have exact ammo pools. Like the ammo left in the the normal shotgun is counted as the reserve of the DB Shotgun. Also, I'm not sure if the DB Shotgun is actually a proper separate weapon as I seem to spawn into the maps with it already equipped when I load a save, though I haven't played from the beginning of the campaign to fully test it yet.

EDIT 5: The unmodified DLL from the Denton mod doesn't have the glitched up PDA, so there's something in the Denton mod source code that also keeps it from glitching up. I have no idea where it is, though. Not only that, but the separate ammo reserves are also not present. The main issue with that is that it still has a bunch of other gameplay and graphical tweaks that I'm not fond of, hence why I'm trying to create my own custom stuff.

EDIT 6: Might have something to do with the Weapon.cpp in conjunction with Player.cpp. Here are the files that need to be replaced in the Game folder. Still can't get my own Visual Studio to work so can you help me out on this again?
« Last Edit: March 13, 2016, 10:57:19 PM by gameragodzilla »

gameragodzilla

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
  • Doom Newbie
    • View Profile
Re: How to implement weapon toggle
« Reply #11 on: March 14, 2016, 10:23:23 PM »
Is the Doom 3 SDK possible to compile without Visual Studio?

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 851
  • Karma: +41/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: How to implement weapon toggle
« Reply #12 on: March 15, 2016, 07:35:22 AM »
Yes, but if you're not a coder it's a lot harder to get working then MSVC.  It's got to be something simple that needs to be installed/referenced.

Under Project - Properties Config Properties - VC++ directories, find Include Directories & Library Directories and paste those listings here & I can compare them to mine.

gameragodzilla

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
  • Doom Newbie
    • View Profile
Re: How to implement weapon toggle
« Reply #13 on: March 15, 2016, 01:33:57 PM »
Yes, but if you're not a coder it's a lot harder to get working then MSVC.  It's got to be something simple that needs to be installed/referenced.

Under Project - Properties Config Properties - VC++ directories, find Include Directories & Library Directories and paste those listings here & I can compare them to mine.

Thanks for the files. I'll test it to see if it works.

Here's the directories I have.

EDIT: Okay, this method solved the separate ammo pools for the shotgun issue, but the PDA problem persists. You know where PDA code is in the Denton mod? Denton mod source code is here: http://www.moddb.com/mods/dentons-enhanced-doom3-v202/downloads/dentons-enhanced-doom3-v202-source-code

I'm basically trying to pull the specific code regarding the shotgun from the Denton mod while leaving all the other stuff behind. Thanks.
« Last Edit: March 15, 2016, 01:52:28 PM by gameragodzilla »

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 851
  • Karma: +41/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: How to implement weapon toggle
« Reply #14 on: March 15, 2016, 02:01:20 PM »
I need you to click on those fields in that dialog box so it shows the entire path name for everything, please.