Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ PlayerFrame()

void Terraria.Player.PlayerFrame ( )
inline

Definition at line 33978 of file Player.cs.

33979 {
33980 if (swimTime > 0)
33981 {
33982 swimTime--;
33983 if (!wet)
33984 {
33985 swimTime = 0;
33986 }
33987 }
33988 head = armor[0].headSlot;
33989 body = armor[1].bodySlot;
33990 legs = armor[2].legSlot;
33991 if (armor[10].headSlot >= 0)
33992 {
33993 head = armor[10].headSlot;
33994 }
33995 if (armor[11].bodySlot >= 0)
33996 {
33997 body = armor[11].bodySlot;
33998 }
33999 if (armor[12].legSlot >= 0)
34000 {
34001 legs = armor[12].legSlot;
34002 }
34003 if (!dead)
34004 {
34006 }
34007 wearsRobe = false;
34008 bool somethingSpecial = false;
34009 SetMatchRequest request = default(SetMatchRequest);
34010 request.Head = head;
34011 request.Body = body;
34012 request.Legs = legs;
34013 request.Male = Male;
34014 request.ArmorSlotRequested = 1;
34015 int num = SetMatch(request, ref wearsRobe);
34016 if (num != -1)
34017 {
34018 legs = num;
34019 }
34020 request = default(SetMatchRequest);
34021 request.Head = head;
34022 request.Body = body;
34023 request.Legs = legs;
34024 request.Male = Male;
34025 request.ArmorSlotRequested = 2;
34027 if (num != -1)
34028 {
34029 legs = num;
34030 }
34031 request = default(SetMatchRequest);
34032 request.Head = head;
34033 request.Body = body;
34034 request.Legs = legs;
34035 request.Male = Male;
34036 request.ArmorSlotRequested = 0;
34038 if (num != -1)
34039 {
34040 head = num;
34041 }
34042 if (body == 93)
34043 {
34044 shield = 0;
34045 handoff = 0;
34046 }
34048 {
34049 handon = 0;
34050 handoff = 0;
34051 }
34053 {
34054 waist = 0;
34055 }
34056 if (!dead && body >= 0)
34057 {
34058 sbyte b = (sbyte)(Male ? ArmorIDs.Body.Sets.IncludedCapeBack : ArmorIDs.Body.Sets.IncludedCapeBackFemale)[body];
34059 if (b != -1)
34060 {
34062 {
34063 backpack = b;
34064 cBackpack = cBody;
34065 }
34067 {
34068 tail = b;
34069 cTail = cBody;
34070 }
34071 else if (back == -1)
34072 {
34073 back = b;
34074 cBack = cBody;
34075 }
34076 }
34077 sbyte b2 = (sbyte)ArmorIDs.Body.Sets.IncludedCapeFront[body];
34078 if (b2 != -1 && front == -1)
34079 {
34080 front = b2;
34081 cFront = cBody;
34082 }
34084 if (!includeCapeFrontAndBackInfo.Invalid && back == -1 && front == -1)
34085 {
34087 cFront = cBody;
34088 sbyte backCape = includeCapeFrontAndBackInfo.backCape;
34089 if (ArmorIDs.Back.Sets.DrawInBackpackLayer[backCape])
34090 {
34091 backpack = backCape;
34092 cBackpack = cBody;
34093 }
34094 else if (ArmorIDs.Back.Sets.DrawInTailLayer[backCape])
34095 {
34096 tail = backCape;
34097 cTail = cBody;
34098 }
34099 else if (!sitting.isSitting)
34100 {
34101 back = backCape;
34102 cBack = cBody;
34103 }
34104 }
34105 }
34106 if (legs == 67)
34107 {
34108 shoe = 0;
34109 }
34110 if (legs == 140)
34111 {
34112 shoe = 0;
34113 }
34114 bool flag = false;
34115 if ((wereWolf || forceWerewolf) && !hideWolf)
34116 {
34117 legs = 20;
34118 body = 21;
34119 head = 38;
34120 flag = true;
34121 }
34122 bool flag2 = wet && !lavaWet && (!mount.Active || !mount.IsConsideredASlimeMount);
34123 if (merman || forceMerman)
34124 {
34125 if (!hideMerman)
34126 {
34127 head = 39;
34128 legs = 21;
34129 body = 22;
34130 flag = true;
34131 }
34132 if (flag2)
34133 {
34134 wings = 0;
34135 }
34136 }
34138 socialIgnoreLight = false;
34139 socialGhost = false;
34140 armorEffectDrawShadow = false;
34148 {
34149 if (head == 101 && body == 66 && legs == 55)
34150 {
34151 socialGhost = true;
34152 }
34153 if (head == 156 && body == 66 && legs == 55)
34154 {
34155 socialGhost = true;
34156 }
34158 }
34159 hermesStepSound.SoundType = 17;
34160 hermesStepSound.SoundStyle = -1;
34161 hermesStepSound.IntendedCooldown = 9;
34162 if (head == 99 && body == 65 && legs == 54)
34163 {
34164 turtleArmor = true;
34165 }
34166 if (head == 162 && body == 170 && legs == 105)
34167 {
34168 spiderArmor = true;
34169 }
34171 if (legs == 140)
34172 {
34173 hermesStepSound.SoundType = 2;
34174 hermesStepSound.SoundStyle = 24;
34175 hermesStepSound.IntendedCooldown = 6;
34176 }
34177 if (flag)
34178 {
34179 face = -1;
34180 faceFlower = -1;
34181 faceHead = -1;
34182 }
34183 if (head > 0 && face > 0)
34184 {
34186 {
34187 head = -1;
34188 faceHead = -1;
34189 }
34191 {
34192 face = -1;
34193 }
34194 }
34196 {
34197 sbyte b3 = (sbyte)ArmorIDs.Face.Sets.AltFaceHead[faceHead];
34198 if (b3 > 0)
34199 {
34200 faceHead = b3;
34201 }
34202 }
34203 if (webbed || frozen || stoned || (Main.gamePaused && !Main.gameMenu))
34204 {
34205 return;
34206 }
34207 if (head == 267 && body == 236 && (legs == 219 || legs == 220) && miscCounter % 15 == 0 && Main.rand.Next(3) == 0)
34208 {
34209 Vector2 center = base.Center;
34210 float num2 = 1f + Main.rand.NextFloat() * 0.5f;
34211 if (Main.rand.Next(2) == 0)
34212 {
34213 num2 *= -1f;
34214 }
34215 center += new Vector2(num2 * -25f, -8f);
34216 Dust obj = Main.dust[Dust.NewDust(center, 2, 2, 304, 0f, 0f, 100)];
34217 obj.rotation = Main.rand.NextFloat() * ((float)Math.PI * 2f);
34218 obj.alpha = 254;
34219 obj.velocity.X = num2 * 0.2f;
34220 obj.noGravity = true;
34221 obj.customData = this;
34222 obj.shader = GameShaders.Armor.GetSecondaryShader(cBody, this);
34223 }
34225 {
34226 if (((body == 68 && legs == 57 && head == 106) || (body == 74 && legs == 63 && head == 106)) && Main.rand.Next(10) == 0)
34227 {
34228 int num3 = Dust.NewDust(new Vector2(position.X - velocity.X * 2f, position.Y - 2f - velocity.Y * 2f), width, height, 43, 0f, 0f, 100, new Color(255, 0, 255), 0.3f);
34229 Main.dust[num3].fadeIn = 0.8f;
34230 Main.dust[num3].noGravity = true;
34231 Main.dust[num3].velocity *= 2f;
34232 Main.dust[num3].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34233 }
34234 if (wings == 27 && wingsLogic == wings)
34235 {
34236 float num4 = 0.4f * stealth;
34237 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, num4, num4 * 0.9f, num4 * 0.2f);
34238 }
34239 if (head == 5 && body == 5 && legs == 5)
34240 {
34242 }
34243 if (head == 5 && body == 5 && legs == 5 && Main.rand.Next(10) == 0)
34244 {
34245 int num5 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 14, 0f, 0f, 200, default(Color), 1.2f);
34246 Main.dust[num5].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34247 }
34248 if (head == 76 && body == 49 && legs == 45)
34249 {
34251 }
34252 if (head == 74 && body == 48 && legs == 44)
34253 {
34255 }
34256 if (head == 74 && body == 48 && legs == 44 && Main.rand.Next(10) == 0)
34257 {
34258 int num6 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 14, 0f, 0f, 200, default(Color), 1.2f);
34259 Main.dust[num6].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34260 }
34261 if (head == 57 && body == 37 && legs == 35)
34262 {
34263 int maxValue = 10;
34264 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) > 1f)
34265 {
34266 maxValue = 2;
34267 }
34268 if (Main.rand.Next(maxValue) == 0)
34269 {
34270 int num7 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 115, 0f, 0f, 140, default(Color), 0.75f);
34271 Main.dust[num7].noGravity = true;
34272 Main.dust[num7].fadeIn = 1.5f;
34273 Main.dust[num7].velocity *= 0.3f;
34274 Main.dust[num7].velocity += velocity * 0.2f;
34275 Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34276 }
34277 }
34278 if (head == 6 && body == 6 && legs == 6 && Math.Abs(velocity.X) + Math.Abs(velocity.Y) > 1f && !rocketFrame)
34279 {
34280 for (int i = 0; i < 2; i++)
34281 {
34282 int num8 = Dust.NewDust(new Vector2(position.X - velocity.X * 2f, position.Y - 2f - velocity.Y * 2f), width, height, 6, 0f, 0f, 100, default(Color), 2f);
34283 Main.dust[num8].noGravity = true;
34284 Main.dust[num8].noLight = true;
34285 Main.dust[num8].velocity.X -= velocity.X * 0.5f;
34286 Main.dust[num8].velocity.Y -= velocity.Y * 0.5f;
34287 Main.dust[num8].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34288 }
34289 }
34290 if (head == 8 && body == 8 && legs == 8 && Math.Abs(velocity.X) + Math.Abs(velocity.Y) > 1f)
34291 {
34292 int num9 = Dust.NewDust(new Vector2(position.X - velocity.X * 2f, position.Y - 2f - velocity.Y * 2f), width, height, 40, 0f, 0f, 50, default(Color), 1.4f);
34293 Main.dust[num9].noGravity = true;
34294 Main.dust[num9].velocity.X = velocity.X * 0.25f;
34295 Main.dust[num9].velocity.Y = velocity.Y * 0.25f;
34296 Main.dust[num9].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34297 }
34298 if (head == 9 && body == 9 && legs == 9 && Math.Abs(velocity.X) + Math.Abs(velocity.Y) > 1f && !rocketFrame)
34299 {
34300 for (int j = 0; j < 2; j++)
34301 {
34302 int num10 = Dust.NewDust(new Vector2(position.X - velocity.X * 2f, position.Y - 2f - velocity.Y * 2f), width, height, 6, 0f, 0f, 100, default(Color), 2f);
34303 Main.dust[num10].noGravity = true;
34304 Main.dust[num10].noLight = true;
34305 Main.dust[num10].velocity.X -= velocity.X * 0.5f;
34306 Main.dust[num10].velocity.Y -= velocity.Y * 0.5f;
34307 Main.dust[num10].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34308 }
34309 }
34310 if (body == 18 && legs == 17 && (head == 32 || head == 33 || head == 34) && Main.rand.Next(10) == 0)
34311 {
34312 int num11 = Dust.NewDust(new Vector2(position.X - velocity.X * 2f, position.Y - 2f - velocity.Y * 2f), width, height, 43, 0f, 0f, 100, default(Color), 0.3f);
34313 Main.dust[num11].fadeIn = 0.8f;
34314 Main.dust[num11].velocity *= 0f;
34315 Main.dust[num11].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34316 }
34317 if ((body == 24 || body == 229) && (legs == 23 || legs == 212) && (head == 43 || head == 41 || head == 42 || head == 254 || head == 255 || head == 256 || head == 257 || head == 258) && velocity.X != 0f && velocity.Y != 0f && Main.rand.Next(10) == 0)
34318 {
34319 int num12 = Dust.NewDust(new Vector2(position.X - velocity.X * 2f, position.Y - 2f - velocity.Y * 2f), width, height, 43, 0f, 0f, 100, default(Color), 0.3f);
34320 Main.dust[num12].fadeIn = 0.8f;
34321 Main.dust[num12].velocity *= 0f;
34322 Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34323 }
34324 if (body == 36 && head == 56 && velocity.X != 0f && velocity.Y == 0f)
34325 {
34326 for (int k = 0; k < 2; k++)
34327 {
34328 int num13 = Dust.NewDust(new Vector2(position.X, position.Y + (float)((gravDir == 1f) ? (height - 2) : (-4))), width, 6, 106, 0f, 0f, 100, default(Color), 0.1f);
34329 Main.dust[num13].fadeIn = 1f;
34330 Main.dust[num13].noGravity = true;
34331 Main.dust[num13].velocity *= 0.2f;
34332 Main.dust[num13].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34333 }
34334 }
34335 if (body == 27 && head == 46 && legs == 26 && velocity.X != 0f && velocity.Y == 0f && miscCounter % 2 == 0)
34336 {
34337 for (int l = 0; l < 2; l++)
34338 {
34339 int num14 = ((l != 0) ? Dust.NewDust(new Vector2(position.X + (float)(width / 2), position.Y + (float)height + gfxOffY), width / 2, 6, 76, 0f, 0f, 0, default(Color), 1.35f) : Dust.NewDust(new Vector2(position.X, position.Y + (float)height + gfxOffY), width / 2, 6, 76, 0f, 0f, 0, default(Color), 1.35f));
34340 Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20, 40) * 0.01f;
34341 Main.dust[num14].noGravity = true;
34342 Main.dust[num14].noLight = true;
34343 Main.dust[num14].velocity *= 0.001f;
34344 Main.dust[num14].velocity.Y -= 0.003f;
34345 Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(ArmorSetDye(), this);
34346 }
34347 }
34348 }
34349 drawingFootball = false;
34350 if (ShouldDrawFootball())
34351 {
34352 SetCompositeArmBack(enabled: true, CompositeArmStretchAmount.Full, (float)Math.PI / 10f * (float)direction * -1f);
34353 drawingFootball = true;
34354 }
34355 Item.GetDrawHitbox(HeldItem.type, this);
34357 bool flag4 = HeldItem.type != 4952;
34358 if (mount.Active)
34359 {
34360 legFrameCounter = 0.0;
34361 legFrame.Y = legFrame.Height * 6;
34362 if (mount.Type == 23 || mount.Type == 45 || mount.Type == 48)
34363 {
34365 _ = legFrame;
34366 reference.Y = 0;
34367 }
34368 if (velocity.Y != 0f)
34369 {
34370 if (mount.FlyTime > 0 && jump == 0 && controlJump && !mount.CanHover())
34371 {
34372 if (mount.Type == 0)
34373 {
34374 if (direction > 0)
34375 {
34376 if (Main.rand.Next(4) == 0)
34377 {
34378 int num15 = Dust.NewDust(new Vector2(base.Center.X - 22f, position.Y + (float)height - 6f), 20, 10, 64, velocity.X * 0.25f, velocity.Y * 0.25f, 255);
34379 Main.dust[num15].velocity *= 0.1f;
34380 Main.dust[num15].noLight = true;
34381 }
34382 if (Main.rand.Next(4) == 0)
34383 {
34384 int num16 = Dust.NewDust(new Vector2(base.Center.X + 12f, position.Y + (float)height - 6f), 20, 10, 64, velocity.X * 0.25f, velocity.Y * 0.25f, 255);
34385 Main.dust[num16].velocity *= 0.1f;
34386 Main.dust[num16].noLight = true;
34387 }
34388 }
34389 else
34390 {
34391 if (Main.rand.Next(4) == 0)
34392 {
34393 int num17 = Dust.NewDust(new Vector2(base.Center.X - 32f, position.Y + (float)height - 6f), 20, 10, 64, velocity.X * 0.25f, velocity.Y * 0.25f, 255);
34394 Main.dust[num17].velocity *= 0.1f;
34395 Main.dust[num17].noLight = true;
34396 }
34397 if (Main.rand.Next(4) == 0)
34398 {
34399 int num18 = Dust.NewDust(new Vector2(base.Center.X + 2f, position.Y + (float)height - 6f), 20, 10, 64, velocity.X * 0.25f, velocity.Y * 0.25f, 255);
34400 Main.dust[num18].velocity *= 0.1f;
34401 Main.dust[num18].noLight = true;
34402 }
34403 }
34404 }
34405 mount.TryBeginningFlight(this, 3);
34406 mount.UpdateFrame(this, 3, velocity);
34407 mount.TryLanding(this);
34408 }
34409 else if (wet)
34410 {
34411 mount.UpdateFrame(this, 4, velocity);
34412 }
34413 else
34414 {
34415 mount.TryBeginningFlight(this, 2);
34416 mount.UpdateFrame(this, 2, velocity);
34417 mount.TryLanding(this);
34418 }
34419 }
34420 else
34421 {
34423 }
34424 }
34425 else if (legs != 140)
34426 {
34427 if (swimTime > 0)
34428 {
34429 legFrameCounter += 2.0;
34430 while (legFrameCounter > 8.0)
34431 {
34432 legFrameCounter -= 8.0;
34433 legFrame.Y += legFrame.Height;
34434 }
34435 if (legFrame.Y < legFrame.Height * 7)
34436 {
34437 legFrame.Y = legFrame.Height * 19;
34438 }
34439 else if (legFrame.Y > legFrame.Height * 19)
34440 {
34441 legFrame.Y = legFrame.Height * 7;
34442 }
34443 }
34444 else if (velocity.Y != 0f || grappling[0] > -1)
34445 {
34446 legFrameCounter = 0.0;
34447 legFrame.Y = legFrame.Height * 5;
34448 if ((wings == 22 || wings == 28 || wings == 45) && ShouldDrawWingsThatAreAlwaysAnimated())
34449 {
34450 legFrame.Y = 0;
34451 }
34452 }
34453 else if (velocity.X != 0f)
34454 {
34455 if ((slippy || slippy2 || windPushed) && !controlLeft && !controlRight)
34456 {
34457 legFrameCounter = 0.0;
34459 _ = legFrame;
34460 reference2.Y = 0;
34461 }
34462 else
34463 {
34464 legFrameCounter += (double)Math.Abs(velocity.X) * 1.3;
34465 while (legFrameCounter > 8.0)
34466 {
34467 legFrameCounter -= 8.0;
34468 legFrame.Y += legFrame.Height;
34469 }
34470 if (legFrame.Y < legFrame.Height * 7)
34471 {
34472 legFrame.Y = legFrame.Height * 19;
34473 }
34474 else if (legFrame.Y > legFrame.Height * 19)
34475 {
34476 legFrame.Y = legFrame.Height * 7;
34477 }
34478 }
34479 }
34480 else
34481 {
34482 legFrameCounter = 0.0;
34484 _ = legFrame;
34485 reference3.Y = 0;
34486 }
34487 }
34488 if (carpetFrame >= 0)
34489 {
34490 legFrameCounter = 0.0;
34492 _ = legFrame;
34493 reference4.Y = 0;
34494 }
34495 if (sandStorm)
34496 {
34497 if (grappling[0] >= 0)
34498 {
34499 sandStorm = false;
34500 }
34501 if (miscCounter % 4 == 0 && itemAnimation == 0)
34502 {
34503 ChangeDir(direction * -1);
34504 if (inventory[selectedItem].holdStyle == 2)
34505 {
34506 if (inventory[selectedItem].type == 946 || inventory[selectedItem].type == 4707)
34507 {
34508 itemLocation.X = position.X + (float)width * 0.5f - (float)(16 * direction);
34509 }
34510 if (inventory[selectedItem].type == 186)
34511 {
34512 itemLocation.X = position.X + (float)width * 0.5f + (float)(6 * direction);
34513 itemRotation = 0.79f * (float)(-direction);
34514 }
34515 }
34516 }
34517 legFrameCounter = 0.0;
34519 _ = legFrame;
34520 reference5.Y = 0;
34521 }
34522 else if (itemAnimation > 0 && inventory[selectedItem].useStyle != 10 && flag4)
34523 {
34524 if (inventory[selectedItem].useStyle == 1 || inventory[selectedItem].type == 0)
34525 {
34526 if ((double)itemAnimation < (double)itemAnimationMax * 0.333)
34527 {
34528 bodyFrame.Y = bodyFrame.Height * 3;
34529 }
34530 else if ((double)itemAnimation < (double)itemAnimationMax * 0.666)
34531 {
34532 bodyFrame.Y = bodyFrame.Height * 2;
34533 }
34534 else
34535 {
34536 bodyFrame.Y = bodyFrame.Height;
34537 }
34538 }
34539 else if (inventory[selectedItem].useStyle == 7)
34540 {
34541 if ((double)itemAnimation > (double)itemAnimationMax * 0.5)
34542 {
34543 bodyFrame.Y = bodyFrame.Height * 3;
34544 }
34545 else
34546 {
34547 bodyFrame.Y = bodyFrame.Height * 2;
34548 }
34549 }
34550 else if (inventory[selectedItem].useStyle == 2)
34551 {
34552 bodyFrame.Y = bodyFrame.Height * 3;
34553 }
34554 else if (inventory[selectedItem].useStyle == 11)
34555 {
34556 if ((double)itemAnimation > (double)itemAnimationMax * 0.5)
34557 {
34558 bodyFrame.Y = bodyFrame.Height * 4;
34559 }
34560 else if ((double)itemAnimation > (double)itemAnimationMax * 0.15)
34561 {
34562 bodyFrame.Y = bodyFrame.Height * 3;
34563 }
34564 else
34565 {
34566 bodyFrame.Y = bodyFrame.Height * 2;
34567 }
34568 }
34569 else if (inventory[selectedItem].useStyle == 9)
34570 {
34571 bodyFrame.Y = 0;
34572 }
34573 else if (inventory[selectedItem].useStyle == 6)
34574 {
34575 float num19 = 1f - (float)itemAnimation / (float)itemAnimationMax;
34576 num19 *= 6f;
34577 if (num19 > 1f)
34578 {
34579 num19 = 1f;
34580 }
34581 if (num19 >= 0.5f)
34582 {
34583 bodyFrame.Y = bodyFrame.Height * 3;
34584 }
34585 else
34586 {
34587 bodyFrame.Y = bodyFrame.Height * 2;
34588 }
34589 }
34590 else if (inventory[selectedItem].useStyle == 3)
34591 {
34592 if ((double)itemAnimation > (double)itemAnimationMax * 0.666)
34593 {
34594 bodyFrame.Y = bodyFrame.Height * 3;
34595 }
34596 else
34597 {
34598 bodyFrame.Y = bodyFrame.Height * 3;
34599 }
34600 }
34601 else if (inventory[selectedItem].useStyle == 4)
34602 {
34603 bodyFrame.Y = bodyFrame.Height * 2;
34604 }
34605 else if (inventory[selectedItem].useStyle == 8)
34606 {
34607 bodyFrame.Y = 0;
34608 }
34609 else if (inventory[selectedItem].useStyle == 12)
34610 {
34611 bodyFrame.Y = bodyFrame.Height * 3;
34612 }
34613 else if (inventory[selectedItem].useStyle == 13)
34614 {
34615 if ((double)itemAnimation < (double)itemAnimationMax * 0.333)
34616 {
34617 bodyFrame.Y = bodyFrame.Height * 3;
34618 }
34619 else if ((double)itemAnimation < (double)itemAnimationMax * 0.666)
34620 {
34621 bodyFrame.Y = bodyFrame.Height * 2;
34622 }
34623 else
34624 {
34625 bodyFrame.Y = bodyFrame.Height;
34626 }
34627 }
34628 else if (inventory[selectedItem].useStyle == 5)
34629 {
34630 if (inventory[selectedItem].type == 281 || inventory[selectedItem].type == 986)
34631 {
34632 bodyFrame.Y = bodyFrame.Height * 2;
34633 }
34634 else
34635 {
34636 float num20 = itemRotation * (float)direction;
34637 bodyFrame.Y = bodyFrame.Height * 3;
34638 if ((double)num20 < -0.75)
34639 {
34640 bodyFrame.Y = bodyFrame.Height * 2;
34641 if (gravDir == -1f)
34642 {
34643 bodyFrame.Y = bodyFrame.Height * 4;
34644 }
34645 }
34646 if ((double)num20 > 0.6)
34647 {
34648 bodyFrame.Y = bodyFrame.Height * 4;
34649 if (gravDir == -1f)
34650 {
34651 bodyFrame.Y = bodyFrame.Height * 2;
34652 }
34653 }
34654 }
34655 }
34656 }
34657 else if (pulley)
34658 {
34659 if (pulleyDir == 2)
34660 {
34661 bodyFrame.Y = bodyFrame.Height;
34662 }
34663 else
34664 {
34665 bodyFrame.Y = bodyFrame.Height * 2;
34666 }
34667 }
34668 else if (flag3 && inventory[selectedItem].holdStyle == 1 && (!wet || !inventory[selectedItem].noWet) && (!happyFunTorchTime || inventory[selectedItem].createTile != 4))
34669 {
34670 bodyFrame.Y = bodyFrame.Height * 3;
34671 }
34672 else if (flag3 && inventory[selectedItem].holdStyle == 2 && (!wet || !inventory[selectedItem].noWet))
34673 {
34674 bodyFrame.Y = bodyFrame.Height * 2;
34675 }
34676 else if (flag3 && inventory[selectedItem].holdStyle == 3)
34677 {
34678 bodyFrame.Y = bodyFrame.Height * 3;
34679 }
34680 else if (flag3 && inventory[selectedItem].holdStyle == 5)
34681 {
34682 bodyFrame.Y = bodyFrame.Height * 3;
34683 }
34684 else if (flag3 && inventory[selectedItem].holdStyle == 7)
34685 {
34686 bodyFrame.Y = bodyFrame.Height * 11;
34687 }
34688 else if (flag3 && inventory[selectedItem].holdStyle == 4 && velocity.Y == 0f && gravDir == 1f)
34689 {
34691 _ = bodyFrame;
34692 reference6.Y = 0;
34693 }
34694 else if (shieldRaised)
34695 {
34696 bodyFrame.Y = bodyFrame.Height * 10;
34697 }
34698 else if (mount.Active)
34699 {
34700 bodyFrameCounter = 0.0;
34701 bodyFrame.Y = bodyFrame.Height * mount.BodyFrame;
34702 }
34703 else if (grappling[0] >= 0)
34704 {
34705 sandStorm = false;
34707 Vector2 vector = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
34708 float num21 = 0f;
34709 float num22 = 0f;
34710 for (int m = 0; m < grapCount; m++)
34711 {
34712 num21 += Main.projectile[grappling[m]].position.X + (float)(Main.projectile[grappling[m]].width / 2);
34713 num22 += Main.projectile[grappling[m]].position.Y + (float)(Main.projectile[grappling[m]].height / 2);
34714 }
34715 num21 /= (float)grapCount;
34716 num22 /= (float)grapCount;
34717 num21 -= vector.X;
34718 num22 -= vector.Y;
34719 if (num22 < 0f && Math.Abs(num22) > Math.Abs(num21))
34720 {
34721 bodyFrame.Y = bodyFrame.Height * 2;
34722 if (gravDir == -1f)
34723 {
34724 bodyFrame.Y = bodyFrame.Height * 4;
34725 }
34726 }
34727 else if (num22 > 0f && Math.Abs(num22) > Math.Abs(num21))
34728 {
34729 bodyFrame.Y = bodyFrame.Height * 4;
34730 if (gravDir == -1f)
34731 {
34732 bodyFrame.Y = bodyFrame.Height * 2;
34733 }
34734 }
34735 else
34736 {
34737 bodyFrame.Y = bodyFrame.Height * 3;
34738 }
34739 }
34740 else if (wet && ShouldFloatInWater)
34741 {
34742 bodyFrame.Y = bodyFrame.Height * 10;
34743 }
34744 else if (swimTime > 0)
34745 {
34746 if (swimTime > 20)
34747 {
34749 _ = bodyFrame;
34750 reference7.Y = 0;
34751 }
34752 else if (swimTime > 10)
34753 {
34754 bodyFrame.Y = bodyFrame.Height * 5;
34755 }
34756 else
34757 {
34759 _ = bodyFrame;
34760 reference8.Y = 0;
34761 }
34762 }
34763 else if (velocity.Y != 0f)
34764 {
34765 if (sliding)
34766 {
34767 bodyFrame.Y = bodyFrame.Height * 3;
34768 }
34769 else if (sandStorm || carpetFrame >= 0)
34770 {
34771 bodyFrame.Y = bodyFrame.Height * 6;
34772 }
34773 else if (eocDash > 0)
34774 {
34775 bodyFrame.Y = bodyFrame.Height * 6;
34776 }
34777 else if (wings > 0)
34778 {
34779 if (wings == 22 || wings == 28 || wings == 45)
34780 {
34781 bodyFrame.Y = 0;
34782 }
34783 else if (velocity.Y > 0f)
34784 {
34785 if (controlJump)
34786 {
34787 bodyFrame.Y = bodyFrame.Height * 6;
34788 }
34789 else
34790 {
34791 bodyFrame.Y = bodyFrame.Height * 5;
34792 }
34793 }
34794 else
34795 {
34796 bodyFrame.Y = bodyFrame.Height * 6;
34797 }
34798 }
34799 else
34800 {
34801 bodyFrame.Y = bodyFrame.Height * 5;
34802 }
34803 bodyFrameCounter = 0.0;
34804 }
34805 else if (velocity.X != 0f)
34806 {
34807 if (legs == 140)
34808 {
34809 bodyFrameCounter += Math.Abs(velocity.X) * 0.5f;
34810 while (bodyFrameCounter > 8.0)
34811 {
34812 bodyFrameCounter -= 8.0;
34813 bodyFrame.Y += bodyFrame.Height;
34814 }
34815 if (bodyFrame.Y < bodyFrame.Height * 7)
34816 {
34817 bodyFrame.Y = bodyFrame.Height * 19;
34818 }
34819 else if (bodyFrame.Y > bodyFrame.Height * 19)
34820 {
34821 bodyFrame.Y = bodyFrame.Height * 7;
34822 }
34823 }
34824 else
34825 {
34826 bodyFrameCounter += (double)Math.Abs(velocity.X) * 1.5;
34827 bodyFrame.Y = legFrame.Y;
34828 }
34829 }
34830 else
34831 {
34832 bodyFrameCounter = 0.0;
34834 _ = bodyFrame;
34835 reference9.Y = 0;
34836 }
34837 if (legs == 140)
34838 {
34839 legFrameCounter = 0.0;
34840 legFrame.Y = legFrame.Height * (velocity.Y != 0f).ToInt();
34841 int num23 = bodyFrame.Y / bodyFrame.Height;
34842 if (Main.OffsetsPlayerHeadgear[num23].Y == 0f)
34843 {
34844 legFrame.Y = legFrame.Height * 7;
34845 }
34846 if (wings == 22 || wings == 28)
34847 {
34848 legFrame.Y = 0;
34849 }
34850 }
34851 if (legs == 217 && (sitting.isSitting || sleeping.isSleeping))
34852 {
34853 legFrameCounter = 0.0;
34854 legFrame.Y = legFrame.Height * 5;
34855 }
34857 {
34859 }
34860 }
static double Abs(double value)
const double PI
Definition Math.cs:16
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
static ArmorShaderDataSet Armor
Definition GameShaders.cs:7
static bool[] DrawInBackpackLayer
Definition ArmorIDs.cs:1591
static IncludeCapeFrontAndBackInfo[] IncludeCapeFrontAndBack
Definition ArmorIDs.cs:623
static bool[] DisableHandOnAndOffAccDraw
Definition ArmorIDs.cs:647
static bool[] DisableBeltAccDraw
Definition ArmorIDs.cs:649
static bool[] DrawInFaceUnderHairLayer
Definition ArmorIDs.cs:1985
static bool[] UseAltFaceHeadDraw
Definition ArmorIDs.cs:20
int headSlot
Definition Item.cs:195
int createTile
Definition Item.cs:161
int legSlot
Definition Item.cs:199
int bodySlot
Definition Item.cs:197
bool IsConsideredASlimeMount
Definition Mount.cs:471
void TryBeginningFlight(Player mountedPlayer, int state)
Definition Mount.cs:3782
int GetIntendedGroundedFrame(Player mountedPlayer)
Definition Mount.cs:3802
int BodyFrame
Definition Mount.cs:353
bool Active
Definition Mount.cs:345
void TryLanding(Player mountedPlayer)
Definition Mount.cs:3811
bool CanHover()
Definition Mount.cs:2384
void UpdateFrame(Player mountedPlayer, int state, Vector2 velocity)
Definition Mount.cs:3023
bool controlRight
Definition Player.cs:1383
bool socialShadowRocketBoots
Definition Player.cs:1229
bool armorEffectDrawOutlinesForbidden
Definition Player.cs:1225
int itemAnimationMax
Definition Player.cs:2567
PlayerSleepingHelper sleeping
Definition Player.cs:2465
RabbitOrderFrameHelper rabbitOrderFrame
Definition Player.cs:1527
void ApplyArmorSoundAndDustChanges()
Definition Player.cs:36101
bool socialIgnoreLight
Definition Player.cs:1237
float itemRotation
Definition Player.cs:1177
bool ShouldDrawFootball()
Definition Player.cs:33968
PlayerSittingHelper sitting
Definition Player.cs:2463
bool forceWerewolf
Definition Player.cs:1947
void CancelAllJumpVisualEffects()
Definition Player.cs:34862
void SetCompositeArmBack(bool enabled, CompositeArmStretchAmount stretch, float rotation)
Definition Player.cs:3716
bool happyFunTorchTime
Definition Player.cs:2625
int ArmorSetDye()
Definition Player.cs:9255
bool armorEffectDrawShadowEOCShield
Definition Player.cs:1227
static int SetMatch(SetMatchRequest request, ref bool somethingSpecial)
Definition Player.cs:35344
void UpdateVisibleAccessories()
Definition Player.cs:34962
bool isDisplayDollOrInanimate
Definition Player.cs:1245
bool ShouldFloatInWater
Definition Player.cs:3348
void ChangeDir(int dir)
Definition Player.cs:40136
bool armorEffectDrawShadowSubtle
Definition Player.cs:1217
bool ShouldDrawWingsThatAreAlwaysAnimated()
Definition Player.cs:28507
int[] grappling
Definition Player.cs:2305
sbyte faceFlower
Definition Player.cs:1361
double bodyFrameCounter
Definition Player.cs:1095
Rectangle bodyFrame
Definition Player.cs:1373
double legFrameCounter
Definition Player.cs:1097
bool armorEffectDrawOutlines
Definition Player.cs:1219
void SetArmorEffectVisuals(Player drawPlayer)
Definition Player.cs:35179
bool armorEffectDrawShadow
Definition Player.cs:1215
bool armorEffectDrawShadowLokis
Definition Player.cs:1221
bool drawingFootball
Definition Player.cs:2191
bool armorEffectDrawShadowBasilisk
Definition Player.cs:1223
Item[] inventory
Definition Player.cs:1257
bool skipAnimatingValuesInPlayerFrame
Definition Player.cs:1525
bool CanVisuallyHoldItem(Item item)
Definition Player.cs:47316
bool shieldRaised
Definition Player.cs:2673
Rectangle legFrame
Definition Player.cs:1375

