Esempio n. 1
0
void PlayerOptions::Approach( const PlayerOptions& other, float fDeltaSeconds )
{
#define APPROACH( opt ) \
	fapproach( m_ ## opt, other.m_ ## opt, fDeltaSeconds * other.m_Speed ## opt );
#define DO_COPY( x ) \
	x = other.x;

	DO_COPY( m_LifeType );
	DO_COPY( m_DrainType );
	DO_COPY( m_BatteryLives );
	APPROACH( fTimeSpacing );
	APPROACH( fScrollSpeed );
	APPROACH( fMaxScrollBPM );
	fapproach( m_fScrollBPM, other.m_fScrollBPM, fDeltaSeconds * other.m_SpeedfScrollBPM*150 );
	for( int i=0; i<NUM_ACCELS; i++ )
		APPROACH( fAccels[i] );
	for( int i=0; i<NUM_EFFECTS; i++ )
		APPROACH( fEffects[i] );
	for( int i=0; i<NUM_APPEARANCES; i++ )
		APPROACH( fAppearances[i] );
	for( int i=0; i<NUM_SCROLLS; i++ )
		APPROACH( fScrolls[i] );
	APPROACH( fDark );
	APPROACH( fBlind );
	APPROACH( fCover );
	APPROACH( fRandAttack );
	APPROACH( fNoAttack );
	APPROACH( fPlayerAutoPlay );
	APPROACH( fPerspectiveTilt );
	APPROACH( fSkew );
	APPROACH( fPassmark );
	APPROACH( fRandomSpeed );

	DO_COPY( m_bSetScrollSpeed );
	for( int i=0; i<NUM_TURNS; i++ )
		DO_COPY( m_bTurns[i] );
	for( int i=0; i<NUM_TRANSFORMS; i++ )
		DO_COPY( m_bTransforms[i] );
	DO_COPY( m_bMuteOnError );
	DO_COPY( m_FailType );
	DO_COPY( m_MinTNSToHideNotes );
	DO_COPY( m_sNoteSkin );
#undef APPROACH
#undef DO_COPY
}
Esempio n. 2
0
/* builds parameters list */
static int rmq_build_params(str* ev_name, evi_params_p ev_params)
{
    evi_param_p node;
    int len;
    char *buff, *int_s, *p, *end, *old;
    char quote = QUOTE_C, esc = ESC_C;

    if (ev_params && ev_params->flags & RMQ_FLAG) {
        LM_DBG("buffer already built\n");
        return rmq_buffer_len;
    }

    rmq_buffer_len = 0;

    /* first is event name - cannot be larger than the buffer size */
    memcpy(rmq_buffer, ev_name->s, ev_name->len);
    rmq_buffer_len = ev_name->len;
    buff = rmq_buffer + ev_name->len;

    if (!ev_params)
        goto end;

    for (node = ev_params->first; node; node = node->next) {
        *buff = PARAM_SEP;
        buff++;

        /* parameter name */
        if (node->name.len && node->name.s) {
            DO_COPY(buff, node->name.s, node->name.len);
            DO_COPY(buff, ATTR_SEP_S, ATTR_SEP_LEN);
        }

        if (node->flags & EVI_STR_VAL) {
            /* it is a string value */
            if (node->val.s.len && node->val.s.s) {
                len++;
                /* check to see if enclose is needed */
                end = node->val.s.s + node->val.s.len;
                for (p = node->val.s.s; p < end; p++)
                    if (*p == PARAM_SEP)
                        break;
                if (p == end) {
                    /* copy the whole buffer */
                    DO_COPY(buff, node->val.s.s, node->val.s.len);
                } else {
                    DO_COPY(buff, &quote, 1);
                    old = node->val.s.s;
                    /* search for '"' to escape */
                    for (p = node->val.s.s; p < end; p++)
                        if (*p == QUOTE_C) {
                            DO_COPY(buff, old, p - old);
                            DO_COPY(buff, &esc, 1);
                            old = p;
                        }
                    /* copy the rest of the string */
                    DO_COPY(buff, old, p - old);
                    DO_COPY(buff, &quote, 1);
                }
            }
        } else if (node->flags & EVI_INT_VAL) {
            int_s = int2str(node->val.n, &len);
            DO_COPY(buff, int_s, len);
        } else {
            LM_DBG("unknown parameter type [%x]\n", node->flags);
        }
    }

end:
    /* set buffer end */
    *buff = 0;
    rmq_buffer_len = buff - rmq_buffer + 1;
    if (ev_params)
        ev_params->flags |= RMQ_FLAG;

    return rmq_buffer_len;
}