3102 {
3103 int num = 0;
3104 if (velocity.X < 0f)
3105 {
3106 num = -1;
3107 }
3108 if (velocity.X > 0f)
3109 {
3110 num = 1;
3111 }
3113 vector.X += velocity.X;
3114 int num2 = (int)((
vector.X + (
float)(width / 2) + (
float)((width / 2 + 1) * num)) / 16f);
3115 int num3 = (int)(((
double)vector.Y + 0.1) / 16.0);
3116 if (gravDir == 1)
3117 {
3118 num3 = (int)((
vector.Y + (
float)height - 1f) / 16f);
3119 }
3120 int num4 = height / 16 + ((height % 16 != 0) ? 1 : 0);
3121 bool flag = true;
3124 {
3125 return;
3126 }
3127 for (
int i = 1;
i <
num4 + 2;
i++)
3128 {
3130 {
3131 return;
3132 }
3133 }
3135 {
3136 return;
3137 }
3139 for (
int j = 2;
j <
num4 + 1;
j++)
3140 {
3142 {
3143 return;
3144 }
3145 tile = Main.tile[
num2,
num3 -
j * gravDir];
3146 flag = flag && (!tile.nactive() || !Main.tileSolid[tile.type] || Main.tileSolidTop[tile.type]);
3147 }
3149 flag2 =
flag2 && (!tile.nactive() || !Main.tileSolid[tile.type] || Main.tileSolidTop[tile.type]);
3154 if (gravDir == 1)
3155 {
3156 if (Main.tile[
num2,
num3 - gravDir] ==
null || Main.tile[
num2,
num3 - (
num4 + 1) * gravDir] ==
null)
3157 {
3158 return;
3159 }
3160 tile = Main.tile[
num2,
num3 - gravDir];
3162 flag3 =
flag3 && (!tile.nactive() || !Main.tileSolid[tile.type] || Main.tileSolidTop[tile.type] || (tile.slope() == 1 && position.X + (float)(width / 2) > (float)(
num2 * 16)) || (tile.slope() == 2 && position.X + (float)(width / 2) < (float)(
num2 * 16 + 16)) || (tile.halfBrick() && (!
tile2.nactive() || !Main.tileSolid[
tile2.type] || Main.tileSolidTop[
tile2.type])));
3166 {
3167 flag5 = tile.type != 16 && tile.type != 18 && tile.type != 14 && tile.type != 469 && tile.type != 134;
3168 }
3169 flag4 =
flag4 && ((tile.nactive() && (!tile.topSlope() || (tile.slope() == 1 && position.X + (float)(width / 2) < (float)(
num2 * 16)) || (tile.slope() == 2 && position.X + (float)(width / 2) > (float)(
num2 * 16 + 16))) && (!tile.topSlope() || position.Y + (float)height > (
float)(
num3 * 16)) && ((Main.tileSolid[tile.type] && !Main.tileSolidTop[tile.type]) || (
holdsMatching && ((Main.tileSolidTop[tile.type] && tile.frameY == 0) ||
TileID.
Sets.
Platforms[tile.type]) && (!Main.tileSolid[
tile2.type] || !
tile2.nactive()) &&
flag5))) || (
tile2.halfBrick() &&
tile2.nactive()));
3170 flag4 &= !Main.tileSolidTop[tile.type] || !Main.tileSolidTop[
tile2.type];
3171 }
3172 else
3173 {
3174 tile = Main.tile[
num2,
num3 - gravDir];
3176 flag3 =
flag3 && (!tile.nactive() || !Main.tileSolid[tile.type] || Main.tileSolidTop[tile.type] || tile.slope() != 0 || (tile.halfBrick() && (!
tile2.nactive() || !Main.tileSolid[
tile2.type] || Main.tileSolidTop[
tile2.type])));
3179 flag4 =
flag4 && ((tile.nactive() && ((Main.tileSolid[tile.type] && !Main.tileSolidTop[tile.type]) || (
holdsMatching && Main.tileSolidTop[tile.type] && tile.frameY == 0 && (!Main.tileSolid[
tile2.type] || !
tile2.nactive())))) || (
tile2.halfBrick() &&
tile2.nactive()));
3180 }
3182 {
3183 return;
3184 }
3185 if (gravDir == 1)
3186 {
3188 {
3189 return;
3190 }
3192 if (Main.tile[
num2,
num3 - 1].halfBrick())
3193 {
3195 }
3196 else if (Main.tile[
num2,
num3].halfBrick())
3197 {
3199 }
3201 {
3202 return;
3203 }
3204 float num6 = vector.Y + (float)height -
num5;
3205 if ((
double)
num6 <= 16.1)
3206 {
3207 gfxOffY += position.Y + (float)height -
num5;
3208 position.Y =
num5 - (float)height;
3210 {
3211 stepSpeed = 1f;
3212 }
3213 else
3214 {
3215 stepSpeed = 2f;
3216 }
3217 }
3218 }
3219 else
3220 {
3222 {
3223 return;
3224 }
3227 {
3228 return;
3229 }
3231 if ((
double)
num8 <= 16.1)
3232 {
3233 gfxOffY -=
num7 - position.Y;
3235 velocity.Y = 0f;
3237 {
3238 stepSpeed = 1f;
3239 }
3240 else
3241 {
3242 stepSpeed = 2f;
3243 }
3244 }
3245 }
3246 }