• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FIXED_TO_INT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FIXED_TO_INT函数的典型用法代码示例。如果您正苦于以下问题:C++ FIXED_TO_INT函数的具体用法?C++ FIXED_TO_INT怎么用?C++ FIXED_TO_INT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FIXED_TO_INT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CG_UI_DrawProportionalString

/*
=================
CG_UI_DrawProportionalString
=================
*/
void CG_UI_DrawProportionalString( int x, int y, const char* str, int style, vec4_t color ) {
	vec4_t	drawcolor;
	int		width;
	gfixed	sizeScale;

	sizeScale = CG_UI_ProportionalSizeScale( style );

	switch( style & UI_FORMATMASK ) {
		case UI_CENTER:
			width = FIXED_TO_INT(MAKE_GFIXED(CG_UI_ProportionalStringWidth( str ) ) * sizeScale);
			x -= width / 2;
			break;

		case UI_RIGHT:
			width = FIXED_TO_INT(MAKE_GFIXED(CG_UI_ProportionalStringWidth( str ) ) * sizeScale);
			x -= width;
			break;

		case UI_LEFT:
		default:
			break;
	}

	if ( style & UI_DROPSHADOW ) {
		drawcolor[0] = drawcolor[1] = drawcolor[2] = GFIXED_0;
		drawcolor[3] = color[3];
		CG_UI_DrawProportionalString2( x+2, y+2, str, drawcolor, sizeScale, cgs.media.charsetProp );
	}

	if ( style & UI_INVERSE ) {
		drawcolor[0] = color[0] * GFIXED(0,8);
		drawcolor[1] = color[1] * GFIXED(0,8);
		drawcolor[2] = color[2] * GFIXED(0,8);
		drawcolor[3] = color[3];
		CG_UI_DrawProportionalString2( x, y, str, drawcolor, sizeScale, cgs.media.charsetProp );
		return;
	}

	if ( style & UI_PULSE ) {
		drawcolor[0] = color[0] * GFIXED(0,8);
		drawcolor[1] = color[1] * GFIXED(0,8);
		drawcolor[2] = color[2] * GFIXED(0,8);
		drawcolor[3] = color[3];
		CG_UI_DrawProportionalString2( x, y, str, color, sizeScale, cgs.media.charsetProp );

		drawcolor[0] = color[0];
		drawcolor[1] = color[1];
		drawcolor[2] = color[2];
		drawcolor[3] = GFIXED(0,5) + GFIXED(0,5) * FIXED_SIN( FIXED_INT32RATIO_G(cg.time,PULSE_DIVISOR) );
		CG_UI_DrawProportionalString2( x, y, str, drawcolor, sizeScale, cgs.media.charsetPropGlow );
		return;
	}

	CG_UI_DrawProportionalString2( x, y, str, color, sizeScale, cgs.media.charsetProp );
}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:60,代码来源:cg_drawtools.cpp


示例2: CG_BubbleTrail

