当前位置: 首页>>代码示例>>C++>>正文


C++ PM_AddEvent函数代码示例

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


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

示例1: PM_Toggle_HeloGear

/*
===================
PM_Toggle_Gear

===================
*/
void PM_Toggle_HeloGear()
{
	if( !(availableVehicles[pm->vehicle].caps & HC_GEAR) ) {
		return;
	}

	if( pm->ps->ONOFF & OO_LANDED ) {
		return;
	}

	if( pm->cmd.serverTime < pm->ps->timers[TIMER_GEAR] && pm->ps->timers[TIMER_GEARANIM] ) {
		return;
	}

	if( pm->ps->speed > availableVehicles[pm->vehicle].stallspeed * 10 * SPEED_GREEN_ARC ) {
		pm->ps->timers[TIMER_GEAR] = pm->cmd.serverTime + availableVehicles[pm->vehicle].gearTime + 100;
		return;
	}

	if( pm->ps->ONOFF & OO_GEAR ) {
		PM_AddEvent( EV_GEAR_UP );
		pm->ps->timers[TIMER_GEARANIM] = pm->cmd.serverTime + availableVehicles[pm->vehicle].gearTime;
//		pm->ps->ONOFF &= ~OO_GEAR;
	}
	else {
		PM_AddEvent( EV_GEAR_DOWN );
		pm->ps->timers[TIMER_GEARANIM] = pm->cmd.serverTime + availableVehicles[pm->vehicle].gearTime;
//		pm->ps->ONOFF |= OO_GEAR;
	}
	pm->ps->timers[TIMER_GEAR] = pm->cmd.serverTime + availableVehicles[pm->vehicle].gearTime + 100;
}
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:37,代码来源:bg_helomove.c

示例2: PM_WaterEvents

/*
==============
PM_WaterEvents

Generate sound events for entering and leaving water
==============
*/
static void PM_WaterEvents( void ) {		// FIXME?
	//
	// if just entered a water volume, play a sound
	//
	if (!pml.previous_waterlevel && pm->waterlevel) {
		PM_AddEvent( EV_WATER_TOUCH );
	}

	//
	// if just completely exited a water volume, play a sound
	//
	if (pml.previous_waterlevel && !pm->waterlevel) {
		PM_AddEvent( EV_WATER_LEAVE );
	}

	//
	// check for head just going under water
	//
	if (pml.previous_waterlevel != 3 && pm->waterlevel == 3) {
		PM_AddEvent( EV_WATER_UNDER );
	}

	//
	// check for head just coming out of water
	//
	if (pml.previous_waterlevel == 3 && pm->waterlevel != 3) {
		PM_AddEvent( EV_WATER_CLEAR );
	}
}
开发者ID:mecwerks,项目名称:spearmint-ios,代码行数:36,代码来源:bg_pmove.c

示例3: PM_CheckJump

/*
=============
PM_CheckJump
=============
*/
static qboolean PM_CheckJump( void ) {
	if ( pm->ps->pm_flags & PMF_RESPAWNED ) {
		return qfalse;		// don't allow jump until all buttons are up
	}

	if ( pm->cmd.upmove < 10 ) {
		// not holding jump
		return qfalse;
	}

	// must wait for jump to be released
	if ( pm->ps->pm_flags & PMF_JUMP_HELD ) {
		// clear upmove so cmdscale doesn't lower running speed
		pm->cmd.upmove = 0;
		return qfalse;
	}

	pml.groundPlane = qfalse;		// jumping away
	pml.walking = qfalse;
	pm->ps->pm_flags |= PMF_JUMP_HELD;

	pm->ps->groundEntityNum = ENTITYNUM_NONE;
	pm->ps->velocity[2] = JUMP_VELOCITY;
	PM_AddEvent( EV_JUMP );

	if ( pm->cmd.forwardmove >= 0 ) {
		PM_ForceLegsAnim( LEGS_JUMP );
		pm->ps->pm_flags &= ~PMF_BACKWARDS_JUMP;
	} else {
		PM_ForceLegsAnim( LEGS_JUMPB );
		pm->ps->pm_flags |= PMF_BACKWARDS_JUMP;
	}

	return qtrue;
}
开发者ID:mecwerks,项目名称:spearmint-ios,代码行数:40,代码来源:bg_pmove.c

