#pragma once #include "MW4.hpp" #include "Sensor.hpp" #include "hudcomp.hpp" namespace MechWarrior4 { class GUIRadarManager: public HUDComponent { typedef HUDComponent inherited; protected: Scalar radarRange; Scalar radarRangeOrg; // Point3D displayPos; // Vector3D displaySize; int radarx,radary,radarw,radarh; Stuff::SlotOf m_CurrentTarget; HUDText *m_RangeText; // void SetDisplayPosition(Stuff::Scalar xloc,Stuff::Scalar yloc) {displayPos.x=xloc; displayPos.y=yloc;} // void SetDisplaySize(Stuff::Scalar xsize,Stuff::Scalar ysize) {displaySize.x=xsize; displaySize.y=ysize;} //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Construction, Destruction // public: GUIRadarManager(); ~GUIRadarManager(); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Public Data // protected: struct ShotEntry { ObjectID entity; Stuff::Time timeadded; ShotEntry (ObjectID p1,Stuff::Time p2) { entity = p1; timeadded = p2; } }; void DrawImplementation(void); Stuff::Time m_RotateTime; Stuff::Scalar zrot; Stuff::Scalar m_TorsoTwist; int m_RadarMode; stlport::vector m_ShotList; //»óÈÆ ¾Õ int hsh_fdraw; //»óÈÆ µÚ bool OnShotList (ObjectID who); void ClipLine (Scalar& xpt1,Scalar& ypt1,Scalar& xpt2,Scalar& ypt2,Scalar cx,Scalar cy,Scalar rad); public: virtual void Reset (void); void AddShot (ObjectID who); void SetVehicle(Vehicle *vehicle); void SetRange(Stuff::Scalar range); Stuff::Scalar GetRange(bool bOrg = true) const; virtual void Update (Stuff::Time till); void TorsoTwist (Stuff::Scalar value) { m_TorsoTwist = value; } void CurrentTarget (Entity *obj) { m_CurrentTarget.Remove (); if (obj) m_CurrentTarget.Add (obj); } }; class HUDHeat : public HUDComponent { protected: typedef HUDComponent inherited; int m_Alpha; Stuff::Time m_AlphaTime; DWORD m_HeatColor[3]; int m_Heat; int m_TargetHeat; int m_BaseBottom; HUDText *m_HeatText; void DrawImplementation(void); public: HUDHeat(); ~HUDHeat(); virtual void Update (Stuff::Time till); void Heat (int value) { if (value != m_TargetHeat) { char text[15]; m_TargetHeat = value; m_Alpha = 255; // MSL 5.02 Heat Scale Header sprintf (text,"%5.0f %%",m_TargetHeat*1.0f); m_HeatText->UpdateText (text); } } }; class HUDCoolant : public HUDComponent { protected: typedef HUDComponent inherited; int m_Alpha; Stuff::Time m_AlphaTime; int m_Cool; int m_TargetCool; int m_BaseBottom; void DrawImplementation(void); public: HUDCoolant(); ~HUDCoolant(); virtual void Update (Stuff::Time till); void Coolant (int value) { if (value != m_TargetCool) { m_TargetCool = value; m_Alpha = 255; } } }; class HUDJump : public HUDComponent { protected: typedef HUDComponent inherited; int m_Alpha; Stuff::Time m_AlphaTime; Stuff::Scalar m_Jump; Stuff::Scalar m_MaxJump; Stuff::Scalar m_TargetJump; int m_BaseBottom; void DrawImplementation(void); public: HUDJump(); ~HUDJump(); virtual void Update (Stuff::Time till); void Jump (Stuff::Scalar value,Stuff::Scalar maxvalue) { m_MaxJump = maxvalue; if (value > maxvalue) value = maxvalue; if (maxvalue != 0) m_Jump = value/maxvalue; else m_Jump = -1.0f; } }; class HUDSpeed : public HUDComponent { protected: typedef HUDComponent inherited; int m_Alpha; Stuff::Time m_AlphaTime; Scalar m_Speed; Scalar m_MaxForwardSpeed,m_MaxReverseSpeed; Scalar m_TargetSpeed; int m_BaseBottom; HUDText *m_SpeedText; void DrawImplementation(void); public: HUDSpeed(); ~HUDSpeed(); virtual void Update (Stuff::Time till); void Speed (Stuff::Scalar value,Stuff::Scalar forwardmin,Stuff::Scalar reversemin,Stuff::Scalar maxforwardspeed,Stuff::Scalar maxreversespeed) { char text[15]; if ((value < forwardmin) && (value > reversemin)) value = 0; if (value != m_TargetSpeed) { m_TargetSpeed = value; m_Alpha = 255; int temp = (int) m_TargetSpeed; sprintf (text,"%dkph",temp); m_SpeedText->UpdateText (text); } } }; class HUDNav : public HUDComponent { protected: typedef HUDComponent inherited; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Construction, Destruction // void DrawImplementation(void); int m_PlayerFacing; int m_NavPointFacing; int m_NavPointRange; int m_BaseLeft,m_BaseRight; HUDText *navPointName,*navPointRange; HUDText *navText[41]; HUDText *playerAngle; char m_NavPointName[MAX_HUD_TEXT],m_NavPointRangeText[MAX_HUD_TEXT]; DWORD m_NavAlpha; Stuff::Time m_NavAlphaTime; public: HUDNav(); ~HUDNav(); virtual void Update (Stuff::Time till); void PlayerFacing (int value) { char text[10]; m_PlayerFacing = value; itoa (value,text,10); playerAngle->UpdateText (text); } void NavPointFacing (int value) { m_NavPointFacing = value; } void NavPointRange (int value) { m_NavPointRange = value; sprintf (m_NavPointRangeText,"%d",value); navPointRange->UpdateText (m_NavPointRangeText); } void NavPointName (const char *name) { Str_Copy (m_NavPointName,name,MAX_HUD_TEXT); Verify (navPointName); navPointName->UpdateText (m_NavPointName); } }; }