Trouble With Malorite's Opposing Force Source Code Created 5 years ago2019-01-05 16:11:28 UTC by TranshumanShephard TranshumanShephard

Created 5 years ago2019-01-05 16:11:28 UTC by TranshumanShephard TranshumanShephard

Posted 5 years ago2019-01-05 16:11:28 UTC Post #341553
Hi. I'm new to your site, and I registered for TWHL so that I may seek out helpful information from any of the best and most brilliant modders of Half-Life. It's a compliment, I mean every word. Originally, I was trying to get helpful information from Steam forums; but no one seemed to have helped nor want to help me in any way.

Anyway, down to the point. I found this source code from something or someone called Malorite. Supposedly, someone recreated source code projects for Blue Shift and Opposing Force. Here's the link for the one to Opposing Force:

https://github.com/malortie/halflife/tree/branch-malortie-op4

The code for Opposing Force is in the folder titled "gearbox", and there are files in the "projects" folder called "gearbox_cdll" and "gearbox_dll". I decided that I want to use this source code instead of the other one in Github called Opposing Force Rebuilded, because that one appears to be incomplete. However, I am getting a lot of errors while trying to build and compile the code through Visual Studio 2017; and I think I know why. When you open the two project files I mentioned, you'll see that the .h and .cpp files are out of whack. The project files themselves were poorly made; and the source code, which is unedited by the way, keeps getting errors. Was this source code not finished as well?

I'm going to say the same thing that I said to the boys and gals in Steam forums. No, I do not want to copy and paste the opfor.dll file from Opposing Force to make my mod. I want to start with a template source code and add a few extra things.

If anyone has used the Malorite source code for Opposing Force for their mods, how did you bypass all of the errors and mishaps?
Posted 5 years ago2019-01-05 18:10:36 UTC Post #341554
What exact error messages are you getting? You could try Visual Studio 2010 Express if it won't compile on VS 2017's toolset.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 5 years ago2019-01-05 18:28:27 UTC Post #341557
I've never used it before, but after checking the source code i've found 2 problems:
  • The projects were never updated for V2017 so it has the "'abs': ambiguous call to overloaded function" errors
  • The last commit in the op4 branch restructured the folders without updating the project files
To fix this you can just open the vcxproj and filters files and manually change the paths so that each one points to the "gearbox" directory:
<ClCompile Include="..\..\dlls\aflock.cpp" />

becomes:

<ClCompile Include="..\..\gearbox\dlls\aflock.cpp" />

The same goes for ClInclude elements.

Both the gearbox_dll and gearbox_cldll projects need this done, and the filters files also need to be updated to reference the correct files. It's a bit of work, but once it's done it should work fine.

I've reported the issue, hopefully he'll fix it pretty soon: https://github.com/malortie/halflife/issues/16

Otherwise you can try reverting the last commit so the folder structure matches the project files.

I also found this, it might be a better option for you: https://github.com/malortie/uncompleted-compilable-hl-opfor
Posted 5 years ago2019-01-05 20:52:47 UTC Post #341559
This link:
https://github.com/malortie/uncompleted-compilable-hl-opfor

What am I looking at? Doesn't "uncompleted" usually mean "incomplete"?

UPDATE:
Well, I'm going to give it a try. Good thing it comes with instructions.

And now I'm stuck at Step 2. I'm not understanding it. What am I doing in those three things? I can't seem to visualize it in my mind.
Posted 5 years ago2019-01-05 21:44:52 UTC Post #341560
Nevermind about that second step. I got it figured out. The main DLL (opfor.dll) worked fine, got it built; but the client one gets an error and will not build. It says "LNK1104 cannot open file '..\..\utils\vgui\lib\win32_vc6\vgui.lib'.

How do I fix this error? Where do I go?
Posted 5 years ago2019-01-05 21:57:54 UTC Post #341561
He forgot to add an import library. You can get it from the original Half-Life Github repository. Clone it and copy the file utils/vgui/lib/win32_vc6/vgui.lib to SourceCode/utils/vgui/lib/win32_vc6.

Edit: the developer just committed all of the missing library files, so you can just pull the latest commit.
Posted 5 years ago2019-01-05 23:10:20 UTC Post #341562
Well, problem solved. But now, there's a new one. While playing it through the HL launcher, it keeps crashing. And the mouse will only rotate the character's view by 180 degrees instead of 360 degrees. And yes, I am running it with Opposing Force's maps for testing. Why is this happening?

UPDATE:
This bug is only occurring in the mod. The games themselves aren't having these problems. So, it's an isolated event. Must be in the source code, but I don't know where. Please note that the "uncompleted-compilable" source code was not edited nor additions made before building.

UPDATE:
In the intro, remember when Shephard sees one of the choppers being destroyed by one of those weird flying sting rays? Well, the game crashes before there's an explosion. And the title in the intro says "Half-Life" instead of "Half-Life: Opposing Force". Yes, I followed the instructions from GitHub and copied Opposing Force's asset files into the mod's directory.

It looks like I'm going on GitHub and will be addressing the issue to Malorite.
Posted 5 years ago2019-01-06 12:18:17 UTC Post #341563
It's crashing because an env_beam between two entities is trying to use an entity that's been killtargeted. It passes what is supposed to be the entity origin by reference to the engine, which then tries to dereference a garbage address. That's causing the crash.

I'm going to decompile the map and see how this entity setup works, i'm thinking a killtarget isn't working properly here.

Edit: i've found the problem. env_spritetrain isn't fully implemented so it never triggers the fire on pass targets for its path_corner entities, which are supposed to killtarget the alien beam effects. As a result the beam tries to use one of the alien ship entities, which is killtargeted when the ship hits a path_track of its own so it tries to pass a reference to the origin of that ship to the engine, which then causes a crash due to dereferencing freed memory.

To fix this env_spritetrain needs to be implemented. It should be relatively easy to do, inherit from func_train and internally create an env_sprite using MOVETYPE_FOLLOW to attach it to the train.
Posted 5 years ago2019-01-06 14:43:06 UTC Post #341564
And the mouse will only rotate the character's view by 180 degrees instead of 360 degrees.
Try turning off "Raw mouse input" in the mouse options. As far as I've seen, this type of bug seems to appear with modern Half-Life SDK sources, except it was about 90 degrees on my end.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 5 years ago2019-01-06 21:04:13 UTC Post #341565
Referencing this here so everybody can see it: https://github.com/malortie/uncompleted-compilable-hl-opfor/issues/2

If anybody knows of tutorials for learning to work with the SDK, can you post them here?
Posted 5 years ago2019-01-06 21:32:23 UTC Post #341566
I've written a small tutorial for setting up the SDK with your updated HL SDK, for VS 2017, on GB: link

And there are a bunch of tutorials I've found at Sourcemodding, and I think the SDK Basics series would be useful for this:

pev structure and entity variables
Introduction to the source code
SDK2 Basics - Looking at a simple entity class
SDK2 Basics - String handling
SDK2 Basics - Creating a new entity class, and adding it to your level
SDK2 Basics - Adding a new monster
Admer456 Admer456If it ain't broken, don't fox it!
You must be logged in to post a response.