Esempio n. 1
0
uint32_t CDisassembler::GetNextBlockAddress( uint32_t block_addr )
{
	int blocki;
	if( (blocki = GetBlockIndex( block_addr )) == -1 ) return 0;
	if( blocki + 1 >= BlockList.GetNumEntries() ) return 0;

	return BlockList[blocki+1].Start;
}
Esempio n. 2
0
int CDisassembler::SetFunctionDescriptor( uint32_t func_addr )
{
	int functioni, blocki;
	if( (functioni = GetFunctionIndex( func_addr )) == -1 ) return -1;
	FunctionDescriptor = functioni;
	if( (blocki = GetBlockIndex( func_addr )) == -1 ) return -1;
	BlockDescriptor = blocki;

	return 0;
}
Esempio n. 3
0
/*	Ta metoda jest odpowiedzilna, za czêœæ fizyczn¹ poziomu
buduje, m.in. punkty i p³aszczyzny, w oparciu o które
bêd¹ wykrywane kolizje.
*/
void CLevel::BuildPhysic()
{
	if( !loaded )
		return;

	//GUI.SendConMsg( "Poziom: Tworzenie czesci fizycznej...", false );

	CollisionMng.SetBlockSize( blockWidth, blockDepth );
	CollisionMng.SetLevelSize( Rows, Cols );
	for( unsigned row = 0; row < Rows; row++ )
	{
		for( unsigned col = 0; col < Cols; col++ )
		{
			auto pBlock = this->GetBlock( col, row );

			CCollisionBlock block( GetBlockIndex( col, row ) );

			std::vector<Vector3f> verts;

			GenSurfaceVerts( (LEV_SURFACE)(unsigned)( pBlock->walls & ( (unsigned)LEV_SURFACE::FLOOR) ), verts );
			GenSurfaceVerts( (LEV_SURFACE)(unsigned)( pBlock->walls & ( (unsigned)LEV_SURFACE::CEILING) ), verts );
			GenSurfaceVerts( (LEV_SURFACE)(unsigned)( pBlock->walls & ( (unsigned)LEV_SURFACE::WALL_FAR) ), verts );
			GenSurfaceVerts( (LEV_SURFACE)(unsigned)( pBlock->walls & ( (unsigned)LEV_SURFACE::WALL_LEFT) ), verts );
			GenSurfaceVerts( (LEV_SURFACE)(unsigned)( pBlock->walls & ( (unsigned)LEV_SURFACE::WALL_NEAR) ), verts );
			GenSurfaceVerts( (LEV_SURFACE)(unsigned)( pBlock->walls & ( (unsigned)LEV_SURFACE::WALL_RIGHT) ), verts );

			for( unsigned faceIndex = 0; faceIndex < verts.size() / 4; faceIndex++ )
			{
				auto v1 = verts[ faceIndex * 4 + 0 ] + pBlock->Origin;
				auto v2 = verts[ faceIndex * 4 + 1 ] + pBlock->Origin;
				auto v3 = verts[ faceIndex * 4 + 2 ] + pBlock->Origin;
				auto v4 = verts[ faceIndex * 4 + 3 ] + pBlock->Origin;

				block.AddFace( v1, v2, v3, v4 );
			}

			CollisionMng.AddBlock( block );
		}
	}
	CollisionMng.FindSideBlocks();
}
    VOID* TiledTextureSubresource::GetPageData( UINT PageX, UINT PageY, BOOL CreatePage )
    {
        INT BlockIndex = GetBlockIndex( PageX, PageY );
        if( BlockIndex == -1 )
        {
            return NULL;
        }

        TILEDFILE_PAGEDATA_LOCATOR Locator = pPageBlockIndex[BlockIndex];

        if( Locator == TILEDFILE_INVALID_LOCATOR )
        {
            if( CreatePage )
            {
                // create new block
                Locator = pFile->CreatePageBlock( SubresourceIndex, Header.BlockWidthPages, Header.BlockWidthPages );

                // store block in block index
                pPageBlockIndex[BlockIndex] = Locator;
            }
        }

        if( Locator != TILEDFILE_INVALID_LOCATOR )
        {
            assert( Locator != pFile->m_Header.DefaultPage );

            // compute offset within block
            UINT BlockX = PageX % Header.BlockWidthPages;
            UINT BlockY = PageY % Header.BlockWidthPages;
            UINT BlockOffset = BlockY * Header.BlockWidthPages + BlockX;

            // return data address within block
            return pFile->GetLocatorData( Locator, BlockOffset );
        }
        else
        {
            return NULL;
        }
    }