FWGS / hlsdk-portable

Portable Half-Life SDK. GoldSource and Xash3D. Crossplatform.
https://xash.su
Other
271 stars 121 forks source link

Cthulhu mod #122

Open Emru1 opened 4 years ago

Emru1 commented 4 years ago

Cthulhu cannot be compiled. It breaks when it tries to include header from /dlls/weapons.h, revolver.h When I copied all content from /dlls/cthulhu/ to /dlls/ it fails then on missing bmodels.h included in bmodels.cpp

nekonomicon commented 4 years ago

It's actually not a trouble. I just merged code to separate branch without code changing because this mod required vgui.

I recommend to use sources from this list: https://github.com/FWGS/xash3d-fwgs/blob/master/Documentation/opensource-mods.md

All another branches is experimental, I will work on It someday.

z33ky commented 1 year ago

I made my own attempt of a port since I saw VGUI support is now on the table: https://github.com/z33ky/hlsdk-portable/tree/my-cthulhu Seems to run, I played the intro and the first level almost fine - one curious thing is that two models are referred to as models/!book.mdl and models/!letter.mdl when their real name in pak0.pk3 does not have the exclamation point in the filename. I extracted the two files and manually renamed them. The book pages and letters, for which VGUI is used, do look a little small, probably due to larger display resolutions on more modern systems. It uses CImageLabel - I also tried a CImagePanel - and I couldn't figure out how to resize the image, if that's even possible without manual scaling of the decoded bitmap or something. Maybe there's also a better way of displaying a TGA on the HUD, dunno.

There were a couple more curious errors, like it seems the original Cthulhu mod source code (https://github.com/gunrunners-paradise/Cthulhu-HLmod-SDK) wouldn't compile as-is because a definition of LIGHTNING_GUN_MAX_BEAMS seems to be missing (it's used here, I defined it myself here). Also the CZombie defines an incorrect default model here (there is no monsters/ subdirectory). Maybe @gunrunners-paradise knows what's up? Maybe this wasn't the final code used for the release, maybe something got lost?

But yeah, I fixed these things, did a little bit of refactoring where I just kinda slid into it but other than that it's a straight source port. In most places where existing code was changed/replaced I used a pattern of

#if 0
// hlsdk-portable code
#else
// cthulhu code
#endif

I'm not sure if that's a common pattern, but it should make merging upstream/master/sohl1.2 changes easier. Where code was moved (e.g. bm.h contains code from bigmomma.cpp) I removed the code from the original file, because if stuff is changed there I would want merge conflicts to signal that something was changed, that one may want to carry over though. The mod code mentions a few fixes in some places - I didn't try to reproduce any of them and just included them all. If desired I can gather a few and make an isolated pull request. Similarly I'd be happy if you want to take my cthulhu branch. Let me know if you just want to copy it or if you want me to open a PR.

nekonomicon commented 1 year ago

one curious thing is that two models are referred to as models/!book.mdl and models/!letter.mdl when their real name in pak0.pk3 does not have the exclamation point in the filename. I extracted the two files and manually renamed them.

I think will be better to patch following maps:

chpt3b.bsp
credits.bsp
cthulhutr2.bsp

The book pages and letters, for which VGUI is used, do look a little small, probably due to larger display resolutions on more modern systems. It uses CImageLabel - I also tried a CImagePanel - and I couldn't figure out how to resize the image, if that's even possible without manual scaling of the decoded bitmap or something.

Xash3D already has special cvar for such purpose hud_scale.

There were a couple more curious errors, like it seems the original Cthulhu mod source code (https://github.com/gunrunners-paradise/Cthulhu-HLmod-SDK) wouldn't compile as-is because a definition of LIGHTNING_GUN_MAX_BEAMS seems to be missing (it's used here, I defined it myself here).

I think it was defined as ISLAVE_MAX_BEAMS because in decompiled gamedll I found such check:

  if ( *(_DWORD *)(this + 260) < 8 )
  {

I'm not sure if that's a common pattern, but it should make merging upstream/master/sohl1.2 changes easier.

Need to resolve merge conflicts anyway.

Similarly I'd be happy if you want to take my cthulhu branch. Let me know if you just want to copy it or if you want me to open a PR.

Sorry, looks dirty for me. It will be better to make small separate commits for better maintainability/readability and reuse what was already made before your changes if possible.

z33ky commented 1 year ago

I think will be better to patch following maps

I have no idea how to do that. Are there BSP editing tools? Does xash3d provide some hook for runtime patches like these? Sorry if the questions appear dumb, I have not been involved in HL1 modding before this.

Xash3D already has special cvar for such purpose hud_scale.

Well that scales all of the HUD elements, but fair enough.

I think it was defined as ISLAVE_MAX_BEAMS because in decompiled gamedll I found such check:

 if ( *(_DWORD *)(this + 260) < 8 )
 {

Nice find!

Sorry, looks dirty for me. It will be better to make small separate commits for better maintainability/readability and reuse what was already made before your changes if possible.

I'm happy to make the necessary changes. I'm not 100% sure what you mean though, are you thinking of first commiting the Cthulhu mod code with merge conflict markers and then progressively clean them up, then fix the compilation errors and finally the added "runtime error" fixes (like the zombie model path)? Note that I didn't use the existing cthulhu branch at all, I started on sohl1.2, applied a diff from an original SoHL (0.7.1 I think) to the Cthulhu mod code and then gone to town on the conflicts and compiler errors.

nekonomicon commented 1 year ago

Are there BSP editing tools?

You can use ripent utility from Zoner's Half-Life Tools.

are you thinking of first commiting the Cthulhu mod code with merge conflict markers and then progressively clean them up, then fix the compilation errors and finally the added "runtime error" fixes (like the zombie model path)?

Yes, but without merge conflict markers. I mean:

And it will be better to reuse my branch.

I started on sohl1.2, applied a diff from an original SoHL (0.7.1 I think) to the Cthulhu mod code

I did the same thing.

z33ky commented 1 year ago

Just as a heads-up, I started to rebase my changes last weekend. I don't think I have time this or the next weekend, so it will likely not progress this month.

gunrunners-paradise commented 1 year ago

There were a couple more curious errors, like it seems the original Cthulhu mod source code (https://github.com/gunrunners-paradise/Cthulhu-HLmod-SDK) wouldn't compile as-is because a definition of LIGHTNING_GUN_MAX_BEAMS seems to be missing (it's used here, I defined it myself here). Also the CZombie defines an incorrect default model here (there is no monsters/ subdirectory). Maybe @gunrunners-paradise knows what's up? Maybe this wasn't the final code used for the release, maybe something got lost?

But yeah, I fixed these things, did a little bit of refactoring where I just kinda slid into it but other than that it's a straight source port.

Hey, sorry for the late reply but I got the code directly from the mod creator and this is what he had. I don't know if there was anything else.