示例4: PM_Animate

static void PM_Animate( void ) {
	if ( pm->cmd.buttons & BUTTON_GESTURE ) {
		if ( pm->ps->torsoTimer == 0 ) {
			PM_StartTorsoAnim( TORSO_GESTURE );
			pm->ps->torsoTimer = TIMER_GESTURE;
			PM_AddEvent( EV_TAUNT );
		}
	}
}
开发者ID:Clever-Boy,项目名称:entityplus,代码行数:9,代码来源:bg_pmove.c

示例5: PM_BeginWeaponReload

static void PM_BeginWeaponReload() { //works for kar98 sniper? rest not? mmhm
	
	pmove_t *xm = *(pmove_t**)(int)pm;
	
	int clientNum = *(int*)((int)xm->ps + 172);
	xclient_t *xcl = &xclients[clientNum];
	
	int *weapons = *(int**)((int)xm->ps + 796);
	int weapon = *(int*)((int)xm->ps + 176);
	int *weaponTime = (int*)((int)xm->ps + 44);
	int *weaponDelay = (int*)((int)xm->ps + 48);
	
	int weaponinfo = BG_GetInfoForWeapon(weapon);
	
	int *weaponstate = (int*)((int)xm->ps + 180);
	
	if(*weaponstate == WEAPON_READY || *weaponstate == WEAPON_FIRING || *weaponstate == WEAPON_RECHAMBERING) {
		int weapon = *(int*)((int)xm->ps + 176);
		if(weapon) {
			if(weapon <= BG_GetNumWeapons()) {
				
				int weaponinfo = BG_GetInfoForWeapon(weapon);
				
				if(!*(int*)(weaponinfo + 724))
					BG_AnimScriptEvent(xm->ps, 10, 0, 1);
				
				int v2 = *(int*)((int)pml + 132);
				
				if(*(int*)(v2 + 748) && *(int*)(v2 + 500)) {
					if(xm->ps->pm_type <= 5) {
						if(*(unsigned char*)((int)xm + 10)) {
							int v4 = *(int*)((int)xm->ps + 980) & 0x200;
							BYTE1(v4) ^= 2u;
							LOBYTE(v4) = 13;
							*(int*)((int)xm->ps + 980) = v4;
						}
					}
					if(xcl->perks[PERK_QUICK_RELOAD])
						*weaponTime = (int)(*(int*)(v2 + 500) / QUICK_RELOAD_FRACTION);
					else
						*weaponTime = *(int*)(v2 + 500);
					*weaponstate = WEAPON_RELOAD_START; //7
					
					PM_AddEvent(EV_RELOAD_START);
					PM_SetWeaponReloadAddAmmoDelay();//sub_377B8
					if(xcl->perks[PERK_QUICK_RELOAD])
						*weaponDelay = (int)(*weaponDelay / QUICK_RELOAD_FRACTION);
				} else {
					PM_SetReloadingState();//sub_378BC
				}
			}
		}
	}
}
开发者ID:EndlessClan,项目名称:CoDExtended,代码行数:54,代码来源:bg_pmove.c

示例6: PM_SetReloadingState