/*
==================
CG_BubbleTrail

Bullets shot underwater
==================
*/
void CG_BubbleTrail( bvec3_t start, bvec3_t end, bfixed spacing ) {
	bvec3_t		move;
	bvec3_t		vec;
	bfixed		len;
	int			i;

	if ( cg_noProjectileTrail.integer ) {
		return;
	}

	VectorCopy (start, move);
	VectorSubtract (end, start, vec);
	len = VectorNormalize (vec);

	// advance a random amount first
	i = rand() % FIXED_TO_INT(spacing);
	FIXED_VEC3MA( move, MAKE_BFIXED(i), vec, move );

	FIXED_VEC3SCALE (vec, spacing, vec);

	for ( ; MAKE_BFIXED(i) < len; i += FIXED_TO_INT(spacing) ) {
		localEntity_t	*le;
		refEntity_t		*re;

		le = CG_AllocLocalEntity();
		le->leFlags = LEF_PUFF_DONT_SCALE;
		le->leType = LE_MOVE_SCALE_FADE;
		le->startTime = cg.time;
		le->endTime = cg.time + 1000 + FIXED_TO_INT(random() * GFIXED(250,0));
		le->lifeRate = FIXED_INT32RATIO_G(1,( le->endTime - le->startTime ));

		re = &le->refEntity;
		re->shaderTime = MSECTIME_G(cg.time);

		re->reType = RT_SPRITE;
		re->rotation = AFIXED_0;
		re->radius = BFIXED(3,0);
		re->customShader = cgs.media.waterBubbleShader;
		re->shaderRGBA[0] = 0xff;
		re->shaderRGBA[1] = 0xff;
		re->shaderRGBA[2] = 0xff;
		re->shaderRGBA[3] = 0xff;

		le->color[3] = GFIXED_1;

		le->pos.trType = TR_LINEAR;
		le->pos.trTime = cg.time;
		VectorCopy( move, le->pos.trBase );
		le->pos.trDelta[0] = crandom_b()*BFIXED(5,0);
		le->pos.trDelta[1] = crandom_b()*BFIXED(5,0);
		le->pos.trDelta[2] = crandom_b()*BFIXED(5,0) + BFIXED(6,0);

		VectorAdd (move, vec, move);
	}
}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:62,代码来源:cg_effects.cpp


示例3: dungeon2_wild_pokemon_sample_level_boundaries

void dungeon2_wild_pokemon_sample_level_boundaries(u8 *level_min, u8 *level_max, u8 mean,
    u8 std_deviation, dungeon_generator2 *dg2) {
  FIXED fx1 = FIXED_ADD(INT_TO_FIXED(mean), FIXED_MUL(INT_TO_FIXED(std_deviation),
      dungeon2_rnd_normal(dg2)));
  FIXED fx2 = FIXED_ADD(INT_TO_FIXED(mean), FIXED_MUL(INT_TO_FIXED(std_deviation),
      dungeon2_rnd_normal(dg2)));
  int x1 = min(100, max(2, FIXED_TO_INT(fx1)));
  int x2 = min(100, max(2, FIXED_TO_INT(fx2)));
  *level_min = (u8)min(x1, x2);
  *level_max = (u8)max(x1, x2);
}
开发者ID:WodkaRHR,项目名称:Violet_Sources,代码行数:11,代码来源:wild_pokemon.c


示例4: CG_CenterGiantLine

/*
================
CG_CenterGiantLine
================
*/
static void CG_CenterGiantLine( gfixed y, const char *string ) {
	gfixed		x;
	vec4_t		color;

	color[0] = GFIXED_1;
	color[1] = GFIXED_1;
	color[2] = GFIXED_1;
	color[3] = GFIXED_1;

	x = GFIXED(0,5) * MAKE_GFIXED( 640 - GIANT_WIDTH * CG_DrawStrlen( string ) );

	CG_DrawStringExt( FIXED_TO_INT(x), FIXED_TO_INT(y), string, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 );
}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:18,代码来源:cg_scoreboard.cpp


示例5: _cmsBlessLUT8