References System.Math.Abs(), Terraria.Lighting.AddLight(), Terraria.ID.ArmorIDs.Face.Sets.AltFaceHead, Terraria.Graphics.Shaders.GameShaders.Armor, Terraria.Item.bodySlot, Terraria.Item.createTile, Terraria.ID.ArmorIDs.Body.Sets.DisableBeltAccDraw, Terraria.ID.ArmorIDs.Body.Sets.DisableHandOnAndOffAccDraw, Terraria.ID.ArmorIDs.Back.Sets.DrawInBackpackLayer, Terraria.ID.ArmorIDs.Face.Sets.DrawInFaceUnderHairLayer, Terraria.ID.ArmorIDs.Back.Sets.DrawInTailLayer, Terraria.Main.dust, Terraria.Main.gameMenu, Terraria.Main.gamePaused, Terraria.Item.GetDrawHitbox(), Terraria.Item.headSlot, Terraria.ID.ArmorIDs.Body.Sets.IncludeCapeFrontAndBack, Terraria.ID.ArmorIDs.Body.Sets.IncludedCapeBack, Terraria.ID.ArmorIDs.Body.Sets.IncludedCapeBackFemale, Terraria.ID.ArmorIDs.Body.Sets.IncludedCapeFront, Terraria.ID.ArmorIDs.Waist.Sets.IsABelt, Terraria.Item.legSlot, Terraria.Dust.NewDust(), System.obj, Terraria.Main.OffsetsPlayerHeadgear, Terraria.ID.ArmorIDs.Face.Sets.OverrideHelmet, System.Math.PI, Terraria.Main.projectile, Terraria.Main.rand, System.type, Terraria.Item.type, Terraria.ID.ArmorIDs.Head.Sets.UseAltFaceHeadDraw, and Microsoft.Xna.Framework.Vector2.X.

Referenced by Terraria.GameContent.UI.Elements.UICharacter.UICharacter(), Terraria.GameContent.Tile_Entities.TEDisplayDoll.Draw(), Terraria.GameContent.Tile_Entities.TEHatRack.Draw(), Terraria.GameContent.Animations.Segments.PlayerSegment.Draw(), Terraria.Graphics.Renderers.LegacyPlayerRenderer.DrawPlayerFull(), Terraria.Player.LoadPlayer(), and Terraria.GameContent.UI.Elements.UICharacter.Update().