• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code Tank/Vehicle Hud implementation question

ToiletDuckie

Grizzled Veteran
Aug 22, 2006
59
0
Tanks, as I'm sure you've all seen, have a nice little HUD in the lower left corner that displays the turret's position relative to the vehicle itself.

On the other hand, vehicles such as the BA and Halftrack have no such useful feature.

On a whim, I was/am attempting to change this on a BA64.

The code here is.. for lack of a better term, too simple to not work (which it doesn't for me.. which is why I'm posting.. heh).

ROWheeledVehicle has most of the HUD code, such as what vehicle icon to display and where to place it, etc. ROTreadCraft extends this ever-so-slightly. It adds

var TexRotator VehicleHudTurret;
var TexRotator VehicleHudTurretLook;

var float VehicleHudThreadsPosX[2]; // 0 = left thread, 1 = right thread
var float VehicleHudThreadsPosY; // both threads always draw at same Y pos
var float VehicleHudThreadsScale; // both threads always draw with same scale

which I assume allow the IS2 turret icon to.. well, rotate, as TexRotator is implied to do. I'm not too sure about the float variables. This is all that is changed from ROWheeledVehicle to ROTreadCraft, Hud wise.

Dropping down one level to a specific tank, say an IS2, I see

VehicleHudImage=Texture'InterfaceArt_tex.Tank_Hud.IS2_body'
VehicleHudTurret=TexRotator'InterfaceArt_tex.Tank_Hud.IS2_turret_rot'
VehicleHudTurretLook=TexRotator'InterfaceArt_tex.Tank_Hud.IS2_turret_look'
VehicleHudThreadsPosX(0)=0.38
VehicleHudThreadsPosX(1)=0.63
VehicleHudThreadsPosY=0.505
VehicleHudThreadsScale=0.72
VehicleHudOccupantsX(0)=0.5
VehicleHudOccupantsX(1)=0.5
VehicleHudOccupantsX(2)=none
VehicleHudOccupantsY(0)=0.3
VehicleHudOccupantsY(1)=0.45
VehicleHudOccupantsY(2)=none
bVehicleHudUsesLargeTexture=true

Which make sense. You have your standard wheeled vehicle HUD stuff (such as what the BA has), which is the HUD image and VehicleHudOccupants, which are the dots you see on the HUD representing player locations in the vehicle. This leaves the variables defined in ROTreadCraft, whose function isn't fully understood by me. Still, there's data there.

Now, if the only difference between a wheeled vehicle hud and a treaded vehicle hud is ~5 variables, why is it that when I added those variables to a BA64's code, as well as the values for those variables ripped directly from the IS2 code, that I don't see a turret? I didn't see any functions/etc. in TreadVehicle or IS2 code that used these variables, so its not like there's a magical function necessary to make them "work" (though I might have missed it). There shouldn't be any "BA to IS2" hud incompatibility, since I ripped all of the BA HUD data out and replaced it with the exact data held in the IS2 file.

Yet, when I jump in my BA, I see the IS2 tank body, the "clock ring" around it, and no turret icon. I run over to my IS2, and the turret is there and accurated twisting around on the HUD.

Any ideas?