t2 engine svn checkout

This commit is contained in:
loop 2024-01-07 04:36:33 +00:00
commit ff569bd2ae
988 changed files with 394180 additions and 0 deletions

112
game/fps/guiClockHud.cc Normal file
View file

@ -0,0 +1,112 @@
//-----------------------------------------------------------------------------
// V12 Engine
//
// Copyright (c) 2001 GarageGames.Com
//-----------------------------------------------------------------------------
#include "dgl/dgl.h"
#include "gui/guiControl.h"
#include "console/consoleTypes.h"
#include "game/gameConnection.h"
#include "game/shapeBase.h"
//-----------------------------------------------------------------------------
/**
Vary basic HUD clock.
Displays the current simulation time offset from some base. The base time
is usually synchronized with the server as mission start time. This hud
currently only displays minutes:seconds.
*/
class GuiClockHud : public GuiControl
{
typedef GuiControl Parent;
bool mShowFrame;
bool mShowFill;
ColorF mFillColor;
ColorF mFrameColor;
ColorF mTextColor;
S32 mTimeOffset;
public:
GuiClockHud();
void setTime(S32 newTime);
void onRender( Point2I, const RectI &, GuiControl * );
static void initPersistFields();
DECLARE_CONOBJECT( GuiClockHud );
};
//-----------------------------------------------------------------------------
IMPLEMENT_CONOBJECT( GuiClockHud );
GuiClockHud::GuiClockHud()
{
mShowFrame = mShowFill = true;
mFillColor.set(0, 0, 0, 0.5);
mFrameColor.set(0, 1, 0, 1);
mTextColor.set( 0, 1, 0, 1 );
mTimeOffset = 0;
}
void GuiClockHud::initPersistFields()
{
Parent::initPersistFields();
addField( "showFill", TypeBool, Offset( mShowFill, GuiClockHud ) );
addField( "showFrame", TypeBool, Offset( mShowFrame, GuiClockHud ) );
addField( "fillColor", TypeColorF, Offset( mFillColor, GuiClockHud ) );
addField( "frameColor", TypeColorF, Offset( mFrameColor, GuiClockHud ) );
addField( "textColor", TypeColorF, Offset( mTextColor, GuiClockHud ) );
}
//-----------------------------------------------------------------------------
void GuiClockHud::onRender(Point2I offset, const RectI &updateRect,GuiControl *)
{
// Background first
if (mShowFill)
dglDrawRectFill(updateRect, mFillColor);
// Convert ms time into hours, minutes and seconds.
S32 time = (mTimeOffset + Platform::getVirtualMilliseconds()) / 1000;
S32 secs = time % 60;
S32 mins = (time % 3600) / 60;
S32 hours = time / 3600;
// Currently only displays min/sec
char buf[256];
dSprintf(buf,sizeof(buf), "%02d:%02d",mins,secs);
// Center the text
offset.x += (mBounds.extent.x - mProfile->mFont->getStrWidth(buf)) / 2;
offset.y += (mBounds.extent.y - mProfile->mFont->getHeight()) / 2;
dglSetBitmapModulation(mTextColor);
dglDrawText(mProfile->mFont, offset, buf);
dglClearBitmapModulation();
// Border last
if (mShowFrame)
dglDrawRect(updateRect, mFrameColor);
}
//-----------------------------------------------------------------------------
void GuiClockHud::setTime(S32 time)
{
mTimeOffset = (time * 1000) - Platform::getVirtualMilliseconds();
}
ConsoleMethod(GuiClockHud,setTime,void,3, 3,"(time in sec)Sets the current base time for the clock")
{
GuiClockHud *hud = static_cast<GuiClockHud*>(object);
hud->setTime(dAtoi(argv[2]));
}

View file