static void PM_SetReloadingState() {
	pmove_t *xm = *(pmove_t**)(int)pm;
	
	int clientNum = *(int*)((int)xm->ps + 172);
	xclient_t *xcl = &xclients[clientNum];
	
	int *weaponstate = (int*)((int)xm->ps + 180);
	int *weapons = *(int**)((int)xm->ps + 796);
	int weapon = *(int*)((int)xm->ps + 176);
	int *weaponTime = (int*)((int)xm->ps + 44);
	int *weaponDelay = (int*)((int)xm->ps + 48);
	
	int weaponinfo = BG_GetInfoForWeapon(weapon);
	
	int v2 = *(int*)((int)pml + 132);
	int event = EV_RELOAD_FROM_EMPTY, v3;
	if (*(int *)(4 * *(int *)(weaponinfo + 424) + (int)xm->ps + 524) || *(int *)(v2 + 112)) {
		if ( xm->ps->pm_type <= 5 ) {
			if (xm->cmd.wbuttons ) {
				v3 = *(int *)((int)xm->ps + 980) & 0x200;
				BYTE1(v3) ^= 2u;
				LOBYTE(v3) = 11;
				*(int *)((int)xm->ps + 980) = v3;
			}
		}
		if(!xcl->perks[PERK_QUICK_RELOAD])
		*weaponTime = *(int *)(v2 + 488);
		else
		*weaponTime = (int)(*(int *)(v2 + 488) / QUICK_RELOAD_FRACTION);
		event = EV_RELOAD;
	} else {
		if ( xm->ps->pm_type <= 5 ) {
			if (xm->cmd.wbuttons ) {
				v3 = *(int *)((int)xm->ps + 980) & 0x200;
				BYTE1(v3) ^= 2u;
				LOBYTE(v3) = 12;
				*(int *)((int)xm->ps + 980) = v3;
			}
		}
		if(!xcl->perks[PERK_QUICK_RELOAD])
		*weaponTime = *(int *)(v2 + 492);
		else
		*weaponTime = (int)(*(int *)(v2 + 492) / QUICK_RELOAD_FRACTION);
	}
	PM_AddEvent(event);
	if ( *weaponstate == 8 )
		*weaponstate = 6; //WEAPON_RELOADING_INTERRUPT??
	else
		*weaponstate = 5; //WEAPON_RELOADING
	//if(!reloadtime->integer)
	PM_SetWeaponReloadAddAmmoDelay();
	if(xcl->perks[PERK_QUICK_RELOAD])
		*weaponDelay = (int)(*weaponDelay / QUICK_RELOAD_FRACTION);
}
开发者ID:EndlessClan,项目名称:CoDExtended,代码行数:54,代码来源:bg_pmove.c

示例7: PM_StepEvent

/*
==================
PM_StepEvent
==================
*/
void PM_StepEvent( vec3_t from, vec3_t to, vec3_t normal )
{
  float   size;
  vec3_t  delta, dNormal;

  VectorSubtract( from, to, delta );
  VectorCopy( delta, dNormal );
  VectorNormalize( dNormal );

  size = DotProduct( normal, dNormal ) * VectorLength( delta );

  if( size > 0.0f )
  {
    if( size > 2.0f )
    {
      if( size < 7.0f )
        PM_AddEvent( EV_STEPDN_4 );
      else if( size < 11.0f )
        PM_AddEvent( EV_STEPDN_8 );
      else if( size < 15.0f )
        PM_AddEvent( EV_STEPDN_12 );
      else
        PM_AddEvent( EV_STEPDN_16 );
    }
  }
  else
  {
    size = fabs( size );

    if( size > 2.0f )
    {
      if( size < 7.0f )
        PM_AddEvent( EV_STEP_4 );
      else if( size < 11.0f )
        PM_AddEvent( EV_STEP_8 );
      else if( size < 15.0f )
        PM_AddEvent( EV_STEP_12 );
      else
        PM_AddEvent( EV_STEP_16 );
    }
  }

  if( pm->debugLevel )
    Com_Printf( "%i:stepped\n", c_pmove );
}
开发者ID:SolusChristus,项目名称:Tremulous_1.2_EDGEmod_rampEDGE,代码行数:50,代码来源:bg_slidemove.c

示例8: PM_BeginWeaponChange

/*
===============
PM_BeginWeaponChange
===============
*/
static void PM_BeginWeaponChange( int weapon ) {
	if ( weapon <= WP_NONE || weapon >= WP_NUM_WEAPONS ) {
		return;
	}

	if ( !( pm->ps->stats[STAT_WEAPONS] & ( 1 << weapon ) ) ) {
		return;
	}
	
	if ( pm->ps->weaponstate == WEAPON_DROPPING ) {
		return;
	}

	PM_AddEvent( EV_CHANGE_WEAPON );
	pm->ps->weaponstate = WEAPON_DROPPING;
	pm->ps->weaponTime += 200;
	PM_StartTorsoAnim( TORSO_DROP );
}
开发者ID:mecwerks,项目名称:spearmint-ios,代码行数:23,代码来源:bg_pmove.c

