public static int _amInitLine(object p) { AppMain.AMS_AME_CREATE_PARAM amsAmeCreateParam = (AppMain.AMS_AME_CREATE_PARAM)p; AppMain.AMS_AME_NODE_LINE node = (AppMain.AMS_AME_NODE_LINE)amsAmeCreateParam.node; AppMain.AMS_AME_RUNTIME_WORK_LINE work = (AppMain.AMS_AME_RUNTIME_WORK_LINE)amsAmeCreateParam.work; work.time = -node.start_time; work.length = node.length_start; work.inside_width = node.inside_width_start; work.outside_width = node.outside_width_start; AppMain.AMS_RGBA8888 insideColorStart = node.inside_color_start; insideColorStart.a = (byte)((int)insideColorStart.a * amsAmeCreateParam.ecb.transparency >> 8); work.set_inside_color(insideColorStart.color); AppMain.AMS_RGBA8888 outsideColorStart = node.outside_color_start; outsideColorStart.a = (byte)((int)outsideColorStart.a * amsAmeCreateParam.ecb.transparency >> 8); work.set_outside_color(outsideColorStart.color); AppMain.amVectorAdd(ref work.position, ref amsAmeCreateParam.parent_position.UnsafeValue, ref amsAmeCreateParam.position.UnsafeValue); AppMain.amVectorAdd(work.position, node.translate); AppMain.amVectorScale(work.velocity, amsAmeCreateParam.parent_velocity.Value, node.inheritance_rate); AppMain.amVectorAdd(work.velocity, amsAmeCreateParam.velocity.Value); if (((int)node.flag & 32768) != 0) { work.tex_time = 0.0f; work.tex_no = 0; if (((int)node.flag & 524288) != 0) { work.tex_no = (int)(100.0 * (double)AppMain.nnRandom()) % node.tex_anim.key_num; } AppMain.AMS_AME_TEX_ANIM_KEY amsAmeTexAnimKey = node.tex_anim.key_buf[work.tex_no]; work.set_st(amsAmeTexAnimKey.l, amsAmeTexAnimKey.t, amsAmeTexAnimKey.r, amsAmeTexAnimKey.b); } else if (((int)node.flag & 8192) != 0) { work.set_st(node.cropping_l, node.cropping_t, node.cropping_r, node.cropping_b); } else { work.set_st(0.0f, 0.0f, 1f, 1f); } if (((int)node.flag & 1048576) != 0 || ((int)node.flag & 131072) != 0 && (double)AppMain.nnRandom() > 0.5) { work.flag |= 8U; work.set_st(work.st.z, work.st.y, work.st.x, work.st.w); } if (((int)node.flag & 2097152) != 0 || ((int)node.flag & 262144) != 0 && (double)AppMain.nnRandom() > 0.5) { work.flag |= 16U; work.set_st(work.st.x, work.st.w, work.st.z, work.st.y); } return(0); }
public static AppMain.AMS_AME_HEADER readAMEfile(BinaryReader br) { AppMain.AMS_AME_HEADER amsAmeHeader = new AppMain.AMS_AME_HEADER(); amsAmeHeader.file_id = br.ReadBytes(4); amsAmeHeader.file_version = br.ReadInt32(); amsAmeHeader.node_num = br.ReadInt32(); amsAmeHeader.node_ofst = br.ReadUInt32(); amsAmeHeader.bounding.center.x = br.ReadSingle(); amsAmeHeader.bounding.center.y = br.ReadSingle(); amsAmeHeader.bounding.center.z = br.ReadSingle(); amsAmeHeader.bounding.center.w = br.ReadSingle(); amsAmeHeader.bounding.radius = br.ReadSingle(); amsAmeHeader.bounding.radius2 = br.ReadSingle(); br.BaseStream.Seek(8L, SeekOrigin.Current); br.BaseStream.Seek(16L, SeekOrigin.Current); amsAmeHeader.node = new AppMain.AMS_AME_NODE[amsAmeHeader.node_num]; br.BaseStream.Seek((long)amsAmeHeader.node_ofst, SeekOrigin.Begin); Dictionary <uint, AppMain.AMS_AME_NODE> dictionary = new Dictionary <uint, AppMain.AMS_AME_NODE>(amsAmeHeader.node_num); for (int index1 = 0; index1 < amsAmeHeader.node_num; ++index1) { uint index2 = (uint)br.BaseStream.Position + 15U & 4294967280U; if ((long)index2 < br.BaseStream.Length) { br.BaseStream.Seek((long)index2, SeekOrigin.Begin); short id = br.ReadInt16(); AppMain.AME_AME_NODE_TYPE ameAmeNodeType = (AppMain.AME_AME_NODE_TYPE)br.ReadInt16(); uint flag = br.ReadUInt32(); char[] name = br.ReadChars(12); int child_offset = br.ReadInt32(); int sibling_offset = br.ReadInt32(); int parent_offset = br.ReadInt32(); switch (ameAmeNodeType) { case AppMain.AME_AME_NODE_TYPE.AME_AME_NODE_TYPE_OMNI: AppMain.AMS_AME_NODE_OMNI amsAmeNodeOmni = new AppMain.AMS_AME_NODE_OMNI(); AppMain.fillAMENodeBegin((AppMain.AMS_AME_NODE)amsAmeNodeOmni, id, (short)ameAmeNodeType, flag, name, child_offset, sibling_offset, parent_offset); AppMain.readVector4(br, amsAmeNodeOmni.translate); AppMain.readQuaternion(br, ref amsAmeNodeOmni.rotate); amsAmeNodeOmni.inheritance_rate = br.ReadSingle(); amsAmeNodeOmni.life = br.ReadSingle(); amsAmeNodeOmni.start_time = br.ReadSingle(); amsAmeNodeOmni.offset = br.ReadSingle(); amsAmeNodeOmni.offset_chaos = br.ReadSingle(); amsAmeNodeOmni.speed = br.ReadSingle(); amsAmeNodeOmni.speed_chaos = br.ReadSingle(); amsAmeNodeOmni.max_count = br.ReadSingle(); amsAmeNodeOmni.frequency = br.ReadSingle(); dictionary[index2] = (AppMain.AMS_AME_NODE)amsAmeNodeOmni; amsAmeHeader.node[index1] = (AppMain.AMS_AME_NODE)amsAmeNodeOmni; break; case AppMain.AME_AME_NODE_TYPE.AME_AME_NODE_TYPE_DIRECTIONAL: AppMain.AMS_AME_NODE_DIRECTIONAL ameNodeDirectional = new AppMain.AMS_AME_NODE_DIRECTIONAL(); AppMain.fillAMENodeBegin((AppMain.AMS_AME_NODE)ameNodeDirectional, id, (short)ameAmeNodeType, flag, name, child_offset, sibling_offset, parent_offset); AppMain.readVector4(br, ameNodeDirectional.translate); AppMain.readQuaternion(br, ref ameNodeDirectional.rotate); ameNodeDirectional.inheritance_rate = br.ReadSingle(); ameNodeDirectional.life = br.ReadSingle(); ameNodeDirectional.start_time = br.ReadSingle(); ameNodeDirectional.offset = br.ReadSingle(); ameNodeDirectional.offset_chaos = br.ReadSingle(); ameNodeDirectional.speed = br.ReadSingle(); ameNodeDirectional.speed_chaos = br.ReadSingle(); ameNodeDirectional.max_count = br.ReadSingle(); ameNodeDirectional.frequency = br.ReadSingle(); ameNodeDirectional.spread = br.ReadSingle(); ameNodeDirectional.spread_variation = br.ReadSingle(); dictionary[index2] = (AppMain.AMS_AME_NODE)ameNodeDirectional; amsAmeHeader.node[index1] = (AppMain.AMS_AME_NODE)ameNodeDirectional; break; case AppMain.AME_AME_NODE_TYPE.AME_AME_NODE_TYPE_SURFACE: AppMain.AMS_AME_NODE_SURFACE amsAmeNodeSurface = new AppMain.AMS_AME_NODE_SURFACE(); AppMain.fillAMENodeBegin((AppMain.AMS_AME_NODE)amsAmeNodeSurface, id, (short)ameAmeNodeType, flag, name, child_offset, sibling_offset, parent_offset); AppMain.readVector4(br, amsAmeNodeSurface.translate); AppMain.readQuaternion(br, ref amsAmeNodeSurface.rotate); amsAmeNodeSurface.inheritance_rate = br.ReadSingle(); amsAmeNodeSurface.life = br.ReadSingle(); amsAmeNodeSurface.start_time = br.ReadSingle(); amsAmeNodeSurface.offset = br.ReadSingle(); amsAmeNodeSurface.offset_chaos = br.ReadSingle(); amsAmeNodeSurface.speed = br.ReadSingle(); amsAmeNodeSurface.speed_chaos = br.ReadSingle(); amsAmeNodeSurface.max_count = br.ReadSingle(); amsAmeNodeSurface.frequency = br.ReadSingle(); amsAmeNodeSurface.width = br.ReadSingle(); amsAmeNodeSurface.width_variation = br.ReadSingle(); amsAmeNodeSurface.height = br.ReadSingle(); amsAmeNodeSurface.height_variation = br.ReadSingle(); dictionary[index2] = (AppMain.AMS_AME_NODE)amsAmeNodeSurface; amsAmeHeader.node[index1] = (AppMain.AMS_AME_NODE)amsAmeNodeSurface; break; case AppMain.AME_AME_NODE_TYPE.AME_AME_NODE_TYPE_CIRCLE: AppMain.AMS_AME_NODE_CIRCLE amsAmeNodeCircle = new AppMain.AMS_AME_NODE_CIRCLE(); AppMain.fillAMENodeBegin((AppMain.AMS_AME_NODE)amsAmeNodeCircle, id, (short)ameAmeNodeType, flag, name, child_offset, sibling_offset, parent_offset); AppMain.readVector4(br, amsAmeNodeCircle.translate); AppMain.readQuaternion(br, ref amsAmeNodeCircle.rotate); amsAmeNodeCircle.inheritance_rate = br.ReadSingle(); amsAmeNodeCircle.life = br.ReadSingle(); amsAmeNodeCircle.start_time = br.ReadSingle(); amsAmeNodeCircle.offset = br.ReadSingle(); amsAmeNodeCircle.offset_chaos = br.ReadSingle(); amsAmeNodeCircle.speed = br.ReadSingle(); amsAmeNodeCircle.speed_chaos = br.ReadSingle(); amsAmeNodeCircle.max_count = br.ReadSingle(); amsAmeNodeCircle.frequency = br.ReadSingle(); amsAmeNodeCircle.spread = br.ReadSingle(); amsAmeNodeCircle.spread_variation = br.ReadSingle(); amsAmeNodeCircle.radius = br.ReadSingle(); amsAmeNodeCircle.radius_variation = br.ReadSingle(); dictionary[index2] = (AppMain.AMS_AME_NODE)amsAmeNodeCircle; amsAmeHeader.node[index1] = (AppMain.AMS_AME_NODE)amsAmeNodeCircle; break; case AppMain.AME_AME_NODE_TYPE.AME_AME_NODE_TYPE_SIMPLE_SPRITE: case AppMain.AME_AME_NODE_TYPE.AME_AME_NODE_TYPE_SPRITE: AppMain.AMS_AME_NODE_SPRITE amsAmeNodeSprite = new AppMain.AMS_AME_NODE_SPRITE(); AppMain.fillAMENodeBegin((AppMain.AMS_AME_NODE)amsAmeNodeSprite, id, (short)ameAmeNodeType, flag, name, child_offset, sibling_offset, parent_offset); AppMain.readVector4(br, amsAmeNodeSprite.translate); AppMain.readQuaternion(br, ref amsAmeNodeSprite.rotate); amsAmeNodeSprite.z_bias = br.ReadSingle(); amsAmeNodeSprite.inheritance_rate = br.ReadSingle(); amsAmeNodeSprite.life = br.ReadSingle(); amsAmeNodeSprite.start_time = br.ReadSingle(); amsAmeNodeSprite.size = br.ReadSingle(); amsAmeNodeSprite.size_chaos = br.ReadSingle(); amsAmeNodeSprite.scale_x_start = br.ReadSingle(); amsAmeNodeSprite.scale_x_end = br.ReadSingle(); amsAmeNodeSprite.scale_y_start = br.ReadSingle(); amsAmeNodeSprite.scale_y_end = br.ReadSingle(); amsAmeNodeSprite.twist_angle = br.ReadSingle(); amsAmeNodeSprite.twist_angle_chaos = br.ReadSingle(); amsAmeNodeSprite.twist_angle_speed = br.ReadSingle(); amsAmeNodeSprite.color_start.color = br.ReadUInt32(); amsAmeNodeSprite.color_end.color = br.ReadUInt32(); amsAmeNodeSprite.blend = br.ReadInt32(); amsAmeNodeSprite.texture_slot = br.ReadInt16(); amsAmeNodeSprite.texture_id = br.ReadInt16(); amsAmeNodeSprite.cropping_l = br.ReadSingle(); amsAmeNodeSprite.cropping_t = br.ReadSingle(); amsAmeNodeSprite.cropping_r = br.ReadSingle(); amsAmeNodeSprite.cropping_b = br.ReadSingle(); amsAmeNodeSprite.scroll_u = br.ReadSingle(); amsAmeNodeSprite.scroll_v = br.ReadSingle(); amsAmeNodeSprite.tex_anim = AppMain.readTexAnim(br); dictionary[index2] = (AppMain.AMS_AME_NODE)amsAmeNodeSprite; amsAmeHeader.node[index1] = (AppMain.AMS_AME_NODE)amsAmeNodeSprite; break; case AppMain.AME_AME_NODE_TYPE.AME_AME_NODE_TYPE_LINE: AppMain.AMS_AME_NODE_LINE amsAmeNodeLine = new AppMain.AMS_AME_NODE_LINE(); AppMain.fillAMENodeBegin((AppMain.AMS_AME_NODE)amsAmeNodeLine, id, (short)ameAmeNodeType, flag, name, child_offset, sibling_offset, parent_offset); AppMain.readVector4(br, amsAmeNodeLine.translate); AppMain.readQuaternion(br, ref amsAmeNodeLine.rotate); amsAmeNodeLine.z_bias = br.ReadSingle(); amsAmeNodeLine.inheritance_rate = br.ReadSingle(); amsAmeNodeLine.life = br.ReadSingle(); amsAmeNodeLine.start_time = br.ReadSingle(); amsAmeNodeLine.length_start = br.ReadSingle(); amsAmeNodeLine.length_end = br.ReadSingle(); amsAmeNodeLine.inside_width_start = br.ReadSingle(); amsAmeNodeLine.inside_width_end = br.ReadSingle(); amsAmeNodeLine.outside_width_start = br.ReadSingle(); amsAmeNodeLine.outside_width_end = br.ReadSingle(); amsAmeNodeLine.inside_color_start.color = br.ReadUInt32(); amsAmeNodeLine.inside_color_end.color = br.ReadUInt32(); amsAmeNodeLine.outside_color_start.color = br.ReadUInt32(); amsAmeNodeLine.outside_color_end.color = br.ReadUInt32(); amsAmeNodeLine.blend = br.ReadInt32(); amsAmeNodeLine.texture_slot = br.ReadInt16(); amsAmeNodeLine.texture_id = br.ReadInt16(); amsAmeNodeLine.cropping_l = br.ReadSingle(); amsAmeNodeLine.cropping_t = br.ReadSingle(); amsAmeNodeLine.cropping_r = br.ReadSingle(); amsAmeNodeLine.cropping_b = br.ReadSingle(); amsAmeNodeLine.scroll_u = br.ReadSingle(); amsAmeNodeLine.scroll_v = br.ReadSingle(); amsAmeNodeLine.tex_anim = AppMain.readTexAnim(br); dictionary[index2] = (AppMain.AMS_AME_NODE)amsAmeNodeLine; amsAmeHeader.node[index1] = (AppMain.AMS_AME_NODE)amsAmeNodeLine; break; case AppMain.AME_AME_NODE_TYPE.AME_AME_NODE_TYPE_PLANE: AppMain.AMS_AME_NODE_PLANE amsAmeNodePlane = new AppMain.AMS_AME_NODE_PLANE(); AppMain.fillAMENodeBegin((AppMain.AMS_AME_NODE)amsAmeNodePlane, id, (short)ameAmeNodeType, flag, name, child_offset, sibling_offset, parent_offset); AppMain.readVector4(br, amsAmeNodePlane.translate); AppMain.readQuaternion(br, ref amsAmeNodePlane.rotate); AppMain.readVector4(br, amsAmeNodePlane.rotate_axis); amsAmeNodePlane.z_bias = br.ReadSingle(); amsAmeNodePlane.inheritance_rate = br.ReadSingle(); amsAmeNodePlane.life = br.ReadSingle(); amsAmeNodePlane.start_time = br.ReadSingle(); amsAmeNodePlane.size = br.ReadSingle(); amsAmeNodePlane.size_chaos = br.ReadSingle(); amsAmeNodePlane.scale_x_start = br.ReadSingle(); amsAmeNodePlane.scale_x_end = br.ReadSingle(); amsAmeNodePlane.scale_y_start = br.ReadSingle(); amsAmeNodePlane.scale_y_end = br.ReadSingle(); amsAmeNodePlane.color_start.color = br.ReadUInt32(); amsAmeNodePlane.color_end.color = br.ReadUInt32(); amsAmeNodePlane.blend = br.ReadInt32(); amsAmeNodePlane.texture_slot = br.ReadInt16(); amsAmeNodePlane.texture_id = br.ReadInt16(); amsAmeNodePlane.cropping_l = br.ReadSingle(); amsAmeNodePlane.cropping_t = br.ReadSingle(); amsAmeNodePlane.cropping_r = br.ReadSingle(); amsAmeNodePlane.cropping_b = br.ReadSingle(); amsAmeNodePlane.scroll_u = br.ReadSingle(); amsAmeNodePlane.scroll_v = br.ReadSingle(); amsAmeNodePlane.tex_anim = AppMain.readTexAnim(br); dictionary[index2] = (AppMain.AMS_AME_NODE)amsAmeNodePlane; amsAmeHeader.node[index1] = (AppMain.AMS_AME_NODE)amsAmeNodePlane; break; case AppMain.AME_AME_NODE_TYPE.AME_AME_NODE_TYPE_MODEL: AppMain.AMS_AME_NODE_MODEL amsAmeNodeModel = new AppMain.AMS_AME_NODE_MODEL(); AppMain.fillAMENodeBegin((AppMain.AMS_AME_NODE)amsAmeNodeModel, id, (short)ameAmeNodeType, flag, name, child_offset, sibling_offset, parent_offset); AppMain.readVector4(br, amsAmeNodeModel.translate); AppMain.readQuaternion(br, ref amsAmeNodeModel.rotate); AppMain.readVector4(br, amsAmeNodeModel.rotate_axis); AppMain.readVector4(br, amsAmeNodeModel.scale_start); AppMain.readVector4(br, amsAmeNodeModel.scale_end); amsAmeNodeModel.z_bias = br.ReadSingle(); amsAmeNodeModel.inheritance_rate = br.ReadSingle(); amsAmeNodeModel.life = br.ReadSingle(); amsAmeNodeModel.start_time = br.ReadSingle(); amsAmeNodeModel.model_name = br.ReadChars(8); amsAmeNodeModel.lod = br.ReadInt32(); amsAmeNodeModel.color_start.color = br.ReadUInt32(); amsAmeNodeModel.color_end.color = br.ReadUInt32(); amsAmeNodeModel.blend = br.ReadInt32(); amsAmeNodeModel.scroll_u = br.ReadSingle(); amsAmeNodeModel.scroll_v = br.ReadSingle(); dictionary[index2] = (AppMain.AMS_AME_NODE)amsAmeNodeModel; amsAmeHeader.node[index1] = (AppMain.AMS_AME_NODE)amsAmeNodeModel; break; case AppMain.AME_AME_NODE_TYPE.AME_AME_NODE_TYPE_GRAVITY: AppMain.AMS_AME_NODE_GRAVITY amsAmeNodeGravity = new AppMain.AMS_AME_NODE_GRAVITY(); AppMain.fillAMENodeBegin((AppMain.AMS_AME_NODE)amsAmeNodeGravity, id, (short)ameAmeNodeType, flag, name, child_offset, sibling_offset, parent_offset); AppMain.readVector4(br, amsAmeNodeGravity.direction); amsAmeNodeGravity.magnitude = br.ReadSingle(); dictionary[index2] = (AppMain.AMS_AME_NODE)amsAmeNodeGravity; amsAmeHeader.node[index1] = (AppMain.AMS_AME_NODE)amsAmeNodeGravity; break; case AppMain.AME_AME_NODE_TYPE.AME_AME_NODE_TYPE_UNIFORM: AppMain.AMS_AME_NODE_UNIFORM amsAmeNodeUniform = new AppMain.AMS_AME_NODE_UNIFORM(); AppMain.fillAMENodeBegin((AppMain.AMS_AME_NODE)amsAmeNodeUniform, id, (short)ameAmeNodeType, flag, name, child_offset, sibling_offset, parent_offset); AppMain.readVector4(br, amsAmeNodeUniform.direction); amsAmeNodeUniform.magnitude = br.ReadSingle(); dictionary[index2] = (AppMain.AMS_AME_NODE)amsAmeNodeUniform; amsAmeHeader.node[index1] = (AppMain.AMS_AME_NODE)amsAmeNodeUniform; break; case AppMain.AME_AME_NODE_TYPE.AME_AME_NODE_TYPE_RADIAL: AppMain.AMS_AME_NODE_RADIAL amsAmeNodeRadial = new AppMain.AMS_AME_NODE_RADIAL(); AppMain.fillAMENodeBegin((AppMain.AMS_AME_NODE)amsAmeNodeRadial, id, (short)ameAmeNodeType, flag, name, child_offset, sibling_offset, parent_offset); AppMain.readVector4(br, amsAmeNodeRadial.position); amsAmeNodeRadial.magnitude = br.ReadSingle(); amsAmeNodeRadial.attenuation = br.ReadSingle(); dictionary[index2] = (AppMain.AMS_AME_NODE)amsAmeNodeRadial; amsAmeHeader.node[index1] = (AppMain.AMS_AME_NODE)amsAmeNodeRadial; break; case AppMain.AME_AME_NODE_TYPE.AME_AME_NODE_TYPE_VORTEX: AppMain.AMS_AME_NODE_VORTEX amsAmeNodeVortex = new AppMain.AMS_AME_NODE_VORTEX(); AppMain.fillAMENodeBegin((AppMain.AMS_AME_NODE)amsAmeNodeVortex, id, (short)ameAmeNodeType, flag, name, child_offset, sibling_offset, parent_offset); AppMain.readVector4(br, amsAmeNodeVortex.position); AppMain.readVector4(br, amsAmeNodeVortex.axis); dictionary[index2] = (AppMain.AMS_AME_NODE)amsAmeNodeVortex; amsAmeHeader.node[index1] = (AppMain.AMS_AME_NODE)amsAmeNodeVortex; break; case AppMain.AME_AME_NODE_TYPE.AME_AME_NODE_TYPE_DRAG: AppMain.AMS_AME_NODE_DRAG amsAmeNodeDrag = new AppMain.AMS_AME_NODE_DRAG(); AppMain.fillAMENodeBegin((AppMain.AMS_AME_NODE)amsAmeNodeDrag, id, (short)ameAmeNodeType, flag, name, child_offset, sibling_offset, parent_offset); AppMain.readVector4(br, amsAmeNodeDrag.position); amsAmeNodeDrag.magnitude = br.ReadSingle(); dictionary[index2] = (AppMain.AMS_AME_NODE)amsAmeNodeDrag; amsAmeHeader.node[index1] = (AppMain.AMS_AME_NODE)amsAmeNodeDrag; break; case AppMain.AME_AME_NODE_TYPE.AME_AME_NODE_TYPE_NOISE: AppMain.AMS_AME_NODE_NOISE amsAmeNodeNoise = new AppMain.AMS_AME_NODE_NOISE(); AppMain.fillAMENodeBegin((AppMain.AMS_AME_NODE)amsAmeNodeNoise, id, (short)ameAmeNodeType, flag, name, child_offset, sibling_offset, parent_offset); AppMain.readVector4(br, amsAmeNodeNoise.axis); amsAmeNodeNoise.magnitude = br.ReadSingle(); dictionary[index2] = (AppMain.AMS_AME_NODE)amsAmeNodeNoise; amsAmeHeader.node[index1] = (AppMain.AMS_AME_NODE)amsAmeNodeNoise; break; } } else { break; } } foreach (KeyValuePair <uint, AppMain.AMS_AME_NODE> keyValuePair in dictionary) { AppMain.AMS_AME_NODE amsAmeNode = keyValuePair.Value; if (amsAmeNode.child_offset != 0) { amsAmeNode.child = dictionary[(uint)amsAmeNode.child_offset]; } if (amsAmeNode.parent_offset != 0) { amsAmeNode.parent = dictionary[(uint)amsAmeNode.parent_offset]; } if (amsAmeNode.sibling_offset != 0) { amsAmeNode.sibling = dictionary[(uint)amsAmeNode.sibling_offset]; } } return(amsAmeHeader); }
public static int _amUpdateLine(object r) { AppMain.AMS_AME_RUNTIME runtime = (AppMain.AMS_AME_RUNTIME)r; AppMain.AMS_AME_NODE_LINE node = (AppMain.AMS_AME_NODE_LINE)runtime.node; AppMain.AMS_AME_LIST next = runtime.active_head.next; AppMain.AMS_AME_LIST activeTail = runtime.active_tail; int transparency = runtime.ecb.transparency; float num1; float num2; if ((double)node.life >= 0.0) { num1 = node.life; num2 = 1f / num1; } else { num1 = 1E+38f; num2 = 0.0f; } float sizeRate = runtime.ecb.size_rate; float num3 = node.length_start * sizeRate; float num4 = node.length_end * sizeRate; float num5 = node.inside_width_start * sizeRate; float num6 = node.outside_width_start * sizeRate; float num7 = node.inside_width_end * sizeRate; float num8 = node.outside_width_end * sizeRate; AppMain.NNS_VECTOR4D nnsVectoR4D = new AppMain.NNS_VECTOR4D(); for (; next != activeTail; next = next.next) { AppMain.AMS_AME_RUNTIME_WORK_LINE ameRuntimeWorkLine = (AppMain.AMS_AME_RUNTIME_WORK_LINE)(AppMain.AMS_AME_RUNTIME_WORK) next; ameRuntimeWorkLine.time += AppMain._am_unit_frame; float rate = ameRuntimeWorkLine.time * num2; AppMain.amVectorScale(nnsVectoR4D, ameRuntimeWorkLine.velocity, AppMain._am_unit_time); AppMain.amVectorAdd(ameRuntimeWorkLine.position, nnsVectoR4D); if ((double)ameRuntimeWorkLine.time >= (double)num1) { if (runtime.spawn_runtime != null) { AppMain._amCreateSpawnParticle(runtime, (AppMain.AMS_AME_RUNTIME_WORK)ameRuntimeWorkLine); } AppMain.amEffectDisconnectLink((AppMain.AMS_AME_LIST)ameRuntimeWorkLine); --runtime.active_num; AppMain.amEffectFreeRuntimeWork((AppMain.AMS_AME_RUNTIME_WORK)ameRuntimeWorkLine); } else { float num9 = 1f - rate; ameRuntimeWorkLine.length = (float)((double)num3 * (double)num9 + (double)num4 * (double)rate); ameRuntimeWorkLine.inside_width = (float)((double)num5 * (double)num9 + (double)num7 * (double)rate); ameRuntimeWorkLine.outside_width = (float)((double)num6 * (double)num9 + (double)num8 * (double)rate); AppMain.AMS_RGBA8888 pCO; AppMain.amEffectLerpColor(out pCO, ref node.inside_color_start, ref node.inside_color_end, rate); pCO.a = (byte)((int)pCO.a * transparency >> 8); ameRuntimeWorkLine.set_inside_color(pCO.color); AppMain.amEffectLerpColor(out pCO, ref node.outside_color_start, ref node.outside_color_end, rate); pCO.a = (byte)((int)pCO.a * transparency >> 8); ameRuntimeWorkLine.set_outside_color(pCO.color); if (((int)node.flag & 32768) != 0) { AppMain.AMS_AME_TEX_ANIM texAnim = node.tex_anim; if (((int)ameRuntimeWorkLine.flag & 2) == 0) { ameRuntimeWorkLine.tex_time += AppMain._am_unit_frame; if ((double)ameRuntimeWorkLine.tex_time >= (double)texAnim.key_buf[ameRuntimeWorkLine.tex_no].time) { ameRuntimeWorkLine.tex_time = 0.0f; ++ameRuntimeWorkLine.tex_no; if (ameRuntimeWorkLine.tex_no == texAnim.key_num) { if (((int)node.flag & 65536) != 0) { ameRuntimeWorkLine.tex_no = 0; } else { ameRuntimeWorkLine.tex_no = texAnim.key_num - 1; ameRuntimeWorkLine.flag |= 2U; } } } } AppMain.AMS_AME_TEX_ANIM_KEY amsAmeTexAnimKey = texAnim.key_buf[ameRuntimeWorkLine.tex_no]; ameRuntimeWorkLine.set_st(amsAmeTexAnimKey.l, amsAmeTexAnimKey.t, amsAmeTexAnimKey.r, amsAmeTexAnimKey.b); if (((int)ameRuntimeWorkLine.flag & 8) != 0) { ameRuntimeWorkLine.set_st(ameRuntimeWorkLine.st.z, ameRuntimeWorkLine.st.y, ameRuntimeWorkLine.st.x, ameRuntimeWorkLine.st.w); } if (((int)ameRuntimeWorkLine.flag & 16) != 0) { ameRuntimeWorkLine.set_st(ameRuntimeWorkLine.st.x, ameRuntimeWorkLine.st.w, ameRuntimeWorkLine.st.z, ameRuntimeWorkLine.st.y); } } else if (((int)node.flag & 16384) != 0) { float num10 = node.scroll_u * AppMain._am_unit_time; float num11 = node.scroll_v * AppMain._am_unit_time; if (((int)ameRuntimeWorkLine.flag & 8) != 0) { num10 = -num10; } if (((int)ameRuntimeWorkLine.flag & 16) != 0) { num11 = -num11; } ameRuntimeWorkLine.set_st(ameRuntimeWorkLine.st.x + num10, ameRuntimeWorkLine.st.w + num10, ameRuntimeWorkLine.st.z + num11, ameRuntimeWorkLine.st.y + num11); } } } //AppMain.GlobalPool<AppMain.NNS_VECTOR4D>.Release(nnsVectoR4D); return(0); }
public static int _amDrawLine(object r) { AppMain.AMS_AME_RUNTIME runtime = (AppMain.AMS_AME_RUNTIME)r; AppMain.AMS_AME_NODE_LINE node = (AppMain.AMS_AME_NODE_LINE)runtime.node; AppMain.AMS_AME_LIST next = runtime.active_head.next; AppMain.AMS_AME_LIST activeTail = runtime.active_tail; AppMain.AMS_PARAM_DRAW_PRIMITIVE setParam = AppMain.amDrawAlloc_AMS_PARAM_DRAW_PRIMITIVE(); int num1 = AppMain._amEffectSetDrawMode(runtime, setParam, node.blend); AppMain.NNS_VECTOR4D amDrawLineOffset = AppMain._amDrawLine_offset; AppMain.NNS_VECTOR4D amDrawLineEye = AppMain._amDrawLine_eye; float zBias = node.z_bias; AppMain.amVectorSet(amDrawLineOffset, zBias * AppMain._am_ef_worldViewMtx.M20, zBias * AppMain._am_ef_worldViewMtx.M21, zBias * AppMain._am_ef_worldViewMtx.M22); AppMain.amVectorSet(amDrawLineEye, AppMain._am_ef_worldViewMtx.M20, AppMain._am_ef_worldViewMtx.M21, AppMain._am_ef_worldViewMtx.M22); AppMain.NNS_VECTOR4D amDrawLinePos0 = AppMain._amDrawLine_pos0; AppMain.NNS_VECTOR4D amDrawLinePos1 = AppMain._amDrawLine_pos1; AppMain.NNS_VECTOR amDrawLineVel = (AppMain.NNS_VECTOR)AppMain._amDrawLine_vel; AppMain.NNS_VECTOR amDrawLineCross = (AppMain.NNS_VECTOR)AppMain._amDrawLine_cross; if (((int)node.flag & 4096) != 0) { AppMain.NNS_PRIM3D_PCT_ARRAY nnsPriM3DPctArray = AppMain.amDrawAlloc_NNS_PRIM3D_PCT(6 * (int)runtime.active_num); AppMain.NNS_PRIM3D_PCT[] buffer = nnsPriM3DPctArray.buffer; int offset = nnsPriM3DPctArray.offset; float num2 = 0.0f; for (; next != activeTail; next = next.next) { AppMain.AMS_AME_RUNTIME_WORK_LINE ameRuntimeWorkLine = (AppMain.AMS_AME_RUNTIME_WORK_LINE)(AppMain.AMS_AME_RUNTIME_WORK) next; double num3 = (double)AppMain.amVectorUnit(amDrawLineVel, ameRuntimeWorkLine.velocity); AppMain.nnScaleVector((AppMain.NNS_VECTOR)amDrawLinePos0, amDrawLineVel, ameRuntimeWorkLine.length); AppMain.amVectorAdd(amDrawLinePos1, ameRuntimeWorkLine.position, amDrawLineOffset); AppMain.nnAddVector((AppMain.NNS_VECTOR)amDrawLinePos0, (AppMain.NNS_VECTOR)amDrawLinePos0, (AppMain.NNS_VECTOR)amDrawLinePos1); num2 = AppMain.nnDistanceVector((AppMain.NNS_VECTOR)amDrawLinePos0, AppMain._am_ef_camPos); AppMain.nnCrossProductVector(amDrawLineCross, amDrawLineVel, (AppMain.NNS_VECTOR)amDrawLineEye); AppMain.nnNormalizeVector(amDrawLineCross, amDrawLineCross); AppMain.nnScaleVector(amDrawLineVel, amDrawLineCross, ameRuntimeWorkLine.outside_width); AppMain.nnSubtractVector(ref buffer[offset].Pos, (AppMain.NNS_VECTOR)amDrawLinePos0, amDrawLineVel); AppMain.nnAddVector(ref buffer[offset + 1].Pos, (AppMain.NNS_VECTOR)amDrawLinePos0, amDrawLineVel); AppMain.nnScaleVector(amDrawLineVel, amDrawLineCross, ameRuntimeWorkLine.inside_width); AppMain.nnSubtractVector(ref buffer[offset + 2].Pos, (AppMain.NNS_VECTOR)amDrawLinePos1, amDrawLineVel); AppMain.nnAddVector(ref buffer[offset + 5].Pos, (AppMain.NNS_VECTOR)amDrawLinePos1, amDrawLineVel); buffer[offset + 1].Col = AppMain.AMD_RGBA8888(ameRuntimeWorkLine.outside_color.r, ameRuntimeWorkLine.outside_color.g, ameRuntimeWorkLine.outside_color.b, ameRuntimeWorkLine.outside_color.a); buffer[offset].Col = buffer[offset + 1].Col; buffer[offset + 5].Col = AppMain.AMD_RGBA8888(ameRuntimeWorkLine.inside_color.r, ameRuntimeWorkLine.inside_color.g, ameRuntimeWorkLine.inside_color.b, ameRuntimeWorkLine.inside_color.a); buffer[offset + 2].Col = buffer[offset + 5].Col; AppMain.Vector4D_Quat st = ameRuntimeWorkLine.st; buffer[offset].Tex.u = st.x; buffer[offset].Tex.v = st.y; buffer[offset + 1].Tex.u = st.z; buffer[offset + 1].Tex.v = st.y; buffer[offset + 2].Tex.u = st.x; buffer[offset + 2].Tex.v = st.w; buffer[offset + 5].Tex.u = st.z; buffer[offset + 5].Tex.v = st.w; buffer[offset + 3] = buffer[offset + 1]; buffer[offset + 4] = buffer[offset + 2]; offset += 6; } setParam.format3D = 4; setParam.type = 0; setParam.vtxPCT3D = nnsPriM3DPctArray; setParam.texlist = runtime.texlist; setParam.texId = (int)node.texture_id; setParam.count = 6 * (int)runtime.active_num; setParam.ablend = num1; setParam.sortZ = num2; AppMain.amDrawPrimitive3D(runtime.ecb.drawState, setParam); } else { AppMain.NNS_PRIM3D_PC[] nnsPriM3DPcArray1 = new AppMain.NNS_PRIM3D_PC[6 * (int)runtime.active_num]; int index = 0; AppMain.NNS_PRIM3D_PC[] nnsPriM3DPcArray2 = nnsPriM3DPcArray1; float num2 = 0.0f; for (; next != activeTail; next = next.next) { AppMain.AMS_AME_RUNTIME_WORK_LINE ameRuntimeWorkLine = (AppMain.AMS_AME_RUNTIME_WORK_LINE)(AppMain.AMS_AME_RUNTIME_WORK) next; double num3 = (double)AppMain.amVectorUnit(amDrawLineVel, ameRuntimeWorkLine.velocity); AppMain.nnScaleVector((AppMain.NNS_VECTOR)amDrawLinePos0, amDrawLineVel, ameRuntimeWorkLine.length); AppMain.amVectorAdd(amDrawLinePos1, ameRuntimeWorkLine.position, amDrawLineOffset); AppMain.nnAddVector((AppMain.NNS_VECTOR)amDrawLinePos0, (AppMain.NNS_VECTOR)amDrawLinePos0, (AppMain.NNS_VECTOR)amDrawLinePos1); num2 = AppMain.nnDistanceVector((AppMain.NNS_VECTOR)amDrawLinePos0, AppMain._am_ef_camPos); AppMain.nnCrossProductVector(amDrawLineCross, amDrawLineVel, (AppMain.NNS_VECTOR)amDrawLineEye); AppMain.nnNormalizeVector(amDrawLineCross, amDrawLineCross); AppMain.nnScaleVector(amDrawLineVel, amDrawLineCross, ameRuntimeWorkLine.outside_width); AppMain.nnSubtractVector(ref nnsPriM3DPcArray1[index].Pos, (AppMain.NNS_VECTOR)amDrawLinePos0, amDrawLineVel); AppMain.nnAddVector(ref nnsPriM3DPcArray1[index + 1].Pos, (AppMain.NNS_VECTOR)amDrawLinePos0, amDrawLineVel); AppMain.nnScaleVector(amDrawLineVel, amDrawLineCross, ameRuntimeWorkLine.inside_width); AppMain.nnSubtractVector(ref nnsPriM3DPcArray1[index + 2].Pos, (AppMain.NNS_VECTOR)amDrawLinePos1, amDrawLineVel); AppMain.nnAddVector(ref nnsPriM3DPcArray1[index + 5].Pos, (AppMain.NNS_VECTOR)amDrawLinePos1, amDrawLineVel); nnsPriM3DPcArray1[index + 1].Col = AppMain.AMD_RGBA8888(ameRuntimeWorkLine.outside_color.r, ameRuntimeWorkLine.outside_color.g, ameRuntimeWorkLine.outside_color.b, ameRuntimeWorkLine.outside_color.a); nnsPriM3DPcArray1[index].Col = nnsPriM3DPcArray1[index + 1].Col; nnsPriM3DPcArray1[index + 5].Col = AppMain.AMD_RGBA8888(ameRuntimeWorkLine.inside_color.r, ameRuntimeWorkLine.inside_color.g, ameRuntimeWorkLine.inside_color.b, ameRuntimeWorkLine.inside_color.a); nnsPriM3DPcArray1[index + 2].Col = nnsPriM3DPcArray1[index + 5].Col; nnsPriM3DPcArray1[index + 3] = nnsPriM3DPcArray1[index + 1]; nnsPriM3DPcArray1[index + 4] = nnsPriM3DPcArray1[index + 2]; index += 6; } setParam.format3D = 2; setParam.type = 0; setParam.vtxPC3D = nnsPriM3DPcArray2; setParam.texlist = runtime.texlist; setParam.texId = -1; setParam.count = 6 * (int)runtime.active_num; setParam.ablend = num1; setParam.sortZ = num2; AppMain.amDrawPrimitive3D(runtime.ecb.drawState, setParam); } return(0); }