@ -0,0 +1,69 @@
//-----------------------------------------------------------------------------
// Torque Game Engine
//
// Copyright (c) 2001 GarageGames.Com
//-----------------------------------------------------------------------------
#include "dgl/dgl.h"
#include "gui/guiControl.h"
#include "gui/guiBitmapCtrl.h"
#include "console/consoleTypes.h"
#include "game/gameConnection.h"
#include "game/shapeBase.h"
//-----------------------------------------------------------------------------
/**
Vary basic cross hair hud.
Use the base bitmap control to render a bitmap, and only decides whether
to draw or not depending on the current control object and it's state.
This simple behavior would normally be scripted, but we're going to
be adding new feature to this class.
*/
class GuiCrossHairHud : public GuiBitmapCtrl
{
typedef GuiBitmapCtrl Parent;
public:
GuiCrossHairHud();
void onRender( Point2I, const RectI &, GuiControl * );
static void initPersistFields();
DECLARE_CONOBJECT( GuiCrossHairHud );
};
/// Valid object types for which the cross hair will render, this
/// should really all be script controlled.
static const U32 ObjectMask = PlayerObjectType | VehicleObjectType;
//-----------------------------------------------------------------------------
IMPLEMENT_CONOBJECT( GuiCrossHairHud );
GuiCrossHairHud::GuiCrossHairHud()
{
}
void GuiCrossHairHud::initPersistFields()
{
Parent::initPersistFields();
}
//-----------------------------------------------------------------------------
void GuiCrossHairHud::onRender(Point2I offset, const RectI &updateRect,GuiControl *ctrl)
{
// Must have a connection and player control object
GameConnection* conn = GameConnection::getServerConnection();
if (!conn)
return;
ShapeBase* control = conn->getControlObject();
if (!control || !(control->getType() & ObjectMask) || !conn->isFirstPerson())
return;
// Parent render.
Parent::onRender(offset,updateRect,ctrl);
}

118
game/fps/guiHealthBarHud.cc Normal file
View file

@ -0,0 +1,118 @@
//-----------------------------------------------------------------------------
// V12 Engine
//
// Copyright (c) 2001 GarageGames.Com
//-----------------------------------------------------------------------------
#include "dgl/dgl.h"
#include "gui/guiControl.h"
#include "console/consoleTypes.h"
#include "game/gameConnection.h"
#include "game/shapeBase.h"
//-----------------------------------------------------------------------------
/**
A basic health bar control.
This gui displays the damage value of the current PlayerObjectType
control object. The gui can be set to pulse if the health value
drops below a set value. This control only works if a server
connection exists and it's control object is a PlayerObjectType. If
either of these requirements is false, the control is not rendered.
*/
class GuiHealthBarHud : public GuiControl
{
typedef GuiControl Parent;
bool mShowFrame;
bool mShowFill;
ColorF mFillColor;
ColorF mFrameColor;
ColorF mDamageFillColor;
S32 mPulseRate;
F32 mPulseThreshold;
F32 mValue;
public:
GuiHealthBarHud();
void onRender( Point2I, const RectI &, GuiControl * );
static void initPersistFields();
DECLARE_CONOBJECT( GuiHealthBarHud );
};
//-----------------------------------------------------------------------------
IMPLEMENT_CONOBJECT( GuiHealthBarHud );
GuiHealthBarHud::GuiHealthBarHud()
{
mShowFrame = mShowFill = true;
mFillColor.set(0, 0, 0, 0.5);
mFrameColor.set(0, 1, 0, 1);
mDamageFillColor.set(0, 1, 0, 1);
mPulseRate = 0;
mPulseThreshold = 0.3f;
mValue = 0.2f;
}
void GuiHealthBarHud::initPersistFields()
{
Parent::initPersistFields();
addField( "showFill", TypeBool, Offset( mShowFill, GuiHealthBarHud ) );
addField( "showFrame", TypeBool, Offset( mShowFrame, GuiHealthBarHud ) );
addField( "fillColor", TypeColorF, Offset( mFillColor, GuiHealthBarHud ) );
addField( "frameColor", TypeColorF, Offset( mFrameColor, GuiHealthBarHud ) );
addField( "damageFillColor", TypeColorF, Offset( mDamageFillColor, GuiHealthBarHud ) );
addField( "pulseRate", TypeS32, Offset( mPulseRate, GuiHealthBarHud ) );
addField( "pulseThreshold", TypeF32, Offset( mPulseThreshold, GuiHealthBarHud ) );
}
//-----------------------------------------------------------------------------
/**
Gui onRender method.
Renders a health bar with filled background and border.
*/
void GuiHealthBarHud::onRender(Point2I offset, const RectI &updateRect,GuiControl *)
{
// Must have a connection and player control object
GameConnection* conn = GameConnection::getServerConnection();
if (!conn)
return;
ShapeBase* control = conn->getControlObject();
if (!control || !(control->getType() & PlayerObjectType))
return;
// We'll just grab the damage right off the control object.
// Damage value 0 = no damage.
mValue = 1 - control->getDamageValue();
// Background first
if (mShowFill)
dglDrawRectFill(updateRect, mFillColor);
// Pulse the damage fill if it's below the threshold
if (mPulseRate != 0)
if (mValue < mPulseThreshold) {
F32 time = Platform::getVirtualMilliseconds();
F32 alpha = mFmod(time,mPulseRate) / (mPulseRate / 2.0);
mDamageFillColor.alpha = (alpha > 1.0)? 2.0 - alpha: alpha;
}
else
mDamageFillColor.alpha = 1;
// Render damage fill %
RectI rect(updateRect);
rect.extent.x *= mValue;
dglDrawRectFill(rect, mDamageFillColor);
// Border last
if (mShowFrame)
dglDrawRect(updateRect, mFrameColor);
}

