hqtrilogy log nr. 23


To hunt the error of missing game_text in trigger_cameras, I started looking at the code differences between SoHL 1.8 and 1.4.

* triggers.cpp: I found two lines that mess with the m_hActivator for all triggers, that may do something, but according to the comment it's only related to set the correct activator to attribute multiplayer kills correctly.

Otherwise there's only lots of motion_manager stuff, not much else has been changed. I found a save/restore functionality for fmod audio support, which I could test again. Maybe there's hope for MP3 sound after all.

* in_camera.cpp: I think this is where things get interesting. Basically, all of the old camera has been thrown out for a "new clipping style camera by Xwider". Searching for gHUD.m_iCameraMode led me to view.cpp.

* view.cpp: Apparently, here's all the relevant code, and I found something interesting like this:

if(gHUD.viewFlags & 8 ) //AJH Do we draw the player in the camera?

I still have the problem that the player model is not shown in cameras, so maybe I can fix the text and the player error in one stroke.

As for text, hud.h and hud_msg.cpp didn't really show any relevant difference, so I decided to look at text_message.cpp, but there are no differences between 1.4 and 1.8. I did find a function called AllowedToPrintText(), so I checked that out. Nothing suspicious there either.

So, I decided to figure it out by debugging. After several ALERT() debug outputs and almost giving up, I finally found the solution:

A player has "view entities", and each viewEntity has viewFlags. Auri told me that viewFlags uses bitwise operations. If you set viewFlag #2, then the HUD will not be drawn for that view. A text message is a HUD element, therefore it doesn't get drawn.

In hud_redraw.cpp, I commented out the line where it asks whether viewFlags #2 exists - and it worked! Game text now gets displayed again in cameras.

I also figured out that viewFlag #8 decides whether the player model should be drawn.

I fixed that too. Now all camera issues are gone, hopefully! :D Here's the model and text in camera:

I still needed to figure out why the player model is Gordon by default. For some reason, it uses the models/player/gordon/gordon.mdl file. I've replaced that with the one I use in HQ1, and that was that. :D

All in all, after spending roughly six hours, I finally have a camera that behaves just like the old one, but with the added benefit that you can now save and reload and it restores the camera's view. Yay!

To be continued... (<