// Precomputes tables for 8-bit on input devicelink. 
// 
LPLUT _cmsBlessLUT8(LPLUT Lut)
{
   int i, j;
   WORD StageABC[3];
   Fixed32 v1, v2, v3;
   LPL8PARAMS p8; 
   LPL16PARAMS p = &Lut ->CLut16params;

  
   p8 = (LPL8PARAMS) malloc(sizeof(L8PARAMS));
   if (p8 == NULL) return NULL;

  // values comes * 257, so we can safely take first byte (x << 8 + x)
  // if there are prelinearization, is already smelted in tables

   for (i=0; i < 256; i++) {

           StageABC[0] = StageABC[1] = StageABC[2] = RGB_8_TO_16(i);

           if (Lut ->wFlags & LUT_HASTL1) {

              for (j=0; j < 3; j++)
                     StageABC[i] = cmsLinearInterpLUT16(StageABC[i],
                                                        Lut -> L1[i],
                                                       &Lut -> In16params);
              Lut ->wFlags &= ~LUT_HASTL1;
           }
    
               
           v1 = ToFixedDomain(StageABC[0] * p -> Domain);
           v2 = ToFixedDomain(StageABC[1] * p -> Domain);
           v3 = ToFixedDomain(StageABC[2] * p -> Domain);

           p8 ->X0[i] = p->opta3 * FIXED_TO_INT(v1);
           p8 ->Y0[i] = p->opta2 * FIXED_TO_INT(v2);
           p8 ->Z0[i] = p->opta1 * FIXED_TO_INT(v3);

           p8 ->rx[i] = (WORD) FIXED_REST_TO_INT(v1);
           p8 ->ry[i] = (WORD) FIXED_REST_TO_INT(v2);
           p8 ->rz[i] = (WORD) FIXED_REST_TO_INT(v3);
  
  }

   Lut -> CLut16params.p8 = p8;
   Lut -> CLut16params.Interp3D = cmsTetrahedralInterp8;

   return Lut;

}
开发者ID:Andy-Hay,项目名称:LightZone,代码行数:51,代码来源:cmslut.c


示例6: CG_LaunchExplode

/*
==================
CG_LaunchGib
==================
*/
void CG_LaunchExplode( bvec3_t origin, bvec3_t velocity, qhandle_t hModel ) {
	localEntity_t	*le;
	refEntity_t		*re;

	le = CG_AllocLocalEntity();
	re = &le->refEntity;

	le->leType = LE_FRAGMENT;
	le->startTime = cg.time;
	le->endTime = le->startTime + 10000 + FIXED_TO_INT(random() * GFIXED(6000,0));

	VectorCopy( origin, re->origin );
	AxisCopy( aaxisDefault, re->axis );
	re->hModel = hModel;

	le->pos.trType = TR_GRAVITY;
	VectorCopy( origin, le->pos.trBase );
	VectorCopy( velocity, le->pos.trDelta );
	le->pos.trTime = cg.time;

	le->bounceFactor = BFIXED(0,1);

	le->leBounceSoundType = LEBS_BRASS;
	le->leMarkType = LEMT_NONE;
}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:30,代码来源:cg_effects.cpp


示例7: CheckArmor

/*
================
CheckArmor
================
*/
int CheckArmor (gentity_t *ent, int damage, int dflags)
{
	gclient_t	*client;
	int			save;
	int			count;

	if (!damage)
		return 0;

	client = ent->client;

	if (!client)
		return 0;

	if (dflags & DAMAGE_NO_ARMOR)
		return 0;

	// armor
	count = client->ps.stats[STAT_ARMOR];
	save = FIXED_TO_INT(FIXED_CEIL( MAKE_GFIXED(damage) * ARMOR_PROTECTION ));
	if (save >= count)
		save = count;

	if (!save)
		return 0;

	client->ps.stats[STAT_ARMOR] -= save;

	return save;
}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:35,代码来源:g_combat.cpp


示例8: Eval8Inputs

static
void Eval8Inputs(WORD StageABC[], WORD StageLMN[], WORD LutTable[], LPL16PARAMS p16)
{       
       Fixed32 fk;
       Fixed32 k0, rk;
       int K0, K1;
       LPWORD T;
       int i;
       WORD Tmp1[MAXCHANNELS], Tmp2[MAXCHANNELS];

       
       fk = ToFixedDomain((Fixed32) StageABC[0] * p16 -> Domain);
       k0 = FIXED_TO_INT(fk);
       rk = FIXED_REST_TO_INT(fk);

       K0 = p16 -> opta8 * k0;
       K1 = p16 -> opta8 * (k0 + (StageABC[0] != 0xFFFFU ? 1 : 0));

       p16 -> nInputs = 7;

       T = LutTable + K0;

       Eval7Inputs(StageABC + 1, Tmp1, T, p16);

       T = LutTable + K1;

       Eval7Inputs(StageABC + 1, Tmp2, T, p16);

       p16 -> nInputs = 8;
       for (i=0; i < p16 -> nOutputs; i++)
       {
              StageLMN[i] = (WORD) FixedLERP(rk, Tmp1[i], Tmp2[i]);
       }

}
开发者ID:ahadzi,项目名称:celtx,代码行数:35,代码来源:cmsintrp.c