260
game/fps/guiShapeNameHud.cc Normal file
View file

@ -0,0 +1,260 @@
//-----------------------------------------------------------------------------
// V12 Engine
//
// Copyright (c) 2001 GarageGames.Com
//-----------------------------------------------------------------------------
#include "dgl/dgl.h"
#include "gui/guiControl.h"
#include "gui/guiTSControl.h"
#include "console/consoleTypes.h"
#include "game/shapeBase.h"
#include "game/gameConnection.h"
#include "scenegraph/scenegraph.h"
//-----------------------------------------------------------------------------
/**
Displays name & damage ubove shape objects.
This control displays the name and damage value of all named
ShapeBase objects on the client. The name & damage are overlayed
ubove the object, only if the object is within the control's
display area. This gui control only works as a child of a
TSControl, a server connection and client control object must also
be set. This is a stand-alone control and relies only only the
standard base GuiControl.
*/
class GuiShapeNameHud : public GuiControl {
typedef GuiControl Parent;
// field data
ColorF mFillColor;
ColorF mFrameColor;
ColorF mTextColor;
ColorF mDamageFillColor;
ColorF mDamageFrameColor;
Point2I mDamageRectSize;
F32 mVerticalOffset;
F32 mDistanceFade;
bool mShowFrame;
bool mShowFill;
protected:
void drawName( Point2I offset, const char *buf, F32 opacity);
void drawDamage(Point2I offset, F32 damage, F32 opacity);
public:
GuiShapeNameHud();
// GuiControl
virtual void onRender(Point2I offset,
const RectI &updateRect, GuiControl *firstResponder );
static void initPersistFields();
DECLARE_CONOBJECT( GuiShapeNameHud );
};
//-----------------------------------------------------------------------------
IMPLEMENT_CONOBJECT(GuiShapeNameHud);
static const F32 cDefaultVisibleDistance = 500.0f;
GuiShapeNameHud::GuiShapeNameHud()
{
mFillColor.set( 0.25, 0.25, 0.25, 0.25 );
mFrameColor.set( 0, 1, 0, 1 );
mTextColor.set( 0, 1, 0, 1 );
mDamageFillColor.set( 0, 1, 0, 1 );
mDamageFrameColor.set( 1, 0.6, 0, 1 );
mDamageRectSize.set(50, 4);
mShowFrame = mShowFill = true;
mVerticalOffset = 0.5;
mDistanceFade = 0.1;
}
void GuiShapeNameHud::initPersistFields()
{
Parent::initPersistFields();
addField( "fillColor", TypeColorF, Offset( mFillColor, GuiShapeNameHud ) );
addField( "frameColor", TypeColorF, Offset( mFrameColor, GuiShapeNameHud ) );
addField( "textColor", TypeColorF, Offset( mTextColor, GuiShapeNameHud ) );
addField( "damageFillColor", TypeColorF, Offset( mDamageFillColor, GuiShapeNameHud ) );
addField( "damageFrameColor", TypeColorF, Offset( mDamageFrameColor, GuiShapeNameHud ) );
addField( "damageRect", TypePoint2I, Offset( mDamageRectSize, GuiShapeNameHud ) );
addField( "showFill", TypeBool, Offset( mShowFill, GuiShapeNameHud ) );
addField( "showFrame", TypeBool, Offset( mShowFrame, GuiShapeNameHud ) );
addField( "verticalOffset", TypeF32, Offset( mVerticalOffset, GuiShapeNameHud ) );
addField( "distanceFade", TypeF32, Offset( mDistanceFade, GuiShapeNameHud ) );
}
//-----------------------------------------------------------------------------
/**
Core render method wich does all the work.
This method scans through all the current client ShapeBase objects
and if they are named, displays their name and damage value. If the
shape is a PlayerObjectType then values are displayed offset from it's
eye point, otherwise the bounding box center is used.
*/
void GuiShapeNameHud::onRender( Point2I, const RectI &updateRect,GuiControl *)
{
// Background fill first
if (mShowFill)
dglDrawRectFill(updateRect, mFillColor);
// Must be in a TS Control
GuiTSCtrl *parent = dynamic_cast<GuiTSCtrl*>(getParent());
if (!parent) return;
// Must have a connection and control object
GameConnection* conn = GameConnection::getServerConnection();
if (!conn) return;
ShapeBase* control = conn->getControlObject();
if (!control) return;
// Get control camera info
MatrixF cam;
Point3F camPos;
VectorF camDir;
conn->getControlCameraTransform(0,&cam);
cam.getColumn(3, &camPos);
cam.getColumn(1, &camDir);
F32 camFov;
conn->getControlCameraFov(&camFov);
camFov = mDegToRad(camFov) / 2;
// Visible distance info & name fading
F32 visDistance = gClientSceneGraph->getVisibleDistance();
F32 visDistanceSqr = visDistance * visDistance;
F32 fadeDistance = visDistance * mDistanceFade;
// Collision info. We're going to be running LOS tests and we
// don't want to collide with the control object.
static U32 losMask = TerrainObjectType | InteriorObjectType | ShapeBaseObjectType;
control->disableCollision();
// All ghosted objects are added to the server connection group,
// so we can find all the shape base objects by iterating through
// our current connection.
for (SimSetIterator itr(conn); *itr; ++itr) {
if ((*itr)->getType() & ShapeBaseObjectType) {
ShapeBase* shape = static_cast<ShapeBase*>(*itr);
if (shape != control && shape->getShapeName()) {
// Target pos to test, if it's a player run the LOS to his eye
// point, otherwise we'll grab the generic box center.
Point3F shapePos;
if (shape->getType() & PlayerObjectType) {
MatrixF eye;
shape->getEyeTransform(&eye);
eye.getColumn(3, &shapePos);
}
else
shapePos = shape->getBoxCenter();
VectorF shapeDir = shapePos - camPos;
// Test to see if it's in range
F32 shapeDist = shapeDir.lenSquared();
if (shapeDist == 0 || shapeDist > visDistanceSqr)
continue;
shapeDist = mSqrt(shapeDist);
// Test to see if it's within our viewcone, this test doesn't
// actually match the viewport very well, should consider
// projection and box test.
shapeDir.normalize();
F32 dot = mDot(shapeDir, camDir);
if (dot < camFov)
continue;
// Test to see if it's behind something, and we want to
// ignore anything it's mounted on when we run the LOS.
RayInfo info;
shape->disableCollision();
ShapeBase *mount = shape->getObjectMount();
if (mount)
mount->disableCollision();
bool los = !gClientContainer.castRay(camPos, shapePos,losMask, &info);
shape->enableCollision();
if (mount)
mount->enableCollision();
if (!los)
continue;
// Project the shape pos into screen space and calculate
// the distance opacity used to fade the labels into the
// distance.
Point3F projPnt;
shapePos.z += mVerticalOffset;
if (!parent->project(shapePos, &projPnt))
continue;
F32 opacity = (shapeDist < fadeDistance)? 1.0:
1.0 - (shapeDist - fadeDistance) / (visDistance - fadeDistance);
// Render the shape's name
drawName(Point2I(projPnt.x, projPnt.y),shape->getShapeName(),opacity);
// Render the shape's damage bar
F32 damage = mClampF(1 - shape->getDamageValue(), 0, 1);
drawDamage(Point2I(projPnt.x, projPnt.y),damage,opacity);
}
}
}
// Restore control object collision
control->enableCollision();
// Border last
if (mShowFrame)
dglDrawRect(updateRect, mFrameColor);
}
//-----------------------------------------------------------------------------
/**
Display the name ubove the shape.
This is a support funtion, called by onRender.
*/
void GuiShapeNameHud::drawName(Point2I offset, const char *name, F32 opacity)
{
// Center the name
offset.x -= mProfile->mFont->getStrWidth(name) / 2;
offset.y -= mProfile->mFont->getHeight();
//
mTextColor.alpha = opacity;
dglSetBitmapModulation(mTextColor);
dglDrawText(mProfile->mFont, offset, name);
dglClearBitmapModulation();
}
//-----------------------------------------------------------------------------
/**
Display a damage bar ubove the shape.
This is a support funtion, called by onRender.
*/
void GuiShapeNameHud::drawDamage(Point2I offset, F32 damage, F32 opacity)
{
mDamageFillColor.alpha = mDamageFrameColor.alpha = opacity;
// Center the bar
RectI rect(offset, mDamageRectSize);
rect.point.x -= mDamageRectSize.x / 2;
// Draw the border
dglDrawRect(rect, mDamageFrameColor);
// Draw the damage % fill
rect.point += Point2I(1, 1);
rect.extent -= Point2I(1, 1);
rect.extent.x = (S32)(rect.extent.x * damage);
if (rect.extent.x == 1)
rect.extent.x = 2;
if (rect.extent.x > 0)
dglDrawRectFill(rect, mDamageFillColor);
}

