mapinfo.cpp
上传用户:sycq158
上传日期:2008-10-22
资源大小:15361k
文件大小:21k
- #include "global.h"
- #include "mapinfo.h"
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- CMapInfo::CMapInfo() {
- m_bReversed = false;
- m_nBlocks = 0;
- m_cxBlocks = 0;
- m_cyBlocks = 0;
- m_szFileName = NULL;
- m_ptBase = NULL;
- m_pBlocks = NULL;
- m_pTankInfo = NULL;
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- CMapInfo::~CMapInfo() {
- DestroyMap();
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- void CMapInfo::DestroyMap() {
- //DELETE_PTR( m_szFileName ); // Undefined error here
- //DELETE_ARRAY( m_ptBase );
- //DELETE_ARRAY( m_pBlocks );
- //DELETE_ARRAY( m_pTankInfo );
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- bool CMapInfo::LoadMap( const char *filename ) {
- if ( !filename )
- return false;
- DestroyMap();
- m_szFileName = new char[strlen(filename)+1];
- strcpy( m_szFileName, filename );
- HANDLE hfile;
- DWORD read, ret;
- FILEHEADER header;
-
- // Open exist file
- hfile = CreateFile( m_szFileName, GENERIC_READ,
- 0, NULL, OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL, NULL );
- if ( hfile == INVALID_HANDLE_VALUE )
- goto err_quit_loadmap;
-
- // Read file header and test if the file format is legal
- read = sizeof(FILEHEADER);
- if ( !ReadFile( hfile, (LPVOID)&header, read, &ret, NULL ) )
- goto err_quit_loadmap;
- if ( header.dwFileID != GAME_MAP_FILE_IDENTITY ||
- header.dwVersion != GAME_MAP_VER_1_2_0 )
- goto err_quit_loadmap;
- // Read base possitions
- m_ptBase = new POINT[2];
- read = sizeof(POINT) * 2;
- if ( !ReadFile( hfile, (LPVOID)m_ptBase, read, &ret , NULL ) )
- goto err_quit_loadmap;
- // Read tanks' original infomation settings
- m_pTankInfo = new TANKINFO[20];
- if ( !m_pTankInfo )
- goto err_quit_loadmap;
- read = sizeof(TANKINFO)*20;
- if( !ReadFile( hfile, (LPVOID)m_pTankInfo, read, &ret, NULL ) )
- goto err_quit_loadmap;
- // Read block infomations
- m_nBlocks = header.nBlocks;
- m_cxBlocks = DEFAULT_CX_BLOCKS;
- m_cyBlocks = DEFAULT_CY_BLOCKS;
- m_pBlocks = new BLOCK[m_nBlocks];
- if ( !m_pBlocks )
- goto err_quit_loadmap;
- read = sizeof(BLOCK) * m_nBlocks;
- ZeroMemory( m_pBlocks, read );
- if( !ReadFile( hfile, (LPVOID)m_pBlocks, read, &ret, NULL ) )
- goto err_quit_loadmap;
- // Close file handle
- CloseHandle(hfile);
- // Need to be added in further version of map
- m_uiTankNum = 20;
- return true;
- // False return
- err_quit_loadmap:
- CloseHandle(hfile);
- DestroyMap();
- m_nBlocks = 0;
- m_cxBlocks = 0;
- m_cyBlocks = 0;
- return false;
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- void CMapInfo::SetReversed( bool flag ) {
- if ( m_bReversed != flag && CenterRotate180() )
- m_bReversed = flag;
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- void CMapInfo::ConvertCoord( CObject * pobj ) {
- pobj->SetPos( g_FrameLeft - pobj->GetLeft(), g_FrameLeft - pobj->GetTop() );
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- void CMapInfo::Protect( RECT rt, bool flag, POINT *ppts, int &changed ) {
- int x, y;
- int xend = rt.left/32+1, yend = rt.top/32+1;
- int total = 0;
- for ( y = yend-2; y <= yend; y++ ) {
- if ( y < 0 || y > m_cyBlocks-2)
- continue;
- for ( x = xend-2; x <= xend; x++ ) {
- if ( x < 0 || x > m_cxBlocks-2)
- continue;
- if ( total < changed ) {
- if ( flag )
- (m_pBlocks+y*m_cyBlocks+x)->byClass = LAND_IRON;
- else
- (m_pBlocks+y*m_cyBlocks+x)->byClass = LAND_BRICK;
- ppts[total].x = x;
- ppts[total].y = y;
- total++;
- }
- }
- }
- changed = total;
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- bool CMapInfo::CenterRotate180() {
- if ( !(HorReverseMap() && VerReverseMap()) )
- return false;
- // Reverse base position too
- if ( m_ptBase ) {
- m_ptBase[0].x = (m_cxBlocks-2)*32-m_ptBase[0].x;
- m_ptBase[0].y = (m_cyBlocks-2)*32-m_ptBase[0].y;
- m_ptBase[1].x = (m_cxBlocks-2)*32-m_ptBase[1].x;
- m_ptBase[1].y = (m_cyBlocks-2)*32-m_ptBase[1].y;
- }
- return true;
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- bool CMapInfo::HorReverseMap() {
- if ( !m_pBlocks || m_cxBlocks == 0)
- return false;
- int i,j,half,opp;
- BLOCK block;
- half = (m_cxBlocks-1)/2; // Divide to two pars, left and right
- for(j=0; j<m_cyBlocks-1; j++) {
- for(i=0; i<half; i++) {
- // exchange b[j][i] and b[j][19-i]
- opp = m_cxBlocks-2-i;
- HorReverseBlock(i,j);
- HorReverseBlock(opp,j);
- block = *(m_pBlocks+j*m_cyBlocks+i);
- *(m_pBlocks+j*m_cyBlocks+i) = *(m_pBlocks+j*m_cyBlocks+opp);
- *(m_pBlocks+j*m_cyBlocks+opp) = block;
- }
- }
- return true;
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- bool CMapInfo::VerReverseMap() {
- if ( !m_pBlocks || m_cyBlocks == 0)
- return false;
- int i,j,half,opp;
- BLOCK block;
- half = (m_cyBlocks-1)/2; // Divide to two parts, up and down
- for(i=0; i<m_cxBlocks-1; i++) {
- for(j=0; j<half; j++) {
- // exchange b[j][i] and b[19-j][i]
- opp = m_cyBlocks-2-j;
- VerReverseBlock( i, j );
- VerReverseBlock( i, opp );
- block = *( m_pBlocks + j*m_cyBlocks + i);
- *( m_pBlocks + j*m_cyBlocks+i ) = *( m_pBlocks + opp*m_cyBlocks+i );
- *( m_pBlocks+ opp*m_cyBlocks+i ) = block;
- }
- }
- return true;
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- void CMapInfo::HorReverseBlock( int x, int y ) {
- BYTE b1,b2,b3,b4,obs;
- obs = (m_pBlocks+y*m_cyBlocks+x)->byObstacle;
- if(obs != 0 && obs != 0x0f) {
- b1 = obs & 0x01;
- b2 = obs & 0x02;
- b3 = obs & 0x04;
- b4 = obs & 0x08;
- (m_pBlocks+y*m_cyBlocks+x)->byObstacle = (b1<<3) +
- (b2<<1) + (b3>>1) + (b4>>3);
- }
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- void CMapInfo::VerReverseBlock( int x, int y ) {
- BYTE b1,b2,b3,b4,obs;
- obs = (m_pBlocks+y*m_cyBlocks+x)->byObstacle;
- if(obs != 0 && obs != 0x0f) {
- b1 = obs & 0x01;
- b2 = obs & 0x02;
- b3 = obs & 0x04;
- b4 = obs & 0x08;
- (m_pBlocks+y*m_cyBlocks+x)->byObstacle = (b1<<1) +
- (b2>>1) + (b3<<1) + (b4>>1);
- }
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- int CMapInfo::BlockCounter( DWORD land, CObjBlock *pobb ) {
- int counter = 0;
- BLOCK *pblk;
- for ( int i=0; i<m_cyBlocks-1; i++ )
- for ( int j=0; j<m_cxBlocks-1; j++ ) {
- pblk = m_pBlocks+i*m_cxBlocks+j;
- if ( pblk->byClass == land ) {
- if ( pobb ) {
- pobb[counter].CreateObjBlock( j, i, land );
- pobb[counter].SetTotalFrame( 3 );
- }
- counter++;
- }
- }
- return counter;
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- bool CMapInfo::BlockLocator( int x, int y, RECT *prc, int &level ) {
- BLOCK *pblock = m_pBlocks + x + y*m_cxBlocks;
- DWORD dwLocType;
- level = LAYER_GROUND;
- switch(pblock->byClass)
- {
- case LAND_BRICK:
- dwLocType = LOC_BLOCK_BRICK0;
- break;
- case LAND_IRON:
- dwLocType = LOC_BLOCK_IRON0;
- break;
- case LAND_RIVER:
- dwLocType = LOC_BLOCK_RIVER0;
- break;
- case LAND_GRASS:
- dwLocType = LOC_BLOCK_GRASS0;
- level = LAYER_TREE;
- break;
- case LAND_ICE:
- dwLocType = LOC_BLOCK_ICE0;
- break;
- case LAND_NONE:
- default:
- dwLocType = LOC_BLOCK_NONE;
- }
- int *pres = &ResArray[dwLocType][0];
- prc->left = pblock->byObstacle * (*(pres+RESSIZE_WIDTH)) + (*(pres+RESPOS_LEFT));
- prc->top = *(pres+RESPOS_TOP);
- prc->right = prc->left + (*(pres+RESSIZE_WIDTH));
- prc->bottom = prc->top + (*(pres+RESSIZE_HEIGHT));
- return true;
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- bool CMapInfo::ObjectLocator( CObject *pobj, RECT *prc, int &level ) {
- DWORD type = pobj->GetType();
- if ( type == OBJTYPE_TANK ) {
- prc->top = RES_POST_TANK;
- prc->left = RES_POSL_TANK;
- prc->left += ((CObjTank *)pobj)->m_uiDirection - 1;
- prc->left *= g_FrameSmall;
- prc->top *= g_FrameSmall;
- level = LAYER_TANK;
- } else if ( type == OBJTYPE_BULLET ) {
- prc->top = 128;
- prc->left = pobj->GetFrameCurrent() * g_FrameSmall;
- level = LAYER_BULLET;
- } else if ( type == OBJTYPE_BASE ) {
- prc->top = RES_POST_BASE;
- prc->left = RES_POSL_BASE;
- }
- prc->right = prc->left + pobj->GetWidth();
- prc->bottom = prc->top + pobj->GetHeight();
- return true;
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- bool CMapInfo::ObjBlockLocator( CObjBlock *poblk, RECT *prc, int &level ) {
- if ( poblk->GetLand() == LAND_RIVER ) {
- BLOCK *pblock = m_pBlocks + poblk->GetBx() +
- poblk->GetBy()*m_cxBlocks;
- prc->left = pblock->byObstacle + RES_POSL_LAND;
- prc->top = RES_POST_LAND_RIVER + poblk->GetFrameCurrent();
- prc->left *= g_FrameSmall;
- prc->top *= g_FrameSmall;
- prc->right = prc->left + g_FrameSmall;
- prc->bottom = prc->top + g_FrameSmall;
- level = LAYER_GROUND;
- }
- return true;
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- bool CMapInfo::ColR2R( RECT &rt_move, RECT rt_stable, POINT step ) {
- bool intersect = false;
- SetRect( &rt_move, rt_move.left - rt_stable.right, rt_move.top - rt_stable.bottom,
- rt_move.right - rt_stable.left, rt_move.bottom - rt_stable.top );
-
- while ( rt_move.left * rt_move.right < 0 && rt_move.top * rt_move.bottom < 0 ) {
- intersect = true;
- if ( step.x != 0 ) {
- rt_move.left -= step.x;
- rt_move.right -= step.x;
- } else if ( step.y != 0 ) {
- rt_move.top -= step.y;
- rt_move.bottom -= step.y;
- } else
- break;
- }
-
- rt_move.left += rt_stable.right;
- rt_move.top += rt_stable.bottom;
- rt_move.right += rt_stable.left;
- rt_move.bottom += rt_stable.top;
- return intersect;
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- void CMapInfo::ColRToMobile( RECT &rt, POINT step, CMobileObject **ppmos,
- int num, int except, UINT team, bool checkteam,
- int &hit )
- {
- hit = -1;
- for ( int i=0; i<num; i++ ) {
- if ( i == except || !ppmos[i] ||
- ( ppmos[i]->GetStat() & OBJSTAT_CADAVER ) )
- continue;
- if ( checkteam && team == ppmos[i]->m_uiTeamType )
- continue;
- if ( ColR2R( rt, ppmos[i]->GetRect(), step ) )
- hit = i;
- }
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- void CMapInfo::ColRToB( POINT <, WidthType wt, POINT step, DWORD block_land,
- DWORD &over_land, DWORD remove_land, POINT *ptChanged,
- int &changed )
- {
- BLOCK *pblks[4];
- POINT index[4];
- int mask[4];
- DWORD over_ret, land;
- bool bBlocked;
- int total = 0;
- int bound;
- // Boundary test
- if ( wt == WIDTH_32 )
- bound = g_FrameWidth-32;
- else
- bound = g_FrameWidth-16;
- if ( lt.x < 0 )
- lt.x = 0;
- else if ( lt.x > bound )
- lt.x = bound;
- if ( lt.y < 0 )
- lt.y = 0;
- else if ( lt.y > bound )
- lt.y = bound;
- // Block Test
- do {
- // 4 block indices
- index[0].x = lt.x / g_FrameSmall;
- index[0].y = lt.y / g_FrameSmall;
- index[2].x = index[0].x;
- index[1].x = index[0].x + 1;
- index[3].x = index[1].x;
- index[1].y = index[0].y;
- index[2].y = index[0].y + 1;
- index[3].y = index[2].y;
-
- // 4 masks
- if ( wt == WIDTH_32 )
- Get4Mask( lt.x, lt.y, mask );
- else
- Get4Mask16( lt.x, lt.y, mask );
- // Test with these 4 blocks
- bBlocked = false;
- over_ret = 0;
- for ( int i=0; i<4; i++ )
- {
- pblks[i] = m_pBlocks + index[i].y * m_cxBlocks + index[i].x;
- if ( mask[i] & pblks[i]->byObstacle ) // overlap
- {
- land = 1 << pblks[i]->byClass;
- if ( land & remove_land ) { // remove
- if ( total < changed ) {
- pblks[i]->byObstacle &= ~mask[i];
- ptChanged[total] = index[i];
- }
- total++;
- }
- if ( land & block_land ) { // block
- bBlocked = true;
- }
- if ( land & over_land ) // over, set the bit
- over_ret |= land;
- }
- }
-
- // Block or not
- if ( bBlocked ) {
- if ( step.x != 0 ) {
- while ( lt.x % 16 != 0 )
- lt.x -= step.x;
- }
- else if ( step.y != 0 ) {
- while ( lt.y % 16 != 0 )
- lt.y -= step.y;
- }
- } else
- break;
- } while (true);
-
- // Set return values
- changed = total;
- over_land = over_ret;
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- void CMapInfo::Get4Mask( int left, int top, int *mask) {
- int iver = top % g_FrameSmall,
- ihor = left % g_FrameSmall;
- // Assign mask array, LT-RT-LB-RB
- // All case here.
- if ( iver > g_FrameBasis) {
- if ( ihor > g_FrameBasis ) { // 1:2:2:4
- mask[0] = 2;
- mask[1] = 6;
- mask[2] = 3;
- mask[3] = 15;
- } else if ( ihor == g_FrameBasis ) { // 1:1:2:2
- mask[0] = 2;
- mask[1] = 4;
- mask[2] = 3;
- mask[3] = 12;
- } else if ( ihor > 0 ) { // 2:1:4:2
- mask[0] = 6;
- mask[1] = 4;
- mask[2] = 15;
- mask[3] = 12;
- } else { // 2:0:4:0
- mask[0] = 6;
- mask[1] = 0;
- mask[2] = 15;
- mask[3] = 0;
- }
- } else if ( iver == g_FrameBasis ) {
- if ( ihor > g_FrameBasis ) { // 1:2:1:2
- mask[0] = 2;
- mask[1] = 6;
- mask[2] = 1;
- mask[3] = 9;
- } else if ( ihor == g_FrameBasis ) { // 1:1:1:1
- mask[0] = 2;
- mask[1] = 4;
- mask[2] = 1;
- mask[3] = 8;
- } else if ( ihor > 0 ) { // 2:1:2:1
- mask[0] = 6;
- mask[1] = 4;
- mask[2] = 9;
- mask[3] = 8;
- } else { // 2:0:2:0
- mask[0] = 6;
- mask[1] = 0;
- mask[2] = 9;
- mask[3] = 0;
- }
- } else if ( iver > 0 ) {
- if ( ihor > g_FrameBasis ) { // 2:4:1:2
- mask[0] = 3;
- mask[1] = 15;
- mask[2] = 1;
- mask[3] = 9;
- } else if ( ihor == g_FrameBasis ) { // 2:2:1:1
- mask[0] = 3;
- mask[1] = 12;
- mask[2] = 1;
- mask[3] = 8;
- } else if ( ihor > 0 ) { // 4:2:2:1
- mask[0] = 15;
- mask[1] = 12;
- mask[2] = 9;
- mask[3] = 8;
- } else { // 4:0:2:0
- mask[0] = 15;
- mask[1] = 0;
- mask[2] = 9;
- mask[3] = 0;
- }
- } else {
- if ( ihor > g_FrameBasis ) { // 2:4:0:0
- mask[0] = 3;
- mask[1] = 15;
- mask[2] = 0;
- mask[3] = 0;
- } else if ( ihor == g_FrameBasis ) { // 2:2:0:0
- mask[0] = 3;
- mask[1] = 12;
- mask[2] = 0;
- mask[3] = 0;
- } else if ( ihor > 0 ) { // 4:2:0:0
- mask[0] = 15;
- mask[1] = 12;
- mask[2] = 0;
- mask[3] = 0;
- } else { // 4:0:0:0
- mask[0] = 15;
- mask[1] = 0;
- mask[2] = 0;
- mask[3] = 0;
- }
- }
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- void CMapInfo::Get4Mask16( int left, int top, int *mask) {
- int iver = top % g_FrameSmall,
- ihor = left % g_FrameSmall;
- // Assign mask array, LT-RT-LB-RB
- // All case here.
- if ( iver > g_FrameBasis) {
- if ( ihor > g_FrameBasis ) { // 1:2:2:4
- mask[0] = 2;
- mask[1] = 4;
- mask[2] = 1;
- mask[3] = 8;
- } else if ( ihor == g_FrameBasis ) { // 1:1:2:2
- mask[0] = 2;
- mask[1] = 0;
- mask[2] = 1;
- mask[3] = 0;
- } else if ( ihor > 0 ) { // 2:1:4:2
- mask[0] = 6;
- mask[1] = 0;
- mask[2] = 9;
- mask[3] = 0;
- } else { // 2:0:4:0
- mask[0] = 4;
- mask[1] = 0;
- mask[2] = 8;
- mask[3] = 0;
- }
- } else if ( iver == g_FrameBasis ) {
- if ( ihor > g_FrameBasis ) { // 1:2:1:2
- mask[0] = 2;
- mask[1] = 4;
- mask[2] = 0;
- mask[3] = 0;
- } else if ( ihor == g_FrameBasis ) { // 1:1:1:1
- mask[0] = 2;
- mask[1] = 0;
- mask[2] = 0;
- mask[3] = 0;
- } else if ( ihor > 0 ) { // 2:1:2:1
- mask[0] = 6;
- mask[1] = 0;
- mask[2] = 0;
- mask[3] = 0;
- } else { // 2:0:2:0
- mask[0] = 4;
- mask[1] = 0;
- mask[2] = 0;
- mask[3] = 0;
- }
- } else if ( iver > 0 ) {
- if ( ihor > g_FrameBasis ) { // 2:4:1:2
- mask[0] = 3;
- mask[1] = 12;
- mask[2] = 0;
- mask[3] = 0;
- } else if ( ihor == g_FrameBasis ) { // 2:2:1:1
- mask[0] = 3;
- mask[1] = 0;
- mask[2] = 0;
- mask[3] = 0;
- } else if ( ihor > 0 ) { // 4:2:2:1
- mask[0] = 15;
- mask[1] = 0;
- mask[2] = 0;
- mask[3] = 0;
- } else { // 4:0:2:0
- mask[0] = 12;
- mask[1] = 0;
- mask[2] = 0;
- mask[3] = 0;
- }
- } else {
- if ( ihor > g_FrameBasis ) { // 2:4:0:0
- mask[0] = 1;
- mask[1] = 8;
- mask[2] = 0;
- mask[3] = 0;
- } else if ( ihor == g_FrameBasis ) { // 2:2:0:0
- mask[0] = 1;
- mask[1] = 0;
- mask[2] = 0;
- mask[3] = 0;
- } else if ( ihor > 0 ) { // 4:2:0:0
- mask[0] = 9;
- mask[1] = 0;
- mask[2] = 0;
- mask[3] = 0;
- } else { // 4:0:0:0
- mask[0] = 8;
- mask[1] = 0;
- mask[2] = 0;
- mask[3] = 0;
- }
- }
- }
- //-----------------------------------------------------------------------------
- // Name:
- // Desc:
- //-----------------------------------------------------------------------------
- /*
- All case here.
- if ( iver > g_FrameBasis) {
- if ( ihor > g_FrameBasis ) { // 1:2:2:4
- mask[0] = 3;
- mask[1] = 15;
- mask[2] = 1;
- mask[3] = 8;
- } else if ( ihor == g_FrameBasis ) { // 1:1:2:2
- mask[0] = 15;
- mask[1] = 12;
- mask[2] = 9;
- mask[3] = 8;
- } else if ( ihor > 0 ) { // 2:1:4:2
- mask[0] = 15;
- mask[1] = 12;
- mask[2] = 9;
- mask[3] = 8;
- } else { // 2:0:4:0
- mask[0] = 15;
- mask[1] = 0;
- mask[2] = 9;
- mask[3] = 0;
- }
- } else if ( iver == g_FrameBasis ) {
- if ( ihor > g_FrameBasis ) { // 1:2:1:2
- mask[0] = 3;
- mask[1] = 15;
- mask[2] = 1;
- mask[3] = 8;
- } else if ( ihor == g_FrameBasis ) { // 1:1:1:1
- mask[0] = 15;
- mask[1] = 12;
- mask[2] = 9;
- mask[3] = 8;
- } else if ( ihor > 0 ) { // 2:1:2:1
- mask[0] = 15;
- mask[1] = 12;
- mask[2] = 9;
- mask[3] = 8;
- } else { // 2:0:2:0
- mask[0] = 15;
- mask[1] = 0;
- mask[2] = 9;
- mask[3] = 0;
- }
- } else if ( iver > 0 ) {
- if ( ihor > g_FrameBasis ) { // 2:4:1:2
- mask[0] = 3;
- mask[1] = 15;
- mask[2] = 1;
- mask[3] = 8;
- } else if ( ihor == g_FrameBasis ) { // 2:2:1:1
- mask[0] = 15;
- mask[1] = 12;
- mask[2] = 9;
- mask[3] = 8;
- } else if ( ihor > 0 ) { // 4:2:2:1
- mask[0] = 15;
- mask[1] = 12;
- mask[2] = 9;
- mask[3] = 8;
- } else { // 4:0:2:0
- mask[0] = 15;
- mask[1] = 0;
- mask[2] = 9;
- mask[3] = 0;
- }
- } else {
- if ( ihor > g_FrameBasis ) { // 2:4:0:0
- mask[0] = 3;
- mask[1] = 15;
- mask[2] = 1;
- mask[3] = 8;
- } else if ( ihor == g_FrameBasis ) { // 2:2:0:0
- mask[0] = 15;
- mask[1] = 12;
- mask[2] = 9;
- mask[3] = 8;
- } else if ( ihor > 0 ) { // 4:2:0:0
- mask[0] = 15;
- mask[1] = 12;
- mask[2] = 9;
- mask[3] = 8;
- } else { // 4:0:0:0
- mask[0] = 15;
- mask[1] = 0;
- mask[2] = 9;
- mask[3] = 0;
- }
- }
- */