示例9: CG_AddSpriteExplosion

/*
================
CG_AddSpriteExplosion
================
*/
static void CG_AddSpriteExplosion( localEntity_t *le ) {
	refEntity_t	re;
	gfixed c;

	re = le->refEntity;

	c = FIXED_INT32RATIO_G(( le->endTime - cg.time ),( le->endTime - le->startTime ));
	if ( c > GFIXED_1 ) {
		c = GFIXED_1;	// can happen during connection problems
	}

	re.shaderRGBA[0] = 255;
	re.shaderRGBA[1] = 255;
	re.shaderRGBA[2] = 255;
	re.shaderRGBA[3] = FIXED_TO_INT(GFIXED(255,0) * c * GFIXED(0,33));

	re.reType = RT_SPRITE;
	re.radius = BFIXED(42,0) * MAKE_BFIXED( GFIXED_1 - c ) + BFIXED(30,0);

	_CG_trap_R_AddRefEntityToScene( &re );

	// add the dlight
	if ( FIXED_NOT_ZERO(le->light) ) {
		gfixed		light;

		light = FIXED_INT32RATIO_G(( cg.time - le->startTime ),( le->endTime - le->startTime ));
		if ( light < GFIXED(0,5) ) {
			light = GFIXED_1;
		} else {
			light = GFIXED_1 - ( light - GFIXED(0,5) ) * GFIXED(2,0);
		}
		light = le->light * light;
		_CG_trap_R_AddLightToScene(re.origin, light, le->lightColor[0], le->lightColor[1], le->lightColor[2] );
	}
}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:40,代码来源:cg_localents.cpp


示例10: CG_AddFallScaleFade

/*
=================
CG_AddFallScaleFade

This is just an optimized CG_AddMoveScaleFade
For blood mists that drift down, fade out, and are
removed if the view passes through them.
There are often 100+ of these, so it needs to be simple.
=================
*/
static void CG_AddFallScaleFade( localEntity_t *le ) {
	refEntity_t	*re;
	gfixed		c;
	bvec3_t		delta;
	bfixed		len;

	re = &le->refEntity;

	// fade time
	c = MAKE_GFIXED( le->endTime - cg.time ) * le->lifeRate;

	re->shaderRGBA[3] = FIXED_TO_INT(GFIXED(255,0) * c * le->color[3]);

	re->origin[2] = le->pos.trBase[2] - MAKE_BFIXED( GFIXED_1 - c ) * le->pos.trDelta[2];

	re->radius = le->radius * MAKE_BFIXED( GFIXED_1 - c ) + BFIXED(16,0);

	// if the view would be "inside" the sprite, kill the sprite
	// so it doesn't add too much overdraw
	VectorSubtract( re->origin, cg.refdef.vieworg, delta );
	len = FIXED_VEC3LEN( delta );
	if ( len < le->radius ) {
		CG_FreeLocalEntity( le );
		return;
	}

	_CG_trap_R_AddRefEntityToScene( re );
}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:38,代码来源:cg_localents.cpp


示例11: UI_SetBestScore

