mirror of
				https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
				synced 2024-08-15 00:43:45 +00:00 
			
		
		
		
	further tweaks to fix simplecurve bug
This commit is contained in:
		
							parent
							
								
									a3f53f79fe
								
							
						
					
					
						commit
						6bc3ab7bcb
					
				
					 2 changed files with 37 additions and 27 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -39,8 +39,6 @@ namespace Rimworld_Animations {
 | 
				
			||||||
        private bool mirror = false, quiver = false, shiver = false;
 | 
					        private bool mirror = false, quiver = false, shiver = false;
 | 
				
			||||||
        private int actor;
 | 
					        private int actor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private int lastDrawFrame = -1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        private int animTicks = 0, stageTicks = 0, clipTicks = 0;
 | 
					        private int animTicks = 0, stageTicks = 0, clipTicks = 0;
 | 
				
			||||||
        private int curStage = 0;
 | 
					        private int curStage = 0;
 | 
				
			||||||
        private float clipPercent = 0;
 | 
					        private float clipPercent = 0;
 | 
				
			||||||
| 
						 | 
					@ -357,7 +355,7 @@ namespace Rimworld_Animations {
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            deltaPos.y = clip.layer.AltitudeFor();
 | 
					            deltaPos.y = clip.layer.AltitudeFor();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            bool adjustOffsetX = false, adjustOffsetZ = false, adjustBodyAngle = false, adjustHeadAngle = false, adjustGenitalAngle = false;
 | 
					            bool adjustOffsetX = false, adjustOffsetZ = false;
 | 
				
			||||||
            if(clip.BodyOffsetX.Any())
 | 
					            if(clip.BodyOffsetX.Any())
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                deltaPos.x = clip.BodyOffsetX.Evaluate(clipPercent) * (mirror ? -1 : 1);
 | 
					                deltaPos.x = clip.BodyOffsetX.Evaluate(clipPercent) * (mirror ? -1 : 1);
 | 
				
			||||||
| 
						 | 
					@ -378,30 +376,31 @@ namespace Rimworld_Animations {
 | 
				
			||||||
                    deltaPos.z += AnimationSettings.offsets[CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex].y;
 | 
					                    deltaPos.z += AnimationSettings.offsets[CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex].y;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if(clip.BodyAngle.Any())
 | 
					            float offsetRotation = 0f;
 | 
				
			||||||
 | 
					            if (AnimationSettings.rotation != null && AnimationSettings.rotation.ContainsKey(CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                offsetRotation = AnimationSettings.rotation[CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex] * (Mirror ? -1 : 1);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (clip.BodyAngle.Any())
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                adjustBodyAngle = true;
 | 
					 | 
				
			||||||
                bodyAngle = (clip.BodyAngle.Evaluate(clipPercent) + (quiver || shiver ? ((Rand.Value * AnimationSettings.shiverIntensity) - (AnimationSettings.shiverIntensity / 2f)) : 0f)) * (mirror ? -1 : 1);
 | 
					                bodyAngle = (clip.BodyAngle.Evaluate(clipPercent) + (quiver || shiver ? ((Rand.Value * AnimationSettings.shiverIntensity) - (AnimationSettings.shiverIntensity / 2f)) : 0f)) * (mirror ? -1 : 1);
 | 
				
			||||||
 | 
					                bodyAngle += offsetRotation;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if(clip.HeadAngle.Any())
 | 
					            if(clip.HeadAngle.Any())
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                adjustHeadAngle = true;
 | 
					 | 
				
			||||||
                headAngle = clip.HeadAngle.Evaluate(clipPercent) * (mirror ? -1 : 1);
 | 
					                headAngle = clip.HeadAngle.Evaluate(clipPercent) * (mirror ? -1 : 1);
 | 
				
			||||||
 | 
					                headAngle += offsetRotation;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (controlGenitalAngle && clip.GenitalAngle.Any()) {
 | 
					            if (controlGenitalAngle && clip.GenitalAngle.Any()) 
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
                adjustGenitalAngle = true;
 | 
					 | 
				
			||||||
                genitalAngle = clip.GenitalAngle.Evaluate(clipPercent) * (mirror ? -1 : 1);
 | 
					                genitalAngle = clip.GenitalAngle.Evaluate(clipPercent) * (mirror ? -1 : 1);
 | 
				
			||||||
 | 
					                genitalAngle += offsetRotation;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (AnimationSettings.rotation != null && AnimationSettings.rotation.ContainsKey(CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex)) {
 | 
					            
 | 
				
			||||||
                float offsetRotation = AnimationSettings.rotation[CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex] * (Mirror ? -1 : 1);
 | 
					 | 
				
			||||||
                if (adjustGenitalAngle) genitalAngle += offsetRotation;
 | 
					 | 
				
			||||||
                if (adjustBodyAngle) bodyAngle += offsetRotation;
 | 
					 | 
				
			||||||
                if (adjustHeadAngle) headAngle += offsetRotation;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //don't go past 360 or less than 0
 | 
					            //don't go past 360 or less than 0
 | 
				
			||||||
| 
						 | 
					@ -409,21 +408,32 @@ namespace Rimworld_Animations {
 | 
				
			||||||
            AnimationUtility.Clamp0to360(ref headAngle);
 | 
					            AnimationUtility.Clamp0to360(ref headAngle);
 | 
				
			||||||
            AnimationUtility.Clamp0to360(ref genitalAngle);
 | 
					            AnimationUtility.Clamp0to360(ref genitalAngle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if(clip.BodyFacing.Any())
 | 
				
			||||||
            bodyFacing = mirror ? new Rot4((int)clip.BodyFacing.Evaluate(clipPercent)).Opposite : new Rot4((int)clip.BodyFacing.Evaluate(clipPercent));
 | 
					            {
 | 
				
			||||||
 | 
					                bodyFacing = new Rot4((int)clip.BodyFacing.Evaluate(clipPercent));
 | 
				
			||||||
            bodyFacing = new Rot4((int)clip.BodyFacing.Evaluate(clipPercent));
 | 
					                if (bodyFacing.IsHorizontal && mirror)
 | 
				
			||||||
            if(bodyFacing.IsHorizontal && mirror) {
 | 
					                {
 | 
				
			||||||
                bodyFacing = bodyFacing.Opposite;
 | 
					                    bodyFacing = bodyFacing.Opposite;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            headFacing = new Rot4((int)clip.HeadFacing.Evaluate(clipPercent));
 | 
					            
 | 
				
			||||||
            if(headFacing.IsHorizontal && mirror) {
 | 
					            if(clip.HeadFacing.Any())
 | 
				
			||||||
                headFacing = headFacing.Opposite;
 | 
					            {
 | 
				
			||||||
 | 
					                headFacing = new Rot4((int)clip.HeadFacing.Evaluate(clipPercent));
 | 
				
			||||||
 | 
					                if (headFacing.IsHorizontal && mirror)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    headFacing = headFacing.Opposite;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            headBob = new Vector3(0, 0, clip.HeadBob.Evaluate(clipPercent));
 | 
					            if(clip.HeadBob.Any())
 | 
				
			||||||
            Vector2 bodyScale = (pawn.story?.bodyType?.bodyGraphicScale != null ? pawn.story.bodyType.bodyGraphicScale : Vector2.one);
 | 
					            {
 | 
				
			||||||
            headBob.z *= bodyScale.x;
 | 
					                headBob = new Vector3(0, 0, clip.HeadBob.Evaluate(clipPercent));
 | 
				
			||||||
 | 
					                Vector2 bodyScale = (pawn.story?.bodyType?.bodyGraphicScale != null ? pawn.story.bodyType.bodyGraphicScale : Vector2.one);
 | 
				
			||||||
 | 
					                headBob.z *= bodyScale.x;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue