Add animations to SPAS-12

This commit is contained in:
George Paton 2024-02-01 21:56:51 +11:00
parent 3d6c2aa67e
commit 1de796fec5
6 changed files with 2157 additions and 1926 deletions

View File

@ -10,6 +10,7 @@ import com.hbm.items.ItemAmmoEnums.Ammo12Gauge;
import com.hbm.items.ModItems;
import com.hbm.lib.HbmCollection;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.main.ResourceManager;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import com.hbm.particle.SpentCasing;
@ -17,7 +18,6 @@ import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.potion.HbmPotion;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationSequence.Dimension;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
@ -88,11 +88,12 @@ public class Gun12GaugeFactory {
GunConfiguration config = new GunConfiguration();
config.rateOfFire = 25;
config.rateOfFire = 20;
config.roundsPerCycle = 1;
config.gunMode = GunConfiguration.MODE_NORMAL;
config.firingMode = GunConfiguration.FIRE_MANUAL;
config.reloadDuration = 10;
config.emptyReloadAdditionalDuration = 5;
config.firingDuration = 5;
config.ammoCap = 8;
config.durability = 2500;
@ -108,20 +109,17 @@ public class Gun12GaugeFactory {
config.comment.add("Alt-fire with Mouse 2 (Right-click) to fire 2 shells at once");
config.config = HbmCollection.g12hs;
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("SPAS_RECOIL", new BusAnimationSequence()
.addKeyframePosition(0, 0, -2, 100)
.addKeyframePosition(0, 0, 0, 200)
.addKeyframeRotation(-10, 0, 5, 100)
.addKeyframeRotation(0, 0, 0, 200)
)
.addBus("SPAS_PUMP", new BusAnimationSequence()
.addKeyframe(Dimension.TZ, 0, 450)
.addKeyframe(Dimension.TZ, -1.8, 200)
.addKeyframe(Dimension.TZ, 0, 200)
)
);
config.reloadAnimationsSequential = true;
config.loadAnimations = i -> {
config.animations.put(AnimType.CYCLE, ResourceManager.spas_12_anim.get("Fire"));
config.animations.put(AnimType.ALT_CYCLE, ResourceManager.spas_12_anim.get("FireAlt"));
config.animations.put(AnimType.RELOAD, ResourceManager.spas_12_anim.get("ReloadStart"));
config.animations.put(AnimType.RELOAD_EMPTY, ResourceManager.spas_12_anim.get("ReloadEmptyStart"));
config.animations.put(AnimType.RELOAD_CYCLE, ResourceManager.spas_12_anim.get("Reload"));
config.animations.put(AnimType.RELOAD_END, ResourceManager.spas_12_anim.get("ReloadEnd"));
};
config.ejector = EJECTOR_SPAS;
@ -290,7 +288,7 @@ public class Gun12GaugeFactory {
config.reloadType = 1;
config.ammoCap = 24;
config.reloadDuration = 20;
config.reloadSound = config.RSOUND_MAG;
config.reloadSound = GunConfiguration.RSOUND_MAG;
config.reloadSoundEnd = true;
config.name += "Drum";
return config;

View File

@ -848,6 +848,7 @@ public class ResourceManager {
public static final HashMap<String, BusAnimation> cursed_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/cursed.json"));
public static final HashMap<String, BusAnimation> novac_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/novac.json"));
public static final HashMap<String, BusAnimation> ks23_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/ks23.json"));
public static final HashMap<String, BusAnimation> spas_12_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/spas12.json"));
public static final IModelCustom lance = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/lance.obj"));

View File

@ -1,7 +1,12 @@
package com.hbm.render.item.weapon;
import java.awt.Color;
import org.lwjgl.opengl.GL11;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.items.weapon.ItemGunBase;
import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations;
@ -47,16 +52,37 @@ public class ItemRenderWeaponSpas12 implements IItemRenderer {
double s0 = 0.5D;
GL11.glRotated(25, 0, 0, 1);
GL11.glTranslated(0, -0.8, 0.1);
GL11.glRotated(80, 0, 1, 0);
GL11.glRotated(-100, 0, 1, 0);
GL11.glScaled(s0, s0, s0);
HbmAnimations.applyRelevantTransformation("SPAS_RECOIL");
HbmAnimations.applyRelevantTransformation("MainBody");
ResourceManager.spas_12.renderPart("MainBody");
HbmAnimations.applyRelevantTransformation("SPAS_PUMP");
GL11.glPushMatrix();
HbmAnimations.applyRelevantTransformation("PumpGrip");
ResourceManager.spas_12.renderPart("PumpGrip");
GL11.glPopMatrix();
GL11.glPushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.casings_tex);
HbmAnimations.applyRelevantTransformation("Shell");
ItemGunBase gun = (ItemGunBase)item.getItem();
BulletConfiguration bullet = BulletConfigSyncingUtil.pullConfig(gun.mainConfig.config.get(ItemGunBase.getMagType(item)));
int[] colors = bullet.spentCasing.getColors();
Color shellColor = new Color(colors[1]);
GL11.glColor3f(shellColor.getRed() / 255F, shellColor.getGreen() / 255F, shellColor.getBlue() / 255F);
ResourceManager.spas_12.renderPart("Shell");
Color shellForeColor = new Color(colors[0]);
GL11.glColor3f(shellForeColor.getRed() / 255F, shellForeColor.getGreen() / 255F, shellForeColor.getBlue() / 255F);
ResourceManager.spas_12.renderPart("ShellFore");
GL11.glColor3f(1F, 1F, 1F);
GL11.glPopMatrix();
break;
@ -65,9 +91,9 @@ public class ItemRenderWeaponSpas12 implements IItemRenderer {
double scale = 0.25D;
GL11.glScaled(scale, scale, scale);
GL11.glRotatef(20F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(10, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(15F, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(2F, -1F, -2F);
GL11.glRotatef(190, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-15F, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(-2F, -1F, 2F);
ResourceManager.spas_12.renderAll();
@ -77,7 +103,7 @@ public class ItemRenderWeaponSpas12 implements IItemRenderer {
double s1 = 0.25D;
GL11.glScaled(s1, s1, s1);
GL11.glTranslated(0, 0, -4);
GL11.glTranslated(0, 0, 4);
ResourceManager.spas_12.renderAll();
@ -91,7 +117,7 @@ public class ItemRenderWeaponSpas12 implements IItemRenderer {
GL11.glTranslated(12, 13.5, 0);
GL11.glRotated(-90, 0, 1, 0);
GL11.glRotated(-135, 1, 0, 0);
GL11.glScaled(s, s, -s);
GL11.glScaled(s, s, s);
ResourceManager.spas_12.renderAll();
@ -99,9 +125,6 @@ public class ItemRenderWeaponSpas12 implements IItemRenderer {
default: break;
}
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 19 KiB