public override Model getRotatedModel() { Model model = animation.getModel(); if (model == null) { return(null); } int frameId = -1; if (animation.sequences != null) { frameId = animation.sequences.primaryFrames[animationFrame]; } Model rotatedModel = new Model(true, Animation.isNullFrame(frameId), false, model); if (frameId != -1) { rotatedModel.createBones(); rotatedModel.applyTransformation(frameId); rotatedModel.triangleSkin = null; rotatedModel.vertexSkin = null; } if (animation.scaleXY != 128 || animation.scaleZ != 128) { rotatedModel.scaleT(animation.scaleXY, animation.scaleXY, animation.scaleZ); } rotatedModel.rotateX(rotationX); rotatedModel.applyLighting(64 + animation.modelLightFalloff, 850 + animation.modelLightAmbient, -30, -50, -30, true); return(rotatedModel); }
public override Model getRotatedModel() { if (npcDefinition == null) { return(null); } Model rotatedModel = getChildModel(); if (rotatedModel == null) { return(null); } base.height = rotatedModel.modelHeight; if (base.graphicId != -1 && base.currentAnimationId != -1) { SpotAnimation spotAnimation = SpotAnimation.cache[base.graphicId]; Model animationModel = spotAnimation.getModel(); if (animationModel != null) { int frameId = spotAnimation.sequences.primaryFrames[base.currentAnimationId]; Model animatedModel = new Model(true, Animation.isNullFrame(frameId), false, animationModel); animatedModel.translate(0, -base.graphicHeight, 0); animatedModel.createBones(); animatedModel.applyTransformation(frameId); animatedModel.triangleSkin = null; animatedModel.vertexSkin = null; if (spotAnimation.scaleXY != 128 || spotAnimation.scaleZ != 128) { animatedModel.scaleT(spotAnimation.scaleXY, spotAnimation.scaleXY, spotAnimation.scaleZ); } animatedModel.applyLighting(64 + spotAnimation.modelLightFalloff, 850 + spotAnimation.modelLightAmbient, -30, -50, -30, true); Model[] models = { rotatedModel, animatedModel }; rotatedModel = new Model(models); } } if (npcDefinition.boundaryDimension == 1) { rotatedModel.singleTile = true; } return(rotatedModel); }
public Model getAnimatedModel(int frame1Id, int frame2Id, bool active) { Model model; if (active) { model = getModel(modelTypeActive, modelIdActive); } else { model = getModel(modelTypeDefault, modelIdDefault); } if (model == null) { return(null); } if (frame2Id == -1 && frame1Id == -1 && model.triangleColours == null) { return(model); } Model animatedModel = new Model(true, Animation.isNullFrame(frame2Id) & Animation.isNullFrame(frame1Id), false, model); if (frame2Id != -1 || frame1Id != -1) { animatedModel.createBones(); } if (frame2Id != -1) { animatedModel.applyTransformation(frame2Id); } if (frame1Id != -1) { animatedModel.applyTransformation(frame1Id); } animatedModel.applyLighting(64, 768, -50, -10, -50, true); return(animatedModel); }
public Model getChildModel(int frameId2, int frameId1, int[] framesFrom2) { if (childrenIDs != null) { EntityDefinition childDefinition = getChildDefinition(); if (childDefinition == null) { return(null); } else { return(childDefinition.getChildModel(frameId2, frameId1, framesFrom2)); } } Model model = (Model)modelCache.get(id); if (model == null) { bool notCached = false; for (int m = 0; m < modelIds.Length; m++) { if (!Model.isCached(modelIds[m])) { notCached = true; } } if (notCached) { return(null); } Model[] childModels = new Model[modelIds.Length]; for (int m = 0; m < modelIds.Length; m++) { childModels[m] = Model.getModel(modelIds[m]); } if (childModels.Length == 1) { model = childModels[0]; } else { model = new Model(childModels.Length, childModels); } if (modifiedModelColours != null) { for (int c = 0; c < modifiedModelColours.Length; c++) { model.recolour(modifiedModelColours[c], originalModelColours[c]); } } model.createBones(); model.applyLighting(64 + brightness, 850 + contrast, -30, -50, -30, true); modelCache.put(model, id); } Model childModel = Model.aModel_1621; childModel.replaceWithModel(model, Animation.isNullFrame(frameId1) & Animation.isNullFrame(frameId2)); if (frameId1 != -1 && frameId2 != -1) { childModel.mixAnimationFrames(framesFrom2, frameId2, frameId1); } else if (frameId1 != -1) { childModel.applyTransformation(frameId1); } if (scaleXY != 128 || scaleZ != 128) { childModel.scaleT(scaleXY, scaleXY, scaleZ); } childModel.calculateDiagonals(); childModel.triangleSkin = null; childModel.vertexSkin = null; if (boundaryDimension == 1) { childModel.singleTile = true; } return(childModel); }
private Model getAnimatedModel() { if (npcAppearance != null) { int frameId = -1; if (base.animation >= 0 && base.animationDelay == 0) { frameId = AnimationSequence.animations[base.animation].primaryFrames[base.currentAnimationFrame]; } else if (base.queuedAnimationId >= 0) { frameId = AnimationSequence.animations[base.queuedAnimationId].primaryFrames[base.queuedAnimationFrame]; } Model model = npcAppearance.getChildModel(-1, frameId, null); return(model); } long l = appearanceOffset; int k = -1; int i1 = -1; int j1 = -1; int k1 = -1; if (base.animation >= 0 && base.animationDelay == 0) { AnimationSequence animation = AnimationSequence.animations[base.animation]; k = animation.primaryFrames[base.currentAnimationFrame]; if (base.queuedAnimationId >= 0 && base.queuedAnimationId != base.standAnimationId) { i1 = AnimationSequence.animations[base.queuedAnimationId].primaryFrames[base.queuedAnimationFrame]; } if (animation.playerReplacementShield >= 0) { j1 = animation.playerReplacementShield; l += j1 - appearance[5] << 40; } if (animation.playerReplacementWeapon >= 0) { k1 = animation.playerReplacementWeapon; l += k1 - appearance[3] << 48; } } else if (base.queuedAnimationId >= 0) { k = AnimationSequence.animations[base.queuedAnimationId].primaryFrames[base.queuedAnimationFrame]; } Model model_1 = (Model)mruNodes.get(l); if (model_1 == null) { bool flag = false; for (int i2 = 0; i2 < 12; i2++) { int k2 = appearance[i2]; if (k1 >= 0 && i2 == 3) { k2 = k1; } if (j1 >= 0 && i2 == 5) { k2 = j1; } if (k2 >= 256 && k2 < 512 && !IdentityKit.cache[k2 - 256].bodyModelCached()) { flag = true; } if (k2 >= 512 && !ItemDefinition.getDefinition(k2 - 512).equipModelCached(gender)) { flag = true; } } if (flag) { if (aLong1697 != -1L) { model_1 = (Model)mruNodes.get(aLong1697); } if (model_1 == null) { return(null); } } } if (model_1 == null) { Model[] models = new Model[12]; int j2 = 0; for (int l2 = 0; l2 < 12; l2++) { int i3 = appearance[l2]; if (k1 >= 0 && l2 == 3) { i3 = k1; } if (j1 >= 0 && l2 == 5) { i3 = j1; } if (i3 >= 256 && i3 < 512) { Model model_3 = IdentityKit.cache[i3 - 256].getBodyModel(); if (model_3 != null) { models[j2++] = model_3; } } if (i3 >= 512) { Model model_4 = ItemDefinition.getDefinition(i3 - 512).getEquippedModel(gender); if (model_4 != null) { models[j2++] = model_4; } } } model_1 = new Model(j2, models); for (int part = 0; part < 5; part++) { if (bodyPartColour[part] != 0) { model_1.recolour(ConstantData.GetAppearanceColor(part, 0), ConstantData.GetAppearanceColor(part, bodyPartColour[part])); if (part == 1) { model_1.recolour(ConstantData.GetBeardColor(0), ConstantData.GetBeardColor(bodyPartColour[part])); } } } model_1.createBones(); model_1.applyLighting(64, 850, -30, -50, -30, true); mruNodes.put(model_1, l); aLong1697 = l; } if (preventRotation) { return(model_1); } Model model_2 = Model.aModel_1621; model_2.replaceWithModel(model_1, Animation.isNullFrame(k) & Animation.isNullFrame(i1)); if (k != -1 && i1 != -1) { model_2.mixAnimationFrames(AnimationSequence.animations[base.animation].flowControl, i1, k); } else if (k != -1) { model_2.applyTransformation(k); } model_2.calculateDiagonals(); model_2.triangleSkin = null; model_2.vertexSkin = null; return(model_2); }
public override Model getRotatedModel() { if (!visible) { return(null); } Model appearanceModel = getAnimatedModel(); if (appearanceModel == null) { return(null); } base.height = appearanceModel.modelHeight; appearanceModel.singleTile = true; if (preventRotation) { return(appearanceModel); } if (base.graphicId != -1 && base.currentAnimationId != -1) { SpotAnimation animation = SpotAnimation.cache[base.graphicId]; Model graphicModel = animation.getModel(); if (graphicModel != null) { Model model = new Model(true, Animation.isNullFrame(base.currentAnimationId), false, graphicModel); model.translate(0, -base.graphicHeight, 0); model.createBones(); model.applyTransformation(animation.sequences.primaryFrames[base.currentAnimationId]); model.triangleSkin = null; model.vertexSkin = null; if (animation.scaleXY != 128 || animation.scaleZ != 128) { model.scaleT(animation.scaleXY, animation.scaleXY, animation.scaleZ); } model.applyLighting(64 + animation.modelLightFalloff, 850 + animation.modelLightAmbient, -30, -50, -30, true); Model[] models = { appearanceModel, model }; appearanceModel = new Model(models); } } if (playerModel != null) { if (clientInstance.CurrentTick >= modifiedAppearanceEndTime) { playerModel = null; } if (clientInstance.CurrentTick >= modifiedAppearanceStartTime && clientInstance.CurrentTick < modifiedAppearanceEndTime) { Model model = playerModel; model.translate(anInt1711 - base.x, drawHeight - drawHeight2, anInt1713 - base.y); if (base.turnDirection == 512) { model.rotate90Degrees(); model.rotate90Degrees(); model.rotate90Degrees(); } else if (base.turnDirection == 1024) { model.rotate90Degrees(); model.rotate90Degrees(); } else if (base.turnDirection == 1536) { model.rotate90Degrees(); } Model[] models = { appearanceModel, model }; appearanceModel = new Model(models); if (base.turnDirection == 512) { model.rotate90Degrees(); } else if (base.turnDirection == 1024) { model.rotate90Degrees(); model.rotate90Degrees(); } else if (base.turnDirection == 1536) { model.rotate90Degrees(); model.rotate90Degrees(); model.rotate90Degrees(); } model.translate(base.x - anInt1711, drawHeight2 - drawHeight, base.y - anInt1713); } } appearanceModel.singleTile = true; return(appearanceModel); }
private Model getAnimatedModel(int type, int animationId, int face) { Model subModel = null; long hash; if (modelTypes == null) { if (type != 10) { return(null); } hash = (id << 6) + face + ((long)(animationId + 1) << 32); Model cachedModel = (Model)animatedModelCache.get(hash); if (cachedModel != null) { return(cachedModel); } if (modelIds == null) { return(null); } bool mirror = rotated ^ (face > 3); int modelCount = modelIds.Length; for (int m = 0; m < modelCount; m++) { int subModelId = modelIds[m]; if (mirror) { subModelId += 0x10000; } subModel = (Model)modelCache.get(subModelId); if (subModel == null) { subModel = Model.getModel(subModelId & 0xffff); if (subModel == null) { return(null); } if (mirror) { subModel.mirror(); } modelCache.put(subModel, subModelId); } if (modelCount > 1) { models[m] = subModel; } } if (modelCount > 1) { subModel = new Model(modelCount, models); } } else { int modelType = -1; for (int t = 0; t < modelTypes.Length; t++) { if (modelTypes[t] != type) { continue; } modelType = t; break; } if (modelType == -1) { return(null); } hash = (id << 6) + (modelType << 3) + face + ((long)(animationId + 1) << 32); Model model = (Model)animatedModelCache.get(hash); if (model != null) { return(model); } int modelId = modelIds[modelType]; bool mirror = rotated ^ (face > 3); if (mirror) { modelId += 0x10000; } subModel = (Model)modelCache.get(modelId); if (subModel == null) { subModel = Model.getModel(modelId & 0xffff); if (subModel == null) { return(null); } if (mirror) { subModel.mirror(); } modelCache.put(subModel, modelId); } } bool scale; scale = scaleX != 128 || scaleY != 128 || scaleZ != 128; bool translate; translate = translateX != 0 || translateY != 0 || translateZ != 0; Model animatedModel = new Model(modifiedModelColors == null, Animation.isNullFrame(animationId), face == 0 && animationId == -1 && !scale && !translate, subModel); if (animationId != -1) { animatedModel.createBones(); animatedModel.applyTransformation(animationId); animatedModel.triangleSkin = null; animatedModel.vertexSkin = null; } while (face-- > 0) { animatedModel.rotate90Degrees(); } if (modifiedModelColors != null) { for (int c = 0; c < modifiedModelColors.Length; c++) { animatedModel.recolour(modifiedModelColors[c], originalModelColors[c]); } } if (scale) { animatedModel.scaleT(scaleX, scaleZ, scaleY); } if (translate) { animatedModel.translate(translateX, translateY, translateZ); } animatedModel.applyLighting(64 + ambient, 768 + diffuse * 5, -50, -10, -50, !delayShading); if (_solid == 1) { animatedModel.anInt1654 = animatedModel.modelHeight; } animatedModelCache.put(animatedModel, hash); return(animatedModel); }