Esempio n. 1
0
void _L1TXX( short xpos, short ypos, char _WCI86FAR * str,
/*========*/ struct xycoord _WCI86FAR * concat, struct xycoord _WCI86FAR * extent )

/*  Inquire the extents of the character drawing parallelogram and
    return the concatenation point. The concatenation point is the same
    as the drawing point if it cannot be calculated exactly.    */

{
    short               hor;        /* horizontal alignment */
    short               vert;       /* vertical alignment   */
    struct xycoord      up;         /* character up vector  */
    struct xycoord      base;       /* character base line vector   */
    struct xycoord      space;      /* spacing between characters   */
    struct xycoord      length;     /* horizontal side of parallelogram */
    struct xycoord      height;     /* vertical side of parallelogram   */
    struct xycoord      trans;      /* translation for parallelogram    */

    GetVectors( &base, &up );
    GetAlignment( &hor, &vert );
    CalcSpacing( &base, &up, &space );
    CalcSides( &length, &height, &base, &up, &space, str );
    CalcTranslation( &trans, &length, &height, &up, hor, vert );
    CalcCorners( extent, &length, &height, &trans, xpos, ypos );
    if( _TextSettings.txpath == _PATH_RIGHT ||
        _TextSettings.txpath == _PATH_LEFT ) {
        CalcConcat( concat, &length, &space, xpos, ypos, hor, vert );
    } else {
        CalcConcat( concat, &height, &space, xpos, ypos, hor, vert );
    }
}
Esempio n. 2
0
void _L1Text( short xpos, short ypos, char _WCI86FAR * str )
/*=====================================================

    Draw the character string pointed to by "str" at the position
    (xpos, ypos) using the current graphics text settings.  */