示例9: PM_Animate

static void PM_Animate( void ) {
	if ( pm->cmd.buttons & BUTTON_GESTURE ) {
		if ( pm->ps->torsoTimer == 0 ) {
			PM_StartTorsoAnim( TORSO_GESTURE );
			pm->ps->torsoTimer = TIMER_GESTURE;
			PM_AddEvent( EV_TAUNT );
		}
#ifdef MISSIONPACK
	} else if ( pm->cmd.buttons & BUTTON_GETFLAG ) {
		if ( pm->ps->torsoTimer == 0 ) {
			PM_StartTorsoAnim( TORSO_GETFLAG );
			pm->ps->torsoTimer = 600;	//TIMER_GESTURE;
		}
	} else if ( pm->cmd.buttons & BUTTON_GUARDBASE ) {
		if ( pm->ps->torsoTimer == 0 ) {
			PM_StartTorsoAnim( TORSO_GUARDBASE );
			pm->ps->torsoTimer = 600;	//TIMER_GESTURE;
		}
	} else if ( pm->cmd.buttons & BUTTON_PATROL ) {
		if ( pm->ps->torsoTimer == 0 ) {
			PM_StartTorsoAnim( TORSO_PATROL );
			pm->ps->torsoTimer = 600;	//TIMER_GESTURE;
		}
	} else if ( pm->cmd.buttons & BUTTON_FOLLOWME ) {
		if ( pm->ps->torsoTimer == 0 ) {
			PM_StartTorsoAnim( TORSO_FOLLOWME );
			pm->ps->torsoTimer = 600;	//TIMER_GESTURE;
		}
	} else if ( pm->cmd.buttons & BUTTON_AFFIRMATIVE ) {
		if ( pm->ps->torsoTimer == 0 ) {
			PM_StartTorsoAnim( TORSO_AFFIRMATIVE);
			pm->ps->torsoTimer = 600;	//TIMER_GESTURE;
		}
	} else if ( pm->cmd.buttons & BUTTON_NEGATIVE ) {
		if ( pm->ps->torsoTimer == 0 ) {
			PM_StartTorsoAnim( TORSO_NEGATIVE );
			pm->ps->torsoTimer = 600;	//TIMER_GESTURE;
		}
#endif
	}
}
开发者ID:mecwerks,项目名称:spearmint-ios,代码行数:41,代码来源:bg_pmove.c

示例10: Alien_nuke

/* Alien Nuke */
qboolean Alien_nuke( gentity_t *ent, int skiparg )
{
    //vic->client->ps.persistant[ PERS_CREDIT ]
    if( ent->client->ps.persistant[ PERS_CREDIT ] < 9 )
    {
        PM_AddEvent( EV_NOAMMO );
        ent->client->ps.weaponTime += 200;
        trap_SendServerCommand( ent-g_entities, va(
                                    "print \"^1You must have 9 evos\n\"" ) );
        return qtrue;
    }
    trap_SendServerCommand( ent-g_entities, va(
                                "print \"^1Nade Dropped\n\"" ) );
    //G_TeamCommand( PTE_HUMANS, "cp \"^1Alien Nuke Detected\" 1");
    ent->s.weapon = WP_GRENADE;
    //G_AddPredictableEvent( ent, EV_ALIEN_EVOLVE, 0 );

    FireWeapon( ent );
    ent->client->ps.persistant[ PERS_CREDIT ] = 0;
    ent->client->ps.stats[ STAT_HEALTH ] = ent->health = 0;
    return qtrue;
}
开发者ID:guzza,项目名称:Xserver,代码行数:23,代码来源:g_weapon.c

示例11: Blaster_ball

