예제 #1
0
void RWeaponTracks::AddVertex(RLVertex* pVert)
{
	if (false == IsTimeToAddVertex()) return;	// 높은 frame rate에 영향받지 않도록 시간계산해서 궤적을 업데이트함

	CheckShift();

	RLVertex* pV = &m_pVert[m_current_vertex_size];
	RWeaponSNode* pN = &m_pNode[m_current_node_size];

	pV->p = pVert->p;
	pV->color = pVert->color;
	pN->up = pVert->p;
	pN->color[0] = pVert->color;

	pV++;
	pVert++;

	pV->p = pVert->p;
	pV->color = pVert->color;
	pN->down = pVert->p;
	pN->color[1] = pVert->color;

	// calc_length
	if( m_current_node_size )
		pN->len =  Magnitude( m_pNode[m_current_node_size].up - m_pNode[m_current_node_size-1].up);
	else 
		pN->len = 0.f;

	m_current_vertex_size += 2;
	m_current_node_size++;
}
예제 #2
0
bool kexConsole::ProcessInput(const event_t *ev) {
    if(ev->type == ev_mousedown || ev->type == ev_mouseup ||
        ev->type == ev_mouse) {
            return false;
    }

    if(ev->type == ev_mousewheel && state == CON_STATE_DOWN) {
        switch(ev->data1) {
            case KM_BUTTON_SCROLL_UP:
                LineScroll(1);
                break;
            case KM_BUTTON_SCROLL_DOWN:
                LineScroll(0);
                break;
        }

        return true;
    }

    CheckShift(ev);
    CheckStickyKeys(ev);

    int c = ev->data1;

    switch(state) {
        case CON_STATE_DOWN:
            if(ev->type == ev_keydown) {
                switch(c) {
                    case KKEY_BACKQUOTE:
                        state = CON_STATE_UP;
                        inputSystem->MouseCenter();
                        return true;
                    case KKEY_RETURN:
                        ParseInput();
                        return true;
                    case KKEY_UP:
                        GetHistory(false);
                        return true;
                    case KKEY_DOWN:
                        GetHistory(true);
                        return true;
                    case KKEY_TAB:
                        cvarManager.AutoComplete(typeStr);
                        command.AutoComplete(typeStr);
                        return true;
                    default:
                        ParseKey(c);
                        return true;
                }

                return false;
            }
            break;
        case CON_STATE_UP:
            if(ev->type == ev_keydown) {
                switch(c) {
                    case KKEY_BACKQUOTE:
                        state = CON_STATE_DOWN;
                        return true;
                    default:
                        break;
                }

                return false;
            }
            break;
        default:
            return false;
    }

    return false;
}
예제 #3
0
int DecompressFast(BLOCK_DATA *Blk, USHORT NumWords)
{
    int	i, EncodeCount;
    short	ShiftVal[NSHIFTS];						// Shift values (one per SHIFTWIN words)
    USHORT	Method[MAX_DIFF_LOOPS];				// Block processing methods used per iteration

    #if	DB_BLOCKCHECK											// If debug mode block check enabled
        ULONG BlockCheck = BioRead(16);				// Read block check bits
    #endif

    int UsingShift = CheckShift(ShiftVal, NumWords, &Blk->PrevShift, &Blk->PrevUsedShift);
    int UsingBD4 = BioReadFlag();			// See if using BD4

    if (UsingBD4)
    {
        EncodeCount = InputDiff(Blk->BD4PrevEncodeCount);
        if (InvalidEncodeCount(EncodeCount, Blk->MaxBD4Loops))  return(GlobalErrorFlag = SFARKLIB_ERR_CORRUPT);
        Blk->BD4PrevEncodeCount = EncodeCount;
    }
    else	// Using BD2/3
    {
        EncodeCount = InputDiff(Blk->PrevEncodeCount);
        if (InvalidEncodeCount(EncodeCount, Blk->MaxLoops))  return(GlobalErrorFlag = SFARKLIB_ERR_CORRUPT);
        Blk->PrevEncodeCount = EncodeCount;

        for(i = 0; i < EncodeCount; i++)
            Method[i] = BioReadFlag();			// Read flags for BD2/3
    }

    // If using LPC, check for and read flags...
    ULONG LPCflags;
    int UsingLPC = (Blk->FileHeader.CompMethod != COMPRESSION_v2Fast);
    if (UsingLPC)
    {
        if (BioReadFlag())	// Any flags?
            LPCflags = BioRead(16) | (BioRead(16) << 16);	// Then read them (32 bits)
	else																						// else
            LPCflags = 0;
    }

    // Read the file and unpack the bitstream into buffer at Buf1p...
    if (int UnCrunchResult = UnCrunchWin(Blk->SrcBuf, NumWords, OPTWINSIZE) < 0)		// failed?
    {
        sprintf(MsgTxt, "ERROR - UnCrunchWin returned: %d %s", UnCrunchResult, CorruptedMsg);
	msg(MsgTxt, MSG_PopUp);
        return(GlobalErrorFlag = SFARKLIB_ERR_CORRUPT);
    }

    if (UsingLPC)
    {
        UnLPC(Blk->DstBuf, Blk->SrcBuf, NumWords, Blk->nc, &LPCflags);
	AWORD *SwapBuf = Blk->SrcBuf;  Blk->SrcBuf = Blk->DstBuf; Blk->DstBuf = SwapBuf;
    }
    
    if (UsingBD4)
    {
        for (i = EncodeCount-1; i >= 0; i--)
	{
            UnBufDif4(Blk->DstBuf, Blk->SrcBuf, NumWords, &(Blk->PrevIn[i]));
            AWORD *SwapBuf = Blk->SrcBuf;  Blk->SrcBuf = Blk->DstBuf; Blk->DstBuf = SwapBuf;
	}
    }
    else
    {
        for (i = EncodeCount-1; i >= 0; i--)
	{
            switch (Method[i])
            {
                case 0: UnBufDif2(Blk->DstBuf, Blk->SrcBuf, NumWords, &(Blk->PrevIn[i])); break;
                case 1: UnBufDif3(Blk->DstBuf, Blk->SrcBuf, NumWords, &(Blk->PrevIn[i])); break;
            }
            AWORD *SwapBuf = Blk->SrcBuf;  Blk->SrcBuf = Blk->DstBuf; Blk->DstBuf = SwapBuf;
	}
    }

    if (UsingShift)  UnBufShift(Blk->SrcBuf, NumWords, ShiftVal);

    #if	DB_BLOCKCHECK											// If debug mode block check enabled
	ULONG CalcBlockCheck = adler32(0, (const BYTE *) Blk->SrcBuf, 2*NumWords) & 0xffff;
	//ULONG CalcBlockCheck = Blk->FileCheck & 0xffff;
	//printf("Audio Block Checks Read: %ld, Calc %ld  Length=%d\n", BlockCheck, CalcBlockCheck, 2*NumWords);
	//getc(stdin);
	if (BlockCheck != CalcBlockCheck)			// Compare to calculated cheksum
	{
            msg("*** Audio Block check FAIL");
	}
	//else
        //  printf("Audio Block check Ok\n");
    #endif

    Blk->FileCheck = 2 * Blk->FileCheck + BufSum(Blk->SrcBuf, NumWords);
    return SFARKLIB_SUCCESS;
}