/*
===============
UI_SetBestScore

Set the player's best finish for a level
===============
*/
void UI_SetBestScore( int level, int score ) {
	int		skill;
	int		oldScore;
	char	arenaKey[16];
	char	scores[MAX_INFO_VALUE];

	// validate score
	if( score < 1 || score > 8 ) {
		return;
	}

	// validate skill
	skill = FIXED_TO_INT(_UI_trap_Cvar_VariableValue( "g_spSkill" ));
	if( skill < 1 || skill > 5 ) {
		return;
	}

	// get scores
	_UI_trap_Cvar_VariableStringBuffer( va( "g_spScores%i", skill ), scores, MAX_INFO_VALUE );

	// see if this is better
	Com_sprintf( arenaKey, sizeof( arenaKey ), "l%i", level );
	oldScore = atoi( Info_ValueForKey( scores, arenaKey ) );
	if( oldScore && oldScore <= score ) {
		return;
	}

	// update scores
	Info_SetValueForKey( scores, arenaKey, va( "%i", score ) );
	_UI_trap_Cvar_Set( va( "g_spScores%i", skill ), scores );
}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:38,代码来源:ui_gameinfo.cpp


示例12: CG_AddFadeRGB

/*
====================
CG_AddFadeRGB
====================
*/
void CG_AddFadeRGB( localEntity_t *le ) {
	refEntity_t *re;
	gfixed c;

	re = &le->refEntity;

	c = MAKE_GFIXED( le->endTime - cg.time ) * le->lifeRate;
	c *= GFIXED(255,0);

	re->shaderRGBA[0] = FIXED_TO_INT(le->color[0] * c);
	re->shaderRGBA[1] = FIXED_TO_INT(le->color[1] * c);
	re->shaderRGBA[2] = FIXED_TO_INT(le->color[2] * c);
	re->shaderRGBA[3] = FIXED_TO_INT(le->color[3] * c);

	_CG_trap_R_AddRefEntityToScene( re );
}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:21,代码来源:cg_localents.cpp


示例13: CG_ReflectVelocity

/*
================
CG_ReflectVelocity
================
*/
void CG_ReflectVelocity( localEntity_t *le, trace_t *trace ) {
	bvec3_t	velocity;
	bfixed	dot;
	int		hitTime;

	// reflect the velocity on the trace plane
	hitTime = cg.time - cg.frametime + FIXED_TO_INT(MAKE_GFIXED(cg.frametime) * trace->fraction);
	BG_EvaluateTrajectoryDelta( &le->pos, hitTime, velocity );
	dot = FIXED_VEC3DOT( velocity, trace->plane.normal );
	FIXED_VEC3MA_R( velocity, -BFIXED(2,0)*dot, trace->plane.normal, le->pos.trDelta );

	FIXED_VEC3SCALE( le->pos.trDelta, le->bounceFactor, le->pos.trDelta );

	VectorCopy( trace->endpos, le->pos.trBase );
	le->pos.trTime = cg.time;


	// check for stop, making sure that even on low FPS systems it doesn't bobble
	if ( trace->allsolid || 
		( trace->plane.normal[2] > AFIXED_0 && 
		( le->pos.trDelta[2] < BFIXED(40,0) || le->pos.trDelta[2] < -MAKE_BFIXED(cg.frametime) * le->pos.trDelta[2] ) ) ) {
		le->pos.trType = TR_STATIONARY;
	} else {

	}
}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:31,代码来源:cg_localents.cpp


示例14: playerUpdate

