Example #1
0
void    plDynamicTextMap::FrameRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color )
{
    if( !IIsValid() )
        return;

    if( x + width > fWidth )
        width = (uint16_t)(fWidth - x);
    if( y + height > fHeight )
        height = (uint16_t)(fHeight - y);

    // Shouldn't be much harder
    uint32_t i, hex = color.ToARGB32();
    uint32_t *dest1, *dest2;

    dest1 = GetAddr32( x, y );
    dest2 = GetAddr32( x, y + height - 1 );
    for( i = 0; i < width; i++ )
        dest1[ i ] = dest2[ i ] = hex;

    for( i = 0; i < height; i++ )
    {
        dest1[ 0 ] = dest1[ width - 1 ] = hex;
        dest1 += fWidth;
    }
}
Example #2
0
void    plDynamicTextMap::DrawImage( uint16_t x, uint16_t y, plMipmap *image, DrawMethods method )
{
    if( !IIsValid() )
        return;

    plMipmap::CompositeOptions  opts;
    if( method == kImgNoAlpha )
    {
        if( fHasAlpha )
            opts.fFlags = plMipmap::kForceOpaque;
        else
            opts.fFlags = plMipmap::kCopySrcAlpha; // Don't care, this is fastest
    }
    else if( method == kImgBlend )
        opts.fFlags = 0;        // Default opts
    else if( method == kImgSprite )
        opts.fFlags = plMipmap::kCopySrcAlpha;

    Composite( image, x, y, &opts );

    /// HACK for now, since the alpha in the mipmap gets copied straight into the
    /// 32-bit color buffer, but our separate hacked alpha buffer hasn't been updated
/*  if( fHasAlpha && !respectAlpha )
    {
        HBRUSH brush = ::CreateSolidBrush( RGB( 255, 255, 255 ) );
        RECT rc;
        ::SetRect( &rc, x, y, x + image->GetWidth(), y + image->GetHeight() );
        ::FillRect( fWinAlphaDC, &rc, brush );
        ::DeleteObject( brush );
    }
*/
}
hsBool plVehicleComponent::SetupProperties(plMaxNode* node, plErrorMsg* pErrMsg)
{
    return false;
#if 0
    if (!IIsValid())
        return false;

    plMaxNode* chassis = (plMaxNode*)fCompPB->GetINode(kVehicleChassis);
    plMaxNode* wheelFR = (plMaxNode*)fCompPB->GetINode(kVehicleWheelFR);
    plMaxNode* wheelFL = (plMaxNode*)fCompPB->GetINode(kVehicleWheelFL);
    plMaxNode* wheelRR = (plMaxNode*)fCompPB->GetINode(kVehicleWheelRR);
    plMaxNode* wheelRL = (plMaxNode*)fCompPB->GetINode(kVehicleWheelRL);

    plMaxNode* hardpointFR = (plMaxNode*)fCompPB->GetINode(kVehicleHardpointFR);
    plMaxNode* hardpointFL = (plMaxNode*)fCompPB->GetINode(kVehicleHardpointFL);
    plMaxNode* hardpointRR = (plMaxNode*)fCompPB->GetINode(kVehicleHardpointRR);
    plMaxNode* hardpointRL = (plMaxNode*)fCompPB->GetINode(kVehicleHardpointRL);

    chassis->SetDrawable(false);

    hardpointFR->SetForceLocal(true);
    hardpointFL->SetForceLocal(true);
    hardpointRR->SetForceLocal(true);
    hardpointRL->SetForceLocal(true);

    SetupVehiclePhys(chassis, node, pErrMsg, true);
    SetupVehiclePhys(wheelFR, node, pErrMsg);
    SetupVehiclePhys(wheelFL, node, pErrMsg);
    SetupVehiclePhys(wheelRR, node, pErrMsg);
    SetupVehiclePhys(wheelRL, node, pErrMsg);

    return true;
#endif
}
Example #4
0
void    plDynamicTextMap::FlushToHost( void )
{
    if( !IIsValid() )
        return;

    // Dirty the mipmap's deviceRef, if there is one
    if( GetDeviceRef() != nil )
        GetDeviceRef()->SetDirty( true );
}
Example #5
0
void    plDynamicTextMap::DrawClippedString( int16_t x, int16_t y, const wchar_t *text, uint16_t clipX, uint16_t clipY, uint16_t width, uint16_t height )
{
    if( !IIsValid() )
        return;

    SetJustify( fJustify );
    fCurrFont->SetRenderClipping( clipX, clipY, width, height );
    fCurrFont->SetRenderColor( fFontColor.ToARGB32() );
    fCurrFont->RenderString( this, x, y, text );
}
Example #6
0
void    plDynamicTextMap::DrawWrappedString( uint16_t x, uint16_t y, const wchar_t *text, uint16_t width, uint16_t height, uint16_t *lastX, uint16_t *lastY )
{
    if( !IIsValid() )
        return;

    SetJustify( fJustify );
    fCurrFont->SetRenderWrapping( x, y, width, height );
    fCurrFont->SetRenderColor( fFontColor.ToARGB32() );
    fCurrFont->SetRenderFlag( plFont::kRenderIntoAlpha, fFontBlockRGB );
    fCurrFont->RenderString( this, x, y, text, lastX, lastY );
}
Example #7
0
void    plDynamicTextMap::DrawString( uint16_t x, uint16_t y, const wchar_t *text )
{
    if( !IIsValid() )
        return;

    SetJustify( fJustify );
    fCurrFont->SetRenderFlag( plFont::kRenderWrap | plFont::kRenderClip, false );
    fCurrFont->SetRenderColor( fFontColor.ToARGB32() );
    fCurrFont->SetRenderFlag( plFont::kRenderIntoAlpha, fFontBlockRGB );
    fCurrFont->RenderString( this, x, y, text );
}
Example #8
0
void    plDynamicTextMap::ClearToColor( hsColorRGBA &color )
{
    if( !IIsValid() )
        return;

    uint32_t      i, hex = color.ToARGB32();
    uint32_t      *data = (uint32_t *)fImage;

    // Buffer is of size fVisWidth x fVisHeight, so we need a bit of work to do this right
    for( i = 0; i < fHeight * fWidth; i++ )
        data[ i ] = hex;
}
hsBool plVehicleComponent::PreConvert(plMaxNode *pNode, plErrorMsg *pErrMsg)
{
    return false;
#if 0
    if (!IIsValid())
        return false;

    fMod = new plVehicleModifier;
    plKey modKey = pNode->AddModifier(fMod, IGetUniqueName(pNode));

    plMaxNode* detectorNode = (plMaxNode*)fCompPB->GetINode(kVehicleDriveDet);
    plComponentBase* comp = detectorNode ? detectorNode->ConvertToComponent() : nil;
    if (comp)
        comp->AddReceiverKey(modKey);

    return true;
#endif
}
Example #10
0
void    plDynamicTextMap::FillRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color )
{
    if( !IIsValid() )
        return;

    if( x + width > fWidth )
        width = (uint16_t)(fWidth - x);

    // Gee, how hard can it REALLY be?
    uint32_t i, hex = color.ToARGB32();
    height += y;
    if( height > fHeight )
        height = (uint16_t)fHeight;
    for( ; y < height; y++ )
    {
        uint32_t *destPtr = GetAddr32( x, y );
        for( i = 0; i < width; i++ )
            destPtr[ i ] = hex;
    }
}
Example #11
0
void    plDynamicTextMap::IClearFromBuffer( uint32_t *clearBuffer )
{
    int         y;
    uint32_t      *data = (uint32_t *)fImage, *srcData = clearBuffer;
    uint8_t       *destAlpha = nil;


    if( !IIsValid() )
        return;

    // Clear *all* to zero
    memset( data, 0, fWidth * fHeight * sizeof( uint32_t ) );

    // Buffer is of size fVisWidth x fVisHeight, so we need a bit of work to do this right
    for( y = 0; y < fVisHeight; y++ )
    {
        memcpy( data, srcData, fVisWidth * sizeof( uint32_t ) );
        data += fWidth;
        srcData += fVisWidth;
    }
}
hsBool plVehicleComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
{
    return false;
#if 0
    if (!IIsValid())
        return false;

    plMaxNode* chassis = (plMaxNode*)fCompPB->GetINode(kVehicleChassis);
    plMaxNode* wheelFR = (plMaxNode*)fCompPB->GetINode(kVehicleWheelFR);
    plMaxNode* wheelFL = (plMaxNode*)fCompPB->GetINode(kVehicleWheelFL);
    plMaxNode* wheelRR = (plMaxNode*)fCompPB->GetINode(kVehicleWheelRR);
    plMaxNode* wheelRL = (plMaxNode*)fCompPB->GetINode(kVehicleWheelRL);

    plMaxNode* hardpointFR = (plMaxNode*)fCompPB->GetINode(kVehicleHardpointFR);
    plMaxNode* hardpointFL = (plMaxNode*)fCompPB->GetINode(kVehicleHardpointFL);
    plMaxNode* hardpointRR = (plMaxNode*)fCompPB->GetINode(kVehicleHardpointRR);
    plMaxNode* hardpointRL = (plMaxNode*)fCompPB->GetINode(kVehicleHardpointRL);

    hsPoint3 chassisPos = chassis->GetLocalToWorld44().GetTranslate();

    plVehicleModifier::WheelProps wheelPropsFR, wheelPropsFL, wheelPropsRR, wheelPropsRL;

    GetSuspensionProps(hardpointFR, wheelFR, chassisPos, wheelPropsFR);
    GetSuspensionProps(hardpointFL, wheelFL, chassisPos, wheelPropsFL);
    GetSuspensionProps(hardpointRR, wheelRR, chassisPos, wheelPropsRR);
    GetSuspensionProps(hardpointRL, wheelRL, chassisPos, wheelPropsRL);

    fMod->Setup(chassis->GetKey(),
                wheelPropsFR,
                wheelPropsFL,
                wheelPropsRR,
                wheelPropsRL);

    return true;
#endif
}