qboolean Blaster_ball( gentity_t *ent, int skiparg )
{
    //vic->client->ps.persistant[ PERS_CREDIT ]
    if( ent->client->pers.energy < 200 )
    {    
        trap_SendServerCommand( ent-g_entities, va(
        "print \"^1Blaster Ball Cost 200E and do 500dmg\n\"" ) ); 
            PM_AddEvent( EV_NOAMMO );
						ent->client->ps.weaponTime += 3000; //this will block the weapon 4 seconds.
            return qtrue;
    }
    /*trap_SendServerCommand( ent-g_entities, va(
        "print \"^1Nade Dropped\n\"" ) );*/
        //G_TeamCommand( PTE_HUMANS, "cp \"^1Alien Nuke Detected\" 1");
        ent->s.weapon = WP_GRENADE;
        ent->client->pers.blasterball = 1; 
        //G_AddPredictableEvent( ent, EV_ALIEN_EVOLVE, 0 );
     
        LCChargeFire( ent, qtrue ); 
        //FireWeapon( ent );
        //ent->client->pers.energy -= 200; #UNCOMMENT
        //ent->client->ps.stats[ STAT_HEALTH ] = ent->health = 0;
        return qtrue;
}
开发者ID:AlienHoboken,项目名称:Tremulous-W-Server,代码行数:24,代码来源:g_weapon.c

示例12: PM_HeloMove

