int CGalaxySpriteObject::checkSolidU(int x1, int x2, int y1, const bool push_mode ) { if(hitdetectWithTilePropertyHor(1, x1, x2, y1-COLISION_RES, 1<<CSF)) return 0; std::vector<CTileProperties> &TileProperty = gpBehaviorEngine->getTileProperties(); y1 -= COLISION_RES; // Check for sloped tiles here. They must be handled differently if(solid) { int8_t blocked; if(m_climbing) { x1 += 4*COLISION_RES; x2 -= 4*COLISION_RES; } for(int c=x1 ; c<=x2 ; c += COLISION_RES) { blocked = TileProperty[mp_Map->at(c>>CSF, y1>>CSF)].bdown; if(blocked == 17 && m_climbing) return 0; if( blocked >= 2 && blocked <= 7 && checkslopedU(c, y1, blocked)) return blocked; } blocked = TileProperty[mp_Map->at(x2>>CSF, y1>>CSF)].bdown; if( blocked >= 2 && blocked <= 7 && checkslopedU(x2, y1, blocked )) return 1; if(blocked == 17 && m_climbing) return 0; } return CSpriteObject::checkSolidU(x1, x2, y1+COLISION_RES, push_mode); }
void CAmpton::processWalking() { //play tic toc sound if(getActionStatus(A_AMPTON_WALK)) playSound(SOUND_AMPTONWALK0); else if(getActionStatus(A_AMPTON_WALK+1)) playSound(SOUND_AMPTONWALK1); int l_x_l = getXLeftPos(); int l_x_r = getXRightPos(); int l_w = getXRightPos() - getXLeftPos(); int l_h = getYDownPos() - getYUpPos(); int l_y = getYMidPos(); int l_x_mid = getXMidPos(); if ( (l_x_mid & 0x1FF) <= WALK_SPEED) { if(hitdetectWithTilePropertyRectRO(31, l_x_mid, l_y, l_w, l_h, 1<<CSF)) { setAction(A_AMPTON_FLIP_SWITCH); } if(hitdetectWithTilePropertyRectRO(1, l_x_mid, l_y, l_w, l_h, 1<<CSF)) { if( getProbability(600) ) //if (rand() < 0xC4) { bool polebelow = hitdetectWithTilePropertyHor(1, l_x_l, l_x_r, getYDownPos(), 1<<CSF); bool poleabove = hitdetectWithTilePropertyHor(1, l_x_l, l_x_r, getYUpPos(), 1<<CSF); if( getProbability(400) ) //if (rand() < 0x80) poleabove = false; else polebelow = false; //climb up if (poleabove) { setAction(A_AMPTON_START_POLE); yDirection = UP; return; } else if (polebelow) { setAction(A_AMPTON_START_POLE); yDirection = DOWN; return; } } } } // Move normally in the direction if( xDirection == RIGHT ) { moveRight( WALK_SPEED ); } else { moveLeft( WALK_SPEED ); } }