const int CMB_UPLEFT = 0; const int CMB_UP = 1; const int CMB_UPRIGHT = 2; const int CMB_RIGHT = 3; const int CMB_DOWNRIGHT = 4; const int CMB_DOWN = 5; const int CMB_DOWNLEFT = 6; const int CMB_LEFT = 7; const int CMB_LEFTUP = 8; int AdjacentCombo(int cmb, int dir){ int combooffsets[13]={-0x10,-0x0F,-0x0E,1,0x10,0x0F,0x0E,-1,-0x10}; if ( cmb % 16 == 0 ) combooffsets[9] = 1; if ( cmb & 15 == 1 ) combooffsets[10] = 1; if ( cmb < 0x10 ) combooffsets[11] = 1; if ( cmb < 0xAF ) combooffsets[12] = 1; if ( combooffsets[9] && ( dir == CMB_LEFT || dir == CMB_UPLEFT || dir == CMB_DOWNLEFT || dir == CMB_LEFTUP ) ) return 0; if ( combooffsets[10] && ( dir == CMB_RIGHT || dir == CMB_UPRIGHT || dir == CMB_DOWNRIGHT ) ) return 0; if ( combooffsets[11] && ( dir == CMB_UP || dir == CMB_UPRIGHT || dir == CMB_UPLEFT || dir == CMB_DOWNLEFT ) ) return 0; if ( combooffsets[12] && ( dir == CMB_DOWN || dir == CMB_DOWNRIGHT || dir == CMB_DOWNLEFT ) ) return 0; else if ( cmb > 0 && cmb < 177 ) return cmb + comboffsets[dir]; else return 0; }