void playerUpdate(PlayerData* pData, unsigned long dt) {
  Note note;
  
  if (pData->pNote == 0) {
    // end of data reached
    return;
  }
  
  pData->elapsedMsec += FIXED_MAKE(dt);
  if (pData->elapsedMsec < pData->t) {
    dprintf(
        "interpolate: elapsedMsec=%d t=%d\n",
        FIXED_TO_INT(pData->elapsedMsec), FIXED_TO_INT(pData->t));
    // interpolate
    FIXED tt = (pData->t == 0) ? FIXED_MAKE(1) : FIXED_DIV(pData->elapsedMsec, pData->t);
    pData->r = lerp(pData->r0, pData->r1, tt);
    pData->g = lerp(pData->g0, pData->g1, tt);
    pData->b = lerp(pData->b0, pData->b1, tt);
    
  } else {
    while (pData->elapsedMsec >= pData->t) {
      // advance index and see if end of data reached
      ++pData->pNote;
      memcpy_P(&note, pData->pNote, sizeof(note));

      if (note.msec < 0) {
        // set the final color
        pData->r = pData->r1;
        pData->g = pData->g1;
        pData->b = pData->b1;
	pData->pNote = 0;
	return;
      }

      pData->r = pData->r0 = pData->r1;
      pData->g = pData->g0 = pData->g1;
      pData->b = pData->b0 = pData->b1;

      pData->r1 = FIXED_MAKE(note.r);
      pData->g1 = FIXED_MAKE(note.g);
      pData->b1 = FIXED_MAKE(note.b);

      pData->t = FIXED_MAKE(note.msec);
      pData->elapsedMsec -= pData->t;
    }
  }
}
开发者ID:8bitter,项目名称:Arduino,代码行数:47,代码来源:player.c


示例15: AAS_Setup

//===========================================================================
// called when the library is first loaded
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
int AAS_Setup(void)
{
	aasworld.maxclients = FIXED_TO_INT(LibVarValue("maxclients", "128"));
	aasworld.maxentities = FIXED_TO_INT(LibVarValue("maxentities", "1024"));
	// as soon as it's set to 1 the routing cache will be saved
	saveroutingcache = LibVar("saveroutingcache", "0");
	//allocate memory for the entities
	if (aasworld.entities) FreeMemory(aasworld.entities);
	aasworld.entities = (aas_entity_t *) GetClearedHunkMemory(aasworld.maxentities * sizeof(aas_entity_t));
	//invalidate all the entities
	AAS_InvalidateEntities();
	//force some recalculations
	//LibVarSet("forceclustering", "1");			//force clustering calculation
	//LibVarSet("forcereachability", "1");		//force reachability calculation
	aasworld.numframes = 0;
	return BLERR_NOERROR;
} //end of the function AAS_Setup
开发者ID:Jsoucek,项目名称:q3ce,代码行数:24,代码来源:be_aas_main.cpp


示例16: main

int main(void) {

    // Init PIC24
    InitMain();

    // Init modules
    AudioInInit();
    Uart2Init(UART_BAUD_250000, 0);
    LedsInit();

    // Main loop
    while(1) {
        if(AudioInIsGetReady()) {
            Fixed audioSample = AudioInGet();

            // Update LEDs
            LedsUpdate(audioSample);

            // Print audio sample
            Uart2RxTasks();
            if(Uart2IsPutReady() >= 6) {
                static const char asciiDigits[10] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
                int i = FIXED_TO_INT(audioSample);
                div_t n;
                int print = 0;
                if(i < 0) {
                    Uart2PutChar('-');
                    i = -i;
                }
                if(i >= 10000) {
                    n = div(i, 10000);
                    Uart2PutChar(asciiDigits[n.quot]);
                    i = n.rem;
                    print = 1;
                }
                if(i >= 1000 || print) {
                    n = div(i, 1000);
                    Uart2PutChar(asciiDigits[n.quot]);
                    i = n.rem;
                    print = 1;
                }
                if(i >= 100 || print) {
                    n = div(i, 100);
                    Uart2PutChar(asciiDigits[n.quot]);
                    i = n.rem;
                    print = 1;
                }
                if(i >= 10 || print) {
                    n = div(i, 10);
                    Uart2PutChar(asciiDigits[n.quot]);
                    i = n.rem;
                }
                Uart2PutChar(asciiDigits[i]);
                Uart2PutChar('\r');
            }
        }
    }
}
开发者ID:xioTechnologies,项目名称:DressCode-Firmware,代码行数:58,代码来源:main.c