void PM_HeloMove( void ) 
{
    vec3_t	viewdir;
    vec3_t	vehdir;
    vec3_t	diff;
    vec3_t	turnspeed;
    float	targroll;
    bool	dead = (pm->ps->stats[STAT_HEALTH] <= 0);
	bool	verydead = (pm->ps->stats[STAT_HEALTH] <= GIB_HEALTH);
    int		i;
//	int		anim = 0;
	// Speed related stuff
    float	throttle = pm->ps->fixed_throttle;
    int		maxthrottle = availableVehicles[pm->vehicle].maxthrottle;
//	int		maxforwardspeed = availableVehicles[pm->vehicle].maxspeed;
//	int		maxrightspeed = availableVehicles[pm->vehicle].turnspeed[YAW];
//	int		maxliftspeed = maxforwardspeed*0.00525;
//	int		maxspeed = sqrt(maxforwardspeed*maxforwardspeed + maxrightspeed*maxrightspeed + maxliftspeed*maxliftspeed);
	float	curforwardspeed;
	float	curliftspeed;
	float	currightspeed;
//	float	curspeed = pm->ps->speed;
	vec3_t  forwardvel,rightvel, liftvel, deltavel;
	// Turret stuff
	vec3_t		forward, up;
	vec3_t		temp;
	float		turret_yaw = pm->ps->turretAngle;
	float		gun_pitch = pm->ps->gunAngle;
	vec3_t		turretdir;
	float		min, max;
	float		turnModifier = 1.0f;

	if( verydead ) return;

	// clear FX
	pm->ps->ONOFF &= ~OO_VAPOR;


	// gear
	if( !dead && (pm->cmd.buttons & BUTTON_GEAR) ) {
		PM_Toggle_HeloGear();
	}

	// gearanim
	if( !dead && pm->ps->timers[TIMER_GEARANIM] &&
		pm->cmd.serverTime >= pm->ps->timers[TIMER_GEARANIM] ) {
		pm->ps->timers[TIMER_GEARANIM] = 0;
		if( pm->ps->ONOFF & OO_GEAR ) {
			pm->ps->ONOFF &= ~OO_GEAR;
		} else {
			pm->ps->ONOFF |= OO_GEAR;
		}
	}
	// update gear
	if( pm->updateGear ) {
		// sync anim
		if( pm->ps->ONOFF & OO_GEAR ) {
			PM_AddEvent( EV_GEAR_DOWN_FULL );
		} else {
			PM_AddEvent( EV_GEAR_UP_FULL );
		}
		pm->updateGear = false;
	}

	// get the actual turret angles
	AngleVectors( pm->ps->vehicleAngles, forward, 0, up );
	RotatePointAroundVector( temp, up, forward, turret_yaw );
	vectoangles( temp, turretdir );
	turretdir[PITCH] += gun_pitch;

    // local vectors
    VectorCopy( pm->ps->vehicleAngles, vehdir );
	if( pm->ps->ONOFF & OO_LANDED ) vehdir[PITCH] = vehdir[ROLL] = 0;

	//
	// Set current speeds (Do it here to allow more realistic crash)
	//
	if((pm->ps->ONOFF & OO_LANDED) && (throttle > maxthrottle))
		pm->ps->fixed_throttle = throttle = 0;
	curforwardspeed = (vehdir[PITCH]/MAX_HELO_PITCH)*availableVehicles[pm->vehicle].maxspeed;
	currightspeed = (vehdir[ROLL]/MAX_HELO_ROLL)*availableVehicles[pm->vehicle].turnspeed[YAW];
	curliftspeed = throttle > maxthrottle ? -(throttle-maxthrottle)*20 : throttle * 25;	
			// Forward speed
			VectorCopy(vehdir, forwardvel);
			forwardvel[PITCH] = 0;				// Don't let vehicle angels effect verticle acceleration
			AngleVectors(forwardvel, forwardvel, NULL, NULL );
			VectorScale(forwardvel, curforwardspeed, forwardvel);

			// Sideways speed
			VectorCopy(vehdir,  rightvel);
			rightvel[PITCH] = rightvel[ROLL] = 0;
			AngleVectors( rightvel,  NULL, rightvel, NULL );
			VectorScale( rightvel, currightspeed*2.5, rightvel );

			// Lift Speed
			VectorCopy(vehdir,  liftvel);
			liftvel[PITCH] = liftvel[YAW] = 0;
			AngleVectors( liftvel, NULL , NULL, liftvel );
			VectorScale( liftvel, curliftspeed, liftvel );

//.........这里部分代码省略.........
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:101,代码来源:bg_helomove.c

示例13: PM_Weapon

/*
==============
PM_Weapon

Generates weapon events and modifes the weapon counter
==============
*/
static void PM_Weapon( void ) {
	int		addTime;
	int		newWeapon;

	// don't allow attack until all buttons are up
	if ( pm->ps->pm_flags & PMF_RESPAWNED ) {
		return;
	}

	// ignore if spectator
	if ( pm->ps->persistant[PERS_TEAM] == TEAM_SPECTATOR ) {
		return;
	}

	// check for dead player
	if ( pm->ps->stats[STAT_HEALTH] <= 0 ) {
		pm->ps->weapon = WP_NONE;
		return;
	}

	// check for item using
	if ( pm->cmd.buttons & BUTTON_USE_HOLDABLE ) {
		if ( ! ( pm->ps->pm_flags & PMF_USE_ITEM_HELD ) ) {
			if ( bg_itemlist[pm->ps->stats[STAT_HOLDABLE_ITEM]].giTag == HI_MEDKIT
				&& pm->ps->stats[STAT_HEALTH] >= (pm->ps->stats[STAT_MAX_HEALTH] + 25) ) {
				// don't use medkit if at max health
			} else {
				pm->ps->pm_flags |= PMF_USE_ITEM_HELD;
				PM_AddEvent( EV_USE_ITEM0 + bg_itemlist[pm->ps->stats[STAT_HOLDABLE_ITEM]].giTag );
				pm->ps->stats[STAT_HOLDABLE_ITEM] = 0;
			}
			return;
		}
	} else {
		pm->ps->pm_flags &= ~PMF_USE_ITEM_HELD;
	}


	// make weapon function
	if ( pm->ps->weaponTime > 0 ) {
		pm->ps->weaponTime -= pml.msec;
	}

	// check for weapon change
	// can't change if weapon is firing, but can change
	// again if lowering or raising
	if ( pm->ps->weaponTime <= 0 || pm->ps->weaponstate != WEAPON_FIRING ) {
		BG_DecomposeUserCmdValue( pm->cmd.stateValue, &newWeapon );
		if ( pm->ps->weapon != newWeapon ) {
			PM_BeginWeaponChange( newWeapon );
		}
	}

	if ( pm->ps->weaponTime > 0 ) {
		return;
	}

	// change weapon if time
	if ( pm->ps->weaponstate == WEAPON_DROPPING ) {
		PM_FinishWeaponChange();
		return;
	}

	if ( pm->ps->weaponstate == WEAPON_RAISING ) {
		pm->ps->weaponstate = WEAPON_READY;
		if ( pm->ps->weapon == WP_GAUNTLET ) {
			PM_StartTorsoAnim( TORSO_STAND2 );
		} else {
			PM_StartTorsoAnim( TORSO_STAND );
		}
		return;
	}

	// check for fire
	if ( ! (pm->cmd.buttons & BUTTON_ATTACK) ) {
		pm->ps->weaponTime = 0;
		pm->ps->weaponstate = WEAPON_READY;
		return;
	}

	// start the animation even if out of ammo
	if ( pm->ps->weapon == WP_GAUNTLET ) {
		// the guantlet only "fires" when it actually hits something
		if ( !pm->gauntletHit ) {
			pm->ps->weaponTime = 0;
			pm->ps->weaponstate = WEAPON_READY;
			return;
		}
		PM_StartTorsoAnim( TORSO_ATTACK2 );
	} else {
		PM_StartTorsoAnim( TORSO_ATTACK );
	}

//.........这里部分代码省略.........
开发者ID:mecwerks,项目名称:spearmint-ios,代码行数:101,代码来源:bg_pmove.c

示例14: PM_Footsteps

/*
===============
PM_Footsteps
===============
*/
static void PM_Footsteps( void ) {
	float		bobmove;
	int			old;
	qboolean	footstep;

	//
	// calculate speed and cycle to be used for
	// all cyclic walking effects
	//
	pm->xyspeed = sqrt( pm->ps->velocity[0] * pm->ps->velocity[0]
		+  pm->ps->velocity[1] * pm->ps->velocity[1] );

	if ( pm->ps->groundEntityNum == ENTITYNUM_NONE ) {

		if ( pm->ps->powerups[PW_INVULNERABILITY] ) {
			PM_ContinueLegsAnim( LEGS_IDLECR );
		}
		// airborne leaves position in cycle intact, but doesn't advance
		if ( pm->waterlevel > 1 ) {
			PM_ContinueLegsAnim( LEGS_SWIM );
		}
		return;
	}

	// if not trying to move
	if ( !pm->cmd.forwardmove && !pm->cmd.rightmove ) {
		if (  pm->xyspeed < 5 ) {
			pm->ps->bobCycle = 0;	// start at beginning of cycle again
			if ( pm->ps->pm_flags & PMF_DUCKED ) {
				PM_ContinueLegsAnim( LEGS_IDLECR );
			} else {
				PM_ContinueLegsAnim( LEGS_IDLE );
			}
		}
		return;
	}
	

	footstep = qfalse;

	if ( pm->ps->pm_flags & PMF_DUCKED ) {
		bobmove = 0.5;	// ducked characters bob much faster
		if ( pm->ps->pm_flags & PMF_BACKWARDS_RUN ) {
			PM_ContinueLegsAnim( LEGS_BACKCR );
		}
		else {
			PM_ContinueLegsAnim( LEGS_WALKCR );
		}
		// ducked characters never play footsteps
	/*
	} else 	if ( pm->ps->pm_flags & PMF_BACKWARDS_RUN ) {
		if ( !( pm->cmd.buttons & BUTTON_WALKING ) ) {
			bobmove = 0.4;	// faster speeds bob faster
			footstep = qtrue;
		} else {
			bobmove = 0.3;
		}
		PM_ContinueLegsAnim( LEGS_BACK );
	*/
	} else {
		if ( !( pm->cmd.buttons & BUTTON_WALKING ) ) {
			bobmove = 0.4f;	// faster speeds bob faster
			if ( pm->ps->pm_flags & PMF_BACKWARDS_RUN ) {
				PM_ContinueLegsAnim( LEGS_BACK );
			}
			else {
				PM_ContinueLegsAnim( LEGS_RUN );
			}
			footstep = qtrue;
		} else {
			bobmove = 0.3f;	// walking bobs slow
			if ( pm->ps->pm_flags & PMF_BACKWARDS_RUN ) {
				PM_ContinueLegsAnim( LEGS_BACKWALK );
			}
			else {
				PM_ContinueLegsAnim( LEGS_WALK );
			}
		}
	}

	// check for footstep / splash sounds
	old = pm->ps->bobCycle;
	pm->ps->bobCycle = (int)( old + bobmove * pml.msec ) & 255;

	// if we just crossed a cycle boundary, play an apropriate footstep event
	if ( ( ( old + 64 ) ^ ( pm->ps->bobCycle + 64 ) ) & 128 ) {
		if ( pm->waterlevel == 0 ) {
			// on ground will only play sounds if running
			if ( footstep && !pm->noFootsteps ) {
				PM_AddEvent( PM_FootstepForSurface() );
			}
		} else if ( pm->waterlevel == 1 ) {
			// splashing
			PM_AddEvent( EV_FOOTSPLASH );
		} else if ( pm->waterlevel == 2 ) {
//.........这里部分代码省略.........
开发者ID:mecwerks,项目名称:spearmint-ios,代码行数:101,代码来源:bg_pmove.c

示例15: PM_Weapon_CheckForRechamber

static int PM_Weapon_CheckForRechamber(int time) {
	return 0;
	#define int_ptr_val(x) (*(int*)((int)x))
	pmove_t *xm = *(pmove_t**)(int)pm;
	
	#define ps_off(type, off) (*(type*)((int)xm->ps + off))
	
	int *weaponstate = (int*)((int)xm->ps + 180);
	int *weapons = *(int**)((int)xm->ps + 796);
	int weapon = *(int*)((int)xm->ps + 176);
	int *weaponTime = (int*)((int)xm->ps + 44);
	int *weaponDelay = (int*)((int)xm->ps + 48);
	
	int v2 = *(int*)((int)pml + 132);
	
	if(!int_ptr_val(v2 + 712))
		return 0;
	
	if(!COM_BitCheck(weapons, weapon))
		return 0;

	if(*weaponstate == WEAPON_RECHAMBERING) {
		if(time) {
			COM_BitClear(weapons, weapon);
			PM_AddEvent(EV_EJECT_BRASS);
			if(*weaponTime)
				return 1;
		}
	}
	
	if(!*weaponTime || ((*weaponstate - WEAPON_FIRING) > WEAPON_RAISING && *weaponstate != WEAPON_MELEE_WINDUP && *weaponstate != WEAPON_MELEE_RELAX && !*weaponDelay)) {
		if(*weaponstate == WEAPON_RECHAMBERING) {
			if(xm->cmd.wbuttons) {
				int *v9 = (int*)((int)xm->ps + 980);
				if(*v9 & 0xFFFFFDFF) {
					if(xm->ps->pm_type <= 5) {
						int v6 = *v9 & 0x200;
						BYTE1(v6) ^= 2;
						*v9 = v6;
					}
				}
			}
			*weaponstate = WEAPON_READY;
			return 0;
		}
	}
	
	if(*weaponstate == WEAPON_READY) {
		if(xm->ps->pm_type > 5 || !xm->cmd.wbuttons)
			goto label_27;
			/*
			
        v8 = 0.75 < *(float *)(v2 + 184);
        v9 = 0;
        v10 = 0.75 == *(float *)(v2 + 184);
        if ( (HIBYTE(v7) & 0x45) == 1 )
        {
          if ( *(_DWORD *)(v2 + 4) > 5 || !*(_BYTE *)(xm + 10) )
            goto LABEL_27;
          v11 = *(_DWORD *)(v2 + 980) & 0x200;
          BYTE1(v11) ^= 2u;
          LOBYTE(v11) = 7;
        }
        else
        {
          if ( *(_DWORD *)(v2 + 4) > 5 || !*(_BYTE *)(xm + 10) )
            goto LABEL_27;
          v11 = *(_DWORD *)(v2 + 980) & 0x200;
          BYTE1(v11) ^= 2u;
          LOBYTE(v11) = 4;
        }
        *(_DWORD *)(v2 + 980) = v11;
		*/
			//set cool stuff for keys?
		//ps_off(int,980) = 
		label_27:
		*weaponstate = WEAPON_RECHAMBERING;
		*weaponTime = int_ptr_val(v2 + 472);
		
		int v13 = int_ptr_val(v2 + 476);
		/*
		if(v13 && v13 < *weaponTime)
			*weaponDelay = v13;
		else
			*weaponDelay = 1;*/
		PM_AddEvent(EV_RECHAMBER_WEAPON);
	}
	
	return 0;
	#undef int_ptr_val
}
开发者ID:EndlessClan,项目名称:CoDExtended,代码行数:91,代码来源:bg_pmove.c


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