198
game/fps/shapeNameHud.cc Normal file
View file

@ -0,0 +1,198 @@
//-----------------------------------------------------------------------------
// V12 Engine
//
// Copyright (c) 2001 GarageGames.Com
//-----------------------------------------------------------------------------
#include "game/fps/shapeNameHud.h"
#include "dgl/dgl.h"
#include "gui/guiTSControl.h"
#include "console/consoleTypes.h"
#include "terrain/sky.h"
#include "game/shapeBase.h"
#include "game/gameConnection.h"
IMPLEMENT_CONOBJECT(ShapeNameHud);
static const F32 cDefaultVisibleDistance = 500.0f;
ShapeNameHud::ShapeNameHud()
{
mFillColor.set( 0.25, 0.25, 0.25, 0.25 );
mFrameColor.set( 0, 1, 0, 1 );
mTextColor.set( 0, 1, 0, 1 );
mDamageFillColor.set( 0, 1, 0, 1 );
mDamageFrameColor.set( 1, 0.6, 0, 1 );
mDamageRectSize.set(50, 4);
mOpacity = 0.5f;
mShowFrame = mShowFill = true;
mVerticalOffset = 0.5;
mDistanceFade = 0.1;
}
void ShapeNameHud::initPersistFields()
{
Parent::initPersistFields();
addField( "fillColor", TypeColorF, Offset( mFillColor, ShapeNameHud ) );
addField( "frameColor", TypeColorF, Offset( mFrameColor, ShapeNameHud ) );
addField( "textColor", TypeColorF, Offset( mTextColor, ShapeNameHud ) );
addField( "damageFillColor", TypeColorF, Offset( mDamageFillColor, ShapeNameHud ) );
addField( "damageFrameColor", TypeColorF, Offset( mDamageFrameColor, ShapeNameHud ) );
addField( "damageRect", TypePoint2I, Offset( mDamageRectSize, ShapeNameHud ) );
addField( "opacity", TypeF32, Offset( mOpacity, ShapeNameHud ) );
addField( "showFill", TypeBool, Offset( mShowFill, ShapeNameHud ) );
addField( "showFrame", TypeBool, Offset( mShowFrame, ShapeNameHud ) );
addField( "verticalOffset", TypeF32, Offset( mVerticalOffset, ShapeNameHud ) );
addField( "distanceFade", TypeF32, Offset( mDistanceFade, ShapeNameHud ) );
}
void ShapeNameHud::onRender( Point2I, const RectI &updateRect,GuiControl *)
{
// Border and background stuff.
if (mShowFill) {
mFillColor.alpha = mOpacity;
dglDrawRectFill(updateRect, mFillColor);
}
if (mShowFrame)
dglDrawRect(updateRect, mFrameColor);
// Must be in a TS Control
GuiTSCtrl *parent = dynamic_cast<GuiTSCtrl*>(getParent());
if (!parent) return;
// Must have a connection and control object
GameConnection* conn = GameConnection::getServerConnection();
if (!conn) return;
ShapeBase* control = conn->getControlObject();
if (!control) return;
// Get control camera info
MatrixF cam;
Point3F camPos;
VectorF camDir;
conn->getControlCameraTransform(0,&cam);
cam.getColumn(3, &camPos);
cam.getColumn(1, &camDir);
F32 camFov;
conn->getControlCameraFov(&camFov);
camFov = mDegToRad(camFov) / 2;
// Visible distance info & name fading
Sky* sky = gClientSceneGraph->getCurrentSky();
F32 visDistance = sky ? sky->getVisibleDistance() : cDefaultVisibleDistance;
F32 visDistanceSqr = visDistance * visDistance;
F32 fadeDistance = visDistance * mDistanceFade;
// Collision info. We're going to be running LOS tests and we
// don't want to collide with the control object.
static U32 losMask = TerrainObjectType | InteriorObjectType | ShapeBaseObjectType;
control->disableCollision();
// All ghosted objects are added to the server connection group,
// so we can find all the shape base objects by iterating through
// our current connection.
for (SimSetIterator itr(conn); *itr; ++itr) {
if ((*itr)->getType() & ShapeBaseObjectType) {
ShapeBase* shape = static_cast<ShapeBase*>(*itr);
if (shape != control && shape->getShapeName()) {
// Target pos to test, if it's a player run the LOS to his eye
// point, otherwise we'll grab the generic box center.
Point3F shapePos;
if (shape->getType() & PlayerObjectType) {
MatrixF eye;
shape->getEyeTransform(&eye);
eye.getColumn(3, &shapePos);
}
else
shapePos = shape->getBoxCenter();
VectorF shapeDir = shapePos - camPos;
// Test to see if it's in range
F32 shapeDist = shapeDir.lenSquared();
if (shapeDist == 0 || shapeDist > visDistanceSqr)
continue;
shapeDist = mSqrt(shapeDist);
// Test to see if it's within our viewcone, this test doesn't
// actually match the viewport very well, should consider
// projection and box test.
shapeDir.normalize();
F32 dot = mDot(shapeDir, camDir);
if (dot < camFov)
continue;
// Test to see if it's behind something, and we want to
// ignore anything it's mounted on when we run the LOS.
RayInfo info;
shape->disableCollision();
ShapeBase *mount = shape->getObjectMount();
if (mount)
mount->disableCollision();
bool los = !gClientContainer.castRay(camPos, shapePos,losMask, &info);
shape->enableCollision();
if (mount)
mount->enableCollision();
if (!los)
continue;
// Project the shape pos into screen space and calculate
// the distance opacity used to fade the labels into the
// distance.
Point3F projPnt;
shapePos.z += mVerticalOffset;
if (!parent->project(shapePos, &projPnt))
continue;
F32 opacity = (shapeDist < fadeDistance)? 1.0:
1.0 - (shapeDist - fadeDistance) / (visDistance - fadeDistance);
// Render the shape's name
drawName(Point2I(projPnt.x, projPnt.y),shape->getShapeName(),opacity);
// Render the shape's damage bar
F32 damage = mClampF(1 - shape->getDamageValue(), 0, 1);
drawDamage(Point2I(projPnt.x, projPnt.y),damage,opacity);
}
}
}
// Restore control object collision
control->enableCollision();
}
void ShapeNameHud::drawName(Point2I offset, const char *name, F32 opacity)
{
// Center the name
offset.x -= mProfile->mFont->getStrWidth(name) / 2;
offset.y -= mProfile->mFont->getHeight();
//
mTextColor.alpha = opacity;
dglSetBitmapModulation(mTextColor);
dglDrawText(mProfile->mFont, offset, name);
dglClearBitmapModulation();
}
void ShapeNameHud::drawDamage(Point2I offset, F32 damage, F32 opacity)
{
mDamageFillColor.alpha = mDamageFrameColor.alpha = opacity;
// Center the bar
RectI rect(offset, mDamageRectSize);
rect.point.x -= mDamageRectSize.x / 2;
// Draw the border
dglDrawRect(rect, mDamageFrameColor);
// Draw the damage % fill
rect.point += Point2I(1, 1);
rect.extent -= Point2I(1, 1);
rect.extent.x = (S32)(rect.extent.x * damage);
if (rect.extent.x == 1)
rect.extent.x = 2;
if (rect.extent.x > 0)
dglDrawRectFill(rect, mDamageFillColor);
}

45
game/fps/shapeNameHud.h Normal file
View file

@ -0,0 +1,45 @@
//-----------------------------------------------------------------------------
// V12 Engine
//
// Copyright (c) 2001 GarageGames.Com
//-----------------------------------------------------------------------------
#ifndef _SHAPENAMEHUD_H_
#define _SHAPENAMEHUD_H_
#include "gui/guiControl.h"
class ShapeNameHud : public GuiControl {
typedef GuiControl Parent;
// field data
ColorF mFillColor;
ColorF mFrameColor;
ColorF mTextColor;
ColorF mDamageFillColor;
ColorF mDamageFrameColor;
Point2I mDamageRectSize;
F32 mOpacity;
F32 mVerticalOffset;
F32 mDistanceFade;
bool mShowFrame;
bool mShowFill;
protected:
void drawName( Point2I offset, const char *buf, F32 opacity);
void drawDamage(Point2I offset, F32 damage, F32 opacity);
public:
ShapeNameHud();
// GuiControl
virtual void onRender(Point2I offset,
const RectI &updateRect, GuiControl *firstResponder );
static void initPersistFields();
DECLARE_CONOBJECT( ShapeNameHud );
};
#endif