示例17: while

/*
===========
SelectRandomFurthestSpawnPoint

Chooses a player start, deathmatch start, etc
============
*/
gentity_t *SelectRandomFurthestSpawnPoint ( bvec3_t avoidPoint, bvec3_t origin, avec3_t angles ) {
	gentity_t	*spot;
	bvec3_t		delta;
	bfixed		dist;
	bfixed		list_dist[64];
	gentity_t	*list_spot[64];
	int			numSpots, rnd, i, j;

	numSpots = 0;
	spot = NULL;

	while ((spot = G_Find (spot, FOFS(classname), "info_player_deathmatch")) != NULL) {
		if ( SpotWouldTelefrag( spot ) ) {
			continue;
		}
		VectorSubtract( spot->s.origin, avoidPoint, delta );
		dist = FIXED_VEC3LEN( delta );
		for (i = 0; i < numSpots; i++) {
			if ( dist > list_dist[i] ) {
				if ( numSpots >= 64 )
					numSpots = 64-1;
				for (j = numSpots; j > i; j--) {
					list_dist[j] = list_dist[j-1];
					list_spot[j] = list_spot[j-1];
				}
				list_dist[i] = dist;
				list_spot[i] = spot;
				numSpots++;
				if (numSpots > 64)
					numSpots = 64;
				break;
			}
		}
		if (i >= numSpots && numSpots < 64) {
			list_dist[numSpots] = dist;
			list_spot[numSpots] = spot;
			numSpots++;
		}
	}
	if (!numSpots) {
		spot = G_Find( NULL, FOFS(classname), "info_player_deathmatch");
		if (!spot)
			G_Error( "Couldn't find a spawn point" );
		VectorCopy (spot->s.origin, origin);
		origin[2] += BFIXED(9,0);
		VectorCopy (spot->s.angles, angles);
		return spot;
	}

	// select a random spot from the spawn points furthest away
	rnd = FIXED_TO_INT(random() * FIXED_DIVPOW2(MAKE_GFIXED(numSpots),1));

	VectorCopy (list_spot[rnd]->s.origin, origin);
	origin[2] += BFIXED(9,0);
	VectorCopy (list_spot[rnd]->s.angles, angles);

	return list_spot[rnd];
}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:65,代码来源:g_client.cpp


示例18: AnimateObject

Bool AnimateObject(object_node *obj, int dt)
{
   Bool need_redraw = False;
   list_type over_list;

   if (OF_FLICKERING == (OF_FLICKERING & obj->flags))
   {
      obj->lightAdjust = rand() % FLICKER_LEVEL;
      need_redraw = TRUE;
   }

   if (OF_FLASHING == (OF_FLASHING & obj->flags))
   {
      DWORD angleFlash;
      obj->bounceTime += min(dt,50);
      if (obj->bounceTime > TIME_FLASH)
         obj->bounceTime -= TIME_FLASH;
      angleFlash = NUMDEGREES * obj->bounceTime / TIME_FLASH;
      obj->lightAdjust = FIXED_TO_INT(fpMul(FLASH_LEVEL, SIN(angleFlash)));
      need_redraw = TRUE;
   }

   if (obj->animate->animation != ANIMATE_NONE)
   {
      object_bitmap_type obj_bmap;
      obj_bmap = FindObjectBitmap(obj->icon_res);
      if (obj_bmap != NULL)
    need_redraw |= AnimateSingle(obj->animate, BitmapsNumGroups(obj_bmap->bmaps), dt);
   }
   
   if (OF_PHASING == (OF_PHASING & obj->flags))
   {
      int anglePhase;
      obj->phaseTime += min(dt,40);
      if (obj->phaseTime > TIME_FULL_OBJECT_PHASE)
         obj->phaseTime -= TIME_FULL_OBJECT_PHASE;
      anglePhase = numPhases * obj->phaseTime / TIME_FULL_OBJECT_PHASE;
      obj->drawingtype = phaseStates[anglePhase];
      need_redraw = TRUE;
   }
   // Animate object's overlays
   for (over_list = *(obj->overlays); over_list != NULL; over_list = over_list->next)
   {
      object_bitmap_type obj_bmap;
      Overlay *overlay = (Overlay *) (over_list->data);
      if (overlay->animate.animation == ANIMATE_NONE)
    continue;

      obj_bmap = FindObjectBitmap(overlay->icon_res);
      if (obj_bmap != NULL)
      {
    need_redraw |= AnimateSingle(&overlay->animate, BitmapsNumGroups(obj_bmap->bmaps), dt);
      }      
   }
   return need_redraw;
}
开发者ID:MorbusM59,项目名称:Meridian59,代码行数:56,代码来源:animate.c


