Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
97 lines
1.9 KiB
C++
97 lines
1.9 KiB
C++
#include "MW4Headers.hpp"
|
|
#include "hudcomp.hpp"
|
|
#include "HUDhelparrow.hpp"
|
|
|
|
using namespace MechWarrior4;
|
|
|
|
HUDHelpArrow::HUDHelpArrow()
|
|
{
|
|
AddTexture ("hud\\hud4",0,9,167,55,191);
|
|
Point3D size;
|
|
size = m_Textures[0]->Size ();
|
|
m_Textures[0]->Origin (size.x,size.y/2.0f);
|
|
m_Textures[0]->Clip (true);
|
|
Size (size);
|
|
m_AlphaTime = 0;
|
|
m_Alpha = 255;
|
|
m_GoalTime = 0;
|
|
m_RotationDelta = 0;
|
|
m_XDelta = 0;
|
|
m_YDelta = 0;
|
|
}
|
|
|
|
HUDHelpArrow::~HUDHelpArrow()
|
|
{
|
|
}
|
|
|
|
void HUDHelpArrow::Update (Time till)
|
|
{
|
|
if (m_AlphaTime == 0)
|
|
m_AlphaTime = till;
|
|
|
|
while (m_AlphaTime <= till)
|
|
{
|
|
m_Alpha +=20;
|
|
if (m_Alpha >= 255)
|
|
m_Alpha = 15;
|
|
m_AlphaTime += 1.0/30.0;
|
|
}
|
|
|
|
if (m_GoalTime != 0)
|
|
{
|
|
if ((Scalar)gos_GetElapsedTime() > m_GoalTime)
|
|
{
|
|
m_GoalTime = 0;
|
|
}
|
|
else
|
|
{
|
|
const Scalar time_delta = (Scalar)gos_GetElapsedTime() - m_LastUpdate;
|
|
|
|
m_Location.x += m_XDelta * time_delta;
|
|
m_Location.y += m_YDelta * time_delta;
|
|
m_Rotation += m_RotationDelta * time_delta;
|
|
|
|
m_LastUpdate = (Scalar)gos_GetElapsedTime();
|
|
}
|
|
}
|
|
|
|
inherited::Update (till);
|
|
}
|
|
|
|
void HUDHelpArrow::DrawImplementation(void)
|
|
{
|
|
Point3D loc,size;
|
|
DWORD color;
|
|
loc = Location ();
|
|
size = Size ();
|
|
color = Color ();
|
|
color = (color & 0x00ffffff) + ((m_Alpha&0xff)<<24);
|
|
m_Textures[0]->Rotate (m_Rotation);
|
|
m_Textures[0]->Draw (loc,size,color,HUDTexture::NO_FLIP,true);
|
|
}
|
|
|
|
void HUDHelpArrow::SetParams(Scalar rotation, Scalar x, Scalar y, int color, int time)
|
|
{
|
|
Color(color);
|
|
|
|
if (time > 0)
|
|
{
|
|
m_GoalTime = (Scalar)gos_GetElapsedTime() + (Scalar)time;
|
|
|
|
m_RotationDelta = (m_Rotation - rotation) / (Scalar)time;
|
|
|
|
m_XDelta = (x - m_Location.x) / (Scalar)time;
|
|
m_YDelta = (y - m_Location.y) / (Scalar)time;
|
|
return;
|
|
}
|
|
|
|
m_XDelta = 0;
|
|
m_YDelta = 0;
|
|
|
|
m_GoalTime = 0;
|
|
Point3D location(x,y,0.9f);
|
|
Location(location);
|
|
SetRot(rotation);
|
|
m_LastUpdate = (Scalar)gos_GetElapsedTime();
|
|
}
|