Tripwire Interactive Forums

Go Back   Tripwire Interactive Forums > Red Orchestra: Ostfront 41-45 Forums > Red Orchestra Modifications > Coding

Reply
 
Thread Tools Display Modes
  #1  
Old 11-26-2006, 05:40 PM
DevilDog (Teufelhund) DevilDog (Teufelhund) is offline
Senior Member
 
Join Date: Feb 2006
Location: USA
Posts: 156
Default Extending ROHud

I created a new class, CustHud, extending ROHud with the single function of overriding DrawVehicleIcon to remove the throttle and dials from the HUD display. I am trying to call the overridden DrawVehicleIcon in the following manner, which is from the DrawHud function. I have the DrawHUD in a new class extending from ROTankCannonPawn.

My code:
if (CustHud(PC.myHUD) != none && ROVehicle(GetVehicleBase()) != none)
CustHud(PC.myHUD).DrawVehicleIcon(Canvas, ROVehicle(GetVehicleBase()), self);

The original code looks like this:
if (ROHud(PC.myHUD) != none && ROVehicle(GetVehicleBase()) != none)
ROHud(PC.myHUD).DrawVehicleIcon(Canvas, ROVehicle(GetVehicleBase()), self);

In looking at the log messages I put in and it is appears not be typecasting properly with CustHud because it doesn't get by the "CustHud(PC.myHUD) != none" check. It is returning none, thus fails the if/then. But, if I change CustHud to ROHud it works (no surprise there, right).

Looked over the Unreal wiki and I've tried a couple different ways to typecast with no success. Any thoughts or suggestions. Am I doing this the right way? Is this a typecasting problem?

Thanks for any help!
Reply With Quote
  #2  
Old 11-27-2006, 04:16 AM
worluk's Avatar
worluk worluk is offline
Senior Member
 
Join Date: Nov 2005
Posts: 2,217
Default

Im pretty tired, so forgive me if im totally off atm.

Wouldnt your PC have to have the HUD defined as a CustHUD for that check?
Of course you subclass from ROHUD but your PCs HUD is a ROHUD and not CustHUD. I think a typecast there will always result in a none. Why do you need to cast it anyway at that point? The variables and functions you are referencing are in the ROHUD anyway.
Reply With Quote
  #3  
Old 11-27-2006, 12:26 PM
DevilDog (Teufelhund) DevilDog (Teufelhund) is offline
Senior Member
 
Join Date: Feb 2006
Location: USA
Posts: 156
Default

You're on the mark. I tried a few more things and you are correct. The PC uses the ROHud, so trying to use an extended class of ROHud does return nothing. Had a feeling this was the problem but thought it may allow the typecasting because the CustHUD is extended of ROHud. This has been a definite learning experience.

I was trying to cast it to create a HUD without the dials, throttle, and change the text for the "Driver". I wanted to override DrawVehicleIcon in ROHud. I can use the optional variable DrawVehicleIcon to prevent the dials and throttle from being drawn, but the driver name is using the default value in ROVehicleWeaponPawn for DriverHudName.

Thanks. There is another option or two I can try.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:09 AM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2005 - 2013, Tripwire Interactive, LLC