示例19: T1_Get_Advances

  T1_Get_Advances( FT_Face    t1face,        /* T1_Face */
                   FT_UInt    first,
                   FT_UInt    count,
                   FT_Int32   load_flags,
                   FT_Fixed*  advances )
  {
    T1_Face        face  = (T1_Face)t1face;
    T1_DecoderRec  decoder;
    T1_Font        type1 = &face->type1;
    PSAux_Service  psaux = (PSAux_Service)face->psaux;
    FT_UInt        nn;
    FT_Error       error;


    if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
    {
      for ( nn = 0; nn < count; nn++ )
        advances[nn] = 0;

      return FT_Err_Ok;
    }

    error = psaux->t1_decoder_funcs->init( &decoder,
                                           (FT_Face)face,
                                           0, /* size       */
                                           0, /* glyph slot */
                                           (FT_Byte**)type1->glyph_names,
                                           face->blend,
                                           0,
                                           FT_RENDER_MODE_NORMAL,
                                           T1_Parse_Glyph );
    if ( error )
      return error;

    decoder.builder.metrics_only = 1;
    decoder.builder.load_points  = 0;

    decoder.num_subrs  = type1->num_subrs;
    decoder.subrs      = type1->subrs;
    decoder.subrs_len  = type1->subrs_len;
    decoder.subrs_hash = type1->subrs_hash;

    decoder.buildchar     = face->buildchar;
    decoder.len_buildchar = face->len_buildchar;

    for ( nn = 0; nn < count; nn++ )
    {
      error = T1_Parse_Glyph( &decoder, first + nn );
      if ( !error )
        advances[nn] = FIXED_TO_INT( decoder.builder.advance.x );
      else
        advances[nn] = 0;
    }

    return FT_Err_Ok;
  }
开发者ID:UnknownShadow200,项目名称:ClassicalSharp,代码行数:56,代码来源:t1gload.c


示例20: LookAtKiller

/*
==================
LookAtKiller
==================
*/
void LookAtKiller( gentity_t *self, gentity_t *inflictor, gentity_t *attacker ) {
	bvec3_t		dir;
	avec3_t		angles;

	if ( attacker && attacker != self ) {
		VectorSubtract (attacker->s.pos.trBase, self->s.pos.trBase, dir);
	} else if ( inflictor && inflictor != self ) {
		VectorSubtract (inflictor->s.pos.trBase, self->s.pos.trBase, dir);
	} else {
		self->client->ps.stats[STAT_DEAD_YAW] = FIXED_TO_INT(self->s.angles[YAW]);
		return;
	}

	self->client->ps.stats[STAT_DEAD_YAW] = FIXED_TO_INT(vectoyaw ( dir ));

	angles[YAW] = vectoyaw ( dir );
	angles[PITCH] = AFIXED_0; 
	angles[ROLL] = AFIXED_0;
}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:24,代码来源:g_combat.cpp



注:本文中的FIXED_TO_INT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FIXNUM_P函数代码示例发布时间:2022-05-30
下一篇:
C++ FIX2LONG函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap