fixed audio bug

This commit is contained in:
c0ffee 2022-10-24 17:50:20 -07:00
parent 7ae88ba6ed
commit 7ca301f90a
10 changed files with 104 additions and 73 deletions

View File

@ -10,8 +10,8 @@
<subSounds>
<li>
<grains>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/cum</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/cum</clipPath>
</li>
</grains>
<volumeRange>
@ -39,8 +39,8 @@
<subSounds>
<li>
<grains>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/kucyu04</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/kucyu04</clipPath>
</li>
</grains>
<volumeRange>
@ -68,35 +68,35 @@
<subSounds>
<li>
<grains>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Suck/Suck_1</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Suck/Suck_1</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Suck/Suck_2</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Suck/Suck_2</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Suck/Suck_3</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Suck/Suck_3</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Suck/Suck_4</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Suck/Suck_4</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Suck/Suck_5</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Suck/Suck_5</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Suck/Suck_6</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Suck/Suck_6</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Suck/Suck_7</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Suck/Suck_7</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Suck/Suck_8</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Suck/Suck_8</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Suck/Suck_9</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Suck/Suck_9</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Suck/Suck_10</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Suck/Suck_10</clipPath>
</li>
</grains>
<volumeRange>
@ -125,29 +125,29 @@
<subSounds>
<li>
<grains>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Clap_1</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Clap_1</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Clap_2</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Clap_2</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Clap_3</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Clap_3</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Clap_4</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Clap_4</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Clap_5</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Clap_5</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Clap_6</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Clap_6</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Clap_7</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Clap_7</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Clap_8</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Clap_8</clipPath>
</li>
</grains>
<volumeRange>
@ -176,20 +176,20 @@
<subSounds>
<li>
<grains>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Slime/Slimy1</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Slime/Slimy1</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Slime/Slimy2</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Slime/Slimy2</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Slime/Slimy3</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Slime/Slimy3</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Slime/Slimy4</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Slime/Slimy4</clipPath>
</li>
<li Class="AudioGrain_Folder">
<clipFolderPath>Sex/Slime/Slimy5</clipFolderPath>
<li Class="AudioGrain_Clip">
<clipPath>Sex/Slime/Slimy5</clipPath>
</li>
</grains>
<volumeRange>

View File

@ -7,6 +7,7 @@ using Rimworld_Animations;
namespace Rimworld_Animations
{
/* todo: fix for 1.4
[StaticConstructorOnStartup]
public static class PawnWoundDrawerExtension
{
@ -15,7 +16,7 @@ namespace Rimworld_Animations
if (pawn == null)
{ return; }
if (!flags.FlagSet(PawnRenderFlags.Portrait) && layer == BodyTypeDef.WoundLayer.Head)
if (!flags.FlagSet(PawnRenderFlags.Portrait) && layer == BodyTypeDef.WoundAnchor.)
{
CompBodyAnimator pawnAnimator = pawn.TryGetComp<CompBodyAnimator>();
if (pawnAnimator != null && pawnAnimator.isAnimating && pawn.Drawer.renderer.graphics.headGraphic != null)
@ -31,4 +32,6 @@ namespace Rimworld_Animations
pawnWoundDrawer.RenderOverBody(drawLoc, bodyMesh, quat, drawNow, layer, pawnRot, overApparel);
}
}
*/
}

View File

@ -18,12 +18,40 @@ namespace Rimworld_Animations {
{
static HarmonyPatch_AlienRace()
{
/*
(new Harmony("rjwanim")).Patch(AccessTools.Method(AccessTools.TypeByName("AlienRace.HarmonyPatches"), "DrawAddons"),
prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_AlienRace), "Prefix_AnimateHeadAddons")));
*/
}
public static void Prefix_DrawAddonsFinalHook(ref Pawn pawn, ref AlienPartGenerator.BodyAddon addon, ref Rot4 rot, ref Graphic graphic, ref Vector3 offsetVector, ref float angle, ref Material mat)
{
CompBodyAnimator animator = pawn.TryGetComp<CompBodyAnimator>();
public static bool Prefix_AnimateHeadAddons(PawnRenderFlags renderFlags, Vector3 vector /*rootloc*/, Vector3 headOffset, Pawn pawn, Quaternion quat, Rot4 rotation)
if (animator == null || !animator.isAnimating)
{
return;
}
if(addon.alignWithHead || addon.drawnInBed)
{
rot = animator.headFacing;
angle = animator.headAngle;
offsetVector += angle * animator.headBob;
}
else
{
rot = animator.bodyFacing;
angle = animator.bodyAngle;
offsetVector += animator.deltaPos;
}
}
/*
public static bool Prefix_AnimateHeadAddons(PawnRenderFlags renderFlags, Vector3 vector, Vector3 headOffset, Pawn pawn, Quaternion quat, Rot4 rotation)
{
if (renderFlags.FlagSet(PawnRenderFlags.Portrait) || pawn.TryGetComp<CompBodyAnimator>() == null || !pawn.TryGetComp<CompBodyAnimator>().isAnimating) return true;
@ -130,17 +158,8 @@ namespace Rimworld_Animations {
{
Quaternion addonRotation = Quaternion.AngleAxis(pawnAnimator.headAngle < 0 ? 360 - (360 % pawnAnimator.headAngle) : pawnAnimator.headAngle, Vector3.up);
/*
*
* genital rotation is borked
if (AnimationSettings.controlGenitalRotation && pawnAnimator.controlGenitalAngle && ba?.hediffGraphics != null && ba.hediffGraphics.Count != 0 && ba.hediffGraphics[0]?.path != null && (ba.hediffGraphics[0].path.Contains("Penis") || ba.hediffGraphics[0].path.Contains("penis")))
{
addonRotation = Quaternion.AngleAxis(angle: pawnAnimator.genitalAngle < 0 ? 360 - (360 % pawnAnimator.genitalAngle) : pawnAnimator.genitalAngle, axis: Vector3.up);
}
*/
GenDraw.DrawMeshNowOrLater(mesh: addonGraphic.MeshAt(rot: pawnAnimator.headFacing), loc: vector /*rootloc*/ + orassanv + (ba.alignWithHead && !orassan ? headOffset : headOffset - addonRotation * pawn.Drawer.renderer.BaseHeadOffsetAt(pawnAnimator.headFacing)) + vector2.RotatedBy(angle: Mathf.Acos(f: Quaternion.Dot(a: Quaternion.identity, b: addonRotation)) * 2f * 57.29578f),
GenDraw.DrawMeshNowOrLater(mesh: addonGraphic.MeshAt(rot: pawnAnimator.headFacing), loc: vector + orassanv + (ba.alignWithHead && !orassan ? headOffset : headOffset - addonRotation * pawn.Drawer.renderer.BaseHeadOffsetAt(pawnAnimator.headFacing)) + vector2.RotatedBy(angle: Mathf.Acos(f: Quaternion.Dot(a: Quaternion.identity, b: addonRotation)) * 2f * 57.29578f),
quat: Quaternion.AngleAxis(angle: num, axis: Vector3.up) * addonRotation, mat: addonGraphic.MatAt(rot: pawnAnimator.headFacing), renderFlags.FlagSet(PawnRenderFlags.DrawNow));
@ -168,6 +187,8 @@ namespace Rimworld_Animations {
return false;
}
*/
}
[HarmonyPatch(typeof(PawnGraphicSet), "ResolveApparelGraphics")]

View File

@ -8,6 +8,7 @@ using RimWorld;
using Verse;
using rjw;
using System.Reflection.Emit;
using Verse.AI;
namespace Rimworld_Animations
{
@ -15,16 +16,16 @@ namespace Rimworld_Animations
[HarmonyPatch(typeof(JobDriver_SexBaseRecieverLoved), "MakeSexToil")]
public static class HarmonyPatch_JobDriver_SexBaseReceiverLoved
{
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> codeInstructions)
{
var ins = codeInstructions.ToList();
for(int i = 0; i < ins.Count; i++)
{
if(i + 13 < ins.Count && ins[i + 13].opcode == OpCodes.Call && ins[i + 13].OperandIs(AccessTools.DeclaredMethod(typeof(Toils_LayDown), "LayDown"))) {
if(i < ins.Count && ins[i].opcode == OpCodes.Call && ins[i].OperandIs(AccessTools.DeclaredMethod(typeof(Toils_LayDown), "LayDown"))) {
ins.RemoveRange(i, 14);
ins[i].operand = AccessTools.DeclaredMethod(typeof(HarmonyPatch_JobDriver_SexBaseReceiverLoved), "DoNotLayDown");
yield return ins[i];
}
@ -36,5 +37,10 @@ namespace Rimworld_Animations
}
public static Toil DoNotLayDown(TargetIndex bedOrRestSpotIndex, bool hasBed, bool lookForOtherJobs, bool canSleep = true, bool gainRestAndHealth = true, PawnPosture noBedLayingPosture = PawnPosture.LayingMask, bool deathrest = false)
{
return new Toil();
}
}
}

View File

@ -63,7 +63,7 @@ namespace Rimworld_Animations {
yield return ins[i];
//headFacing equals true
}
/*
// Fixes the offsets for eye implants and wounds on the head during animations
else if (ins[i].opcode == OpCodes.Callvirt && ins[i].operand != null && ins[i].OperandIs(AccessTools.DeclaredMethod(typeof(PawnWoundDrawer), "RenderOverBody")))
{
@ -73,7 +73,7 @@ namespace Rimworld_Animations {
yield return new CodeInstruction(OpCodes.Ldarg_S, (object)6); // renderer flags
yield return new CodeInstruction(OpCodes.Call, AccessTools.DeclaredMethod(typeof(PawnWoundDrawerExtension), "RenderOverBody"));
}
*/
else
{
yield return ins[i];

View File

@ -21,7 +21,7 @@
<li>1.4</li>
<li IfModActive="velc.HatsDisplaySelection">Patch_HatsDisplaySelection/1.2</li>
<li IfModActive="c0ffee.SexToysMasturbation">Patch_SexToysMasturbation</li>
<li IfModActive="c0ffee.SexToysMasturbation">Patch_SexToysMasturbation/1.3</li>
<li IfModActive="c0ffee.SexToysMasturbation">Patch_SexToysMasturbation/1.4</li>
</v1.4>

View File

@ -17,7 +17,7 @@
<DebugSymbols>false</DebugSymbols>
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>1.3\Assemblies\</OutputPath>
<OutputPath>1.4\Assemblies\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@ -73,8 +73,8 @@
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Source\Defs\SexToyAnimationDef.cs" />
<Compile Include="Source\Patches\HarmonyPatch_JobDriver_SexBaseInitiator.cs" />
<Compile Include="Source\Harmony\Harmony_PatchAll.cs" />
<Compile Include="Source\Patches\HarmonyPatch_JobDriver_SexBaseInitiator.cs" />
<Compile Include="Source\Utilities\AnimSexToyUtility.cs" />
</ItemGroup>
<ItemGroup>

View File

@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Rimworld_Animations</RootNamespace>
<AssemblyName>Rimworld-Animations</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
@ -32,11 +33,11 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>..\..\..\..\workshop\content\294100\2009463077\Current\Assemblies\0Harmony.dll</HintPath>
<HintPath>..\..\..\..\workshop\content\294100\839005762\1.4\Assemblies\0Harmony.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="AlienRace">
<HintPath>..\..\..\..\workshop\content\294100\839005762\1.3\Assemblies\AlienRace.dll</HintPath>
<HintPath>..\..\..\..\workshop\content\294100\839005762\1.4\Assemblies\AlienRace.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp">