void nsEudoraAddress::ProcessLine( const char *pLine, PRInt32 len, nsString& errors)
{
  if (len < 6)
    return;

  PRInt32  cnt;
  CAliasEntry  *pEntry;

  if (!strncmp( pLine, "alias", 5)) {
    pLine += 5;
    len -= 5;
    cnt = CountWhiteSpace( pLine, len);
    if (cnt) {
      pLine += cnt;
      len -= cnt;
      if ((pEntry = ProcessAlias( pLine, len, errors)) != nsnull) {
        m_alias.AppendElement( pEntry);
      }
    }
  }
  else if (!strncmp( pLine, "note", 4)) {
    pLine += 4;
    len -= 4;
    cnt = CountWhiteSpace( pLine, len);
    if (cnt) {
      pLine += cnt;
      len -= cnt;
      ProcessNote( pLine, len, errors);
    }
  }

  // as far as I know everything must be on one line
  // if not, then I need to add a state variable.
}
示例#2
0
//---------------------------------------------------------------------------
// CROFFSystem::ApplyROFF
//	Does the dirty work of applying the raw ROFF data
//
// INPUTS:
//	The the roff_entity struct and the raw roff data
//
// RETURN:
//	True == success;  False == roff playback complete or failure
//---------------------------------------------------------------------------
qboolean CROFFSystem::ApplyROFF( SROFFEntity *roff_ent, CROFFSystem::CROFF *roff )
{
	vec3_t			f, r, u, result;
	sharedEntity_t	*ent = NULL;
	trajectory_t	*originTrajectory, *angleTrajectory;
	vec_t			*origin, *angle;


	if ( svs.time < roff_ent->mNextROFFTime )
	{ // Not time to roff yet
		return qtrue;
	}

	if (roff_ent->mIsClient)
	{
#ifndef DEDICATED
		vec3_t		originTemp, angleTemp;
		originTrajectory = CGVM_GetOriginTrajectory( roff_ent->mEntID );
		angleTrajectory = CGVM_GetAngleTrajectory( roff_ent->mEntID );
		CGVM_GetOrigin( roff_ent->mEntID, originTemp );
		origin = originTemp;
		CGVM_GetAngles( roff_ent->mEntID, angleTemp );
		angle = angleTemp;
#endif
	}
	else
	{
		// Find the entity to apply the roff to
		ent = SV_GentityNum( roff_ent->mEntID );

		if ( ent == 0 )
		{	// bad stuff
			return qfalse;
		}

		originTrajectory = &ent->s.pos;
		angleTrajectory = &ent->s.apos;
		origin = ent->r.currentOrigin;
		angle = ent->r.currentAngles;
	}


	if ( roff_ent->mROFFFrame >= roff->mROFFEntries )
	{ // we are done roffing, so stop moving and flag this ent to be removed
		SetLerp( originTrajectory, TR_STATIONARY, origin, NULL, svs.time, roff->mLerp );
		SetLerp( angleTrajectory, TR_STATIONARY, angle, NULL, svs.time, roff->mLerp );
		if (!roff_ent->mIsClient)
		{
			ent->r.mIsRoffing = qfalse;
		}
		return qfalse;
	}

	if (roff_ent->mTranslated)
	{
		AngleVectors(roff_ent->mStartAngles, f, r, u );
		VectorScale(f, roff->mMoveRotateList[roff_ent->mROFFFrame].mOriginOffset[0], result);
		VectorMA(result, -roff->mMoveRotateList[roff_ent->mROFFFrame].mOriginOffset[1], r, result);
		VectorMA(result, roff->mMoveRotateList[roff_ent->mROFFFrame].mOriginOffset[2], u, result);
	}
	else
	{
		VectorCopy(roff->mMoveRotateList[roff_ent->mROFFFrame].mOriginOffset, result);
	}

	// Set up our origin interpolation
	SetLerp( originTrajectory, TR_LINEAR, origin, result, svs.time, roff->mLerp );

	// Set up our angle interpolation
	SetLerp( angleTrajectory, TR_LINEAR, angle, 
				roff->mMoveRotateList[roff_ent->mROFFFrame].mRotateOffset, svs.time, roff->mLerp );

	if (roff->mMoveRotateList[roff_ent->mROFFFrame].mStartNote >= 0)
	{
		int		i;

		for(i=0;i<roff->mMoveRotateList[roff_ent->mROFFFrame].mNumNotes;i++)
		{
			ProcessNote(roff_ent, roff->mNoteTrackIndexes[roff->mMoveRotateList[roff_ent->mROFFFrame].mStartNote + i]);
		}
	}

	// Advance ROFF frames and lock to a 10hz cycle
	roff_ent->mROFFFrame++;
	roff_ent->mNextROFFTime = svs.time + roff->mFrameTime;

	//rww - npcs need to know when they're getting roff'd
	ent->next_roff_time = roff_ent->mNextROFFTime;


	return qtrue;
}