{
    short               hor;        /* horizontal alignment */
    short               vert;       /* vertical alignment   */
    struct xycoord      up;         /* character up vector  */
    struct xycoord      base;       /* character base line vector   */
    struct xycoord      prop;       /* adjustment vector for prop. font */
    struct xycoord      nommove;    /* nominal displacement vector  */
    struct xycoord      space;      /* spacing between characters   */
    struct xycoord      length;     /* horizontal side of parallelogram */
    struct xycoord      height;     /* vertical side of parallelogram   */
    struct xycoord      trans;      /* translation for parallelogram    */
    struct xycoord      corner[4];  /*  0 - lower left  */
                                    /*  1 - lower right */
                                    /*  2 - upper right */
                                    /*  3 - upper left  */
    if( *str == '\0' ) {
        _ErrorStatus = _GRNOOUTPUT;
        return;
    }
    if( _TextSettings.height == 0 || _TextSettings.width == 0 ) {
        _ErrorStatus = _GRNOOUTPUT;
        return;
    }
    GetVectors( &base, &up );
    GetAlignment( &hor, &vert );
    CalcSpacing( &base, &up, &space );
    CalcSides( &length, &height, &base, &up, &space, str );
    CalcTranslation( &trans, &length, &height, &up, hor, vert );
    CalcCorners( &corner, &length, &height, &trans, xpos, ypos );
    if( _TextSettings.txpath == _PATH_UP ) {    /* select proper corner for */
        xpos = corner[ 0 ].xcoord;              /* text starting position   */
        ypos = corner[ 0 ].ycoord;
    } else {
        xpos = corner[ _TextSettings.txpath ].xcoord;
        ypos = corner[ _TextSettings.txpath ].ycoord;
    }
    if( _TextSettings.txpath == _PATH_RIGHT ||
        _TextSettings.txpath == _PATH_LEFT ) {
        while( *str != '\0' ) {
            CalcNominal( &base, &up, &prop, &nommove, &space, *str );
            if( _TextSettings.txpath == _PATH_RIGHT ) {
                _HershDraw( *str, up.xcoord, -up.ycoord,
                            prop.xcoord, -prop.ycoord, xpos, ypos );
            } else {
                _HershDraw( *str, up.xcoord, -up.ycoord,
                            prop.xcoord, -prop.ycoord,
                            xpos-prop.xcoord, ypos+prop.ycoord );
            }
            xpos += nommove.xcoord;
            ypos -= nommove.ycoord;
            str++;
        }
    } else {                                        /* path is Up or DOWN   */
        if( _TextSettings.txpath == _PATH_DOWN ) {
            xpos -= up.xcoord;                      /* special increment*/
            ypos += up.ycoord;                      /* for path down    */
        }
        while( *str != '\0' ) {
            CalcNominal( &base, &up, &prop, &nommove, &space, *str );
            _HershDraw( *str, up.xcoord, -up.ycoord,
                        prop.xcoord, -prop.ycoord,
                        xpos + ( length.xcoord-prop.xcoord ) / 2,
                        ypos - ( length.ycoord-prop.ycoord ) / 2 );
            xpos += nommove.xcoord;
            ypos -= nommove.ycoord;
            str++;
        }
    }
    _RefreshWindow();
}
void EERIEDrawAnimQuatUpdate(EERIE_3DOBJ * eobj,
                             AnimLayer * animlayer,
                             const Anglef & angle,
                             const Vec3f & pos,
                             AnimationDuration time,
                             Entity * io,
                             bool update_movement
) {

	ARX_PROFILE_FUNC();
	
	if(io) {
		float speedfactor = io->basespeed + io->speed_modif;

		if(speedfactor < 0)
			speedfactor = 0;

		AnimationDuration tim = time * speedfactor;

		if(tim <= AnimationDuration_ZERO)
			time = AnimationDuration_ZERO;
		else
			time = tim;
	}

	if(time > AnimationDuration_ZERO) {
		for(size_t count = 0; count < MAX_ANIM_LAYERS; count++) {
			AnimLayer & layer = animlayer[count];
			if(layer.cur_anim)
				PrepareAnim(layer, time, io);
		}
	}

	// Set scale and invisibility factors
	// Scaling Value for this object (Movements will also be scaled)
	float scale = (io) ? io->scale : 1.f;

	// Only layer 0 controls movement
	Vec3f ftr = CalcTranslation(animlayer[0]);


	if(update_movement)
		StoreEntityMovement(io, ftr, scale);

	if(io && io != entities.player() && !Cedric_IO_Visible(io->pos))
		return;

	glm::quat rotation;

	bool isNpc = io && (io->ioflags & IO_NPC);
	if(!isNpc) {
		// To correct invalid angle in Animated FIX/ITEMS
		rotation = glm::toQuat(toRotationMatrix(angle));
	} else {
		rotation = QuatFromAngles(angle);
	}

	EERIE_EXTRA_ROTATE * extraRotation = NULL;
	AnimationBlendStatus * animBlend = NULL;

	if(io && (io->ioflags & IO_NPC) && io->_npcdata->ex_rotate) {
		extraRotation = io->_npcdata->ex_rotate;
	}

	if(io) {
		animBlend = &io->animBlend;
	}

	EERIE_EXTRA_SCALE extraScale;

	if(BH_MODE && eobj->fastaccess.head_group != ObjVertGroup()) {
		extraScale.groupIndex = eobj->fastaccess.head_group;
		extraScale.scale = Vec3f_ONE;
	}

	arx_assert(eobj->m_skeleton);
	Skeleton & skeleton = *eobj->m_skeleton;

	Cedric_AnimateDrawEntity(skeleton, animlayer, extraRotation, animBlend, extraScale);

	// Build skeleton in Object Space
	TransformInfo t(pos, rotation, scale, ftr);
	Cedric_ConcatenateTM(skeleton, t);

	Cedric_TransformVerts(eobj, pos);
	if(io) {
		io->bbox3D = UpdateBbox3d(eobj);
	}

	Cedric_ViewProjectTransform(eobj);
	if(io) {
		io->bbox2D = Cedric_UpdateBbox2d(*eobj);
	}
}