private void geoLookSet(PosObj po, float posx, float posy, float posz) { po.geo_struct_flags |= geo.GEO_FLAGS_LOOK; po.geo_struct_lookat.x = posx; po.geo_struct_lookat.y = posy; po.geo_struct_lookat.z = posz; }
public static void GetMesPos(PosObj po, out Single x, out Single y) { x = 0f; y = 0f; if (po.go == (UnityEngine.Object)null) { return; } Vector3 vector = new Vector3(po.pos[0], po.pos[1], po.pos[2]); Vector3 zero = Vector3.zero; zero.x = vector.x; Byte scaley = po.scaley; Single num = (Single)(-po.eye * (Int16)scaley >> 6); zero.y = vector.y + num + 50f; zero.z = vector.z; if (po.cid == 4) { Actor actor = (Actor)po; zero.x += (Single)actor.mesofsX; zero.y -= (Single)actor.mesofsY; zero.z += (Single)actor.mesofsZ; } ETb.World2Screen(zero, out x, out y); y = UIManager.UIContentSize.y - y; }
public static void GetActorInfo(PosObj po, out Transform bone, out Vector3 offset) { bone = (Transform)null; offset = Vector3.zero; bone = po.go.transform; offset = new Vector3(0f, (Single)((-po.eye * (Int16)po.scaley >> 6) + 50), 0f); }
private static void ClearPathFinding(PosObj po) { if (PersistenSingleton <EventEngine> .Instance.gMode == 1) { po.go.GetComponent <FieldMapActorController>().ClearMoveTargetAndPath(); } }
public static void ProcessHereIcon(PosObj po) { EventEngine instance = PersistenSingleton <EventEngine> .Instance; if (instance.GetUserControl() && (ETb.KeyOn() & 1U) > 0U) { sHereIconTimer = 60; sHereIconForce = true; hereIconShow = false; } if (sHereIconTimer > 0) { --sHereIconTimer; if (sHereIconTimer <= 0) { sHereIconForce = false; } if (instance.gMode != 1 || hereIconShow || (lastPollType != PollType.NONE || sHereIconTimer <= 0) || sHereIconTimer >= 58) { return; } ShowHereIcon(po); } else { CloseHereIcon(); } }
private static Boolean CheckQuadPush(PosObj ctrl, Obj quad) { Boolean result = true; if (PersistenSingleton <EventEngine> .Instance.gMode == 1) { Int16 fldMapNo = FF9StateSystem.Common.FF9.fldMapNo; if (fldMapNo != 2108) { if (fldMapNo != 2802) { if (fldMapNo == 2914) { Byte sid = quad.sid; if (sid == 13) { result = false; } } } else if (quad.sid == 24) { result = false; } } else if (quad.sid == 6) { result = EventCollision.IsQuadTalkable(ctrl, quad); } } return(result); }
private static Boolean CheckNPCPush(PosObj po) { Boolean result = true; if (PersistenSingleton <EventEngine> .Instance.gMode == 1) { Int16 fldMapNo = FF9StateSystem.Common.FF9.fldMapNo; if (fldMapNo != 103 && fldMapNo != 107) { if (fldMapNo == 1856) { Byte sid = po.sid; if (sid == 5 || sid == 6) { result = false; } } } else { Byte sid = po.sid; if (sid == 3 || sid == 4) { result = false; } } } return(result); }
private static Boolean CheckQuadTalk(PosObj ctrl, Obj quad) { Boolean result = true; if (PersistenSingleton <EventEngine> .Instance.gMode == 1) { Int16 fldMapNo = FF9StateSystem.Common.FF9.fldMapNo; if (fldMapNo != 2108) { if (fldMapNo == 2504) { Byte sid = quad.sid; if (sid == 9) { result = false; } } } else { Byte sid = quad.sid; if (sid == 7) { result = false; } } } return(result); }
public static void geoAttach(GameObject sourceObject, GameObject targetObject, Int32 bone_index) { Transform childByName = targetObject.transform.GetChildByName("bone" + bone_index.ToString("D3")); if (PersistenSingleton <EventEngine> .Instance.gMode == 2 || FF9StateSystem.Battle.isDebug) { sourceObject.transform.parent = childByName; sourceObject.transform.localPosition = Vector3.zero; sourceObject.transform.localRotation = Quaternion.identity; sourceObject.transform.localScale = Vector3.one; } else if (PersistenSingleton <EventEngine> .Instance.gMode == 1) { FieldMapActor component = sourceObject.GetComponent <FieldMapActor>(); FieldMapActor component2 = targetObject.GetComponent <FieldMapActor>(); if (component != (UnityEngine.Object)null && component2 != (UnityEngine.Object)null && childByName != (UnityEngine.Object)null) { component.GeoAttach(component2, childByName); PosObj actor = component.actor; actor.attatchTargetUid = (int)component2.actor.uid; actor.attachTargetBoneIndex = bone_index; } } else if (PersistenSingleton <EventEngine> .Instance.gMode == 3) { } }
public static Int32 CollisionAngle(PosObj po, Obj coll) { PosObj posObj = (PosObj)coll; Vector3 b = new Vector3(po.pos[0], po.pos[1], po.pos[2]); Vector3 a = new Vector3(posObj.pos[0], posObj.pos[1], posObj.pos[2]); Vector3 posObjRot = EventCollision.GetPosObjRot(po); Vector3 posObjRot2 = EventCollision.GetPosObjRot(posObj); Vector3 normalized = (a - b).normalized; if (normalized == Vector3.zero) { return(0); } Vector3 eulerAngles = Quaternion.LookRotation(normalized).eulerAngles; Vector3 vector = eulerAngles - posObjRot; vector.x = ((vector.x <= 180f) ? vector.x : (vector.x - 360f)); vector.x = ((vector.x >= -180f) ? vector.x : (vector.x + 360f)); vector.y = ((vector.y <= 180f) ? vector.y : (vector.y - 360f)); vector.y = ((vector.y >= -180f) ? vector.y : (vector.y + 360f)); vector.z = ((vector.z <= 180f) ? vector.z : (vector.z - 360f)); vector.z = ((vector.z >= -180f) ? vector.z : (vector.z + 360f)); Single floatAngle = vector.magnitude - 180f; return(EventEngineUtils.ConvertFloatAngleToFixedPoint(floatAngle)); }
public static Boolean CheckQuadInput(PosObj po) { EventEngine instance = PersistenSingleton <EventEngine> .Instance; UInt32 num = ETb.KeyOn() & (UInt32)((instance.gMode != 1) ? EventInput.Lcircle : (EventInput.Lcircle | 524288u)); if (num > 0u) { Obj obj = instance.TreadQuad(po, 4); if (obj != null && EventCollision.IsQuadTalkable(po, obj)) { if (num == 524288u && instance.Request(obj, 1, 8, false)) { EventCollision.ClearPathFinding(po); EMinigame.SetQuadmistOpponentId(obj); return(true); } if (instance.Request(obj, 1, 3, false)) { EventCollision.ClearPathFinding(po); return(true); } } } return(false); }
public static void ProcessHereIcon(PosObj po) { EventEngine instance = PersistenSingleton <EventEngine> .Instance; if (instance.GetUserControl() && (ETb.KeyOn() & 1u) > 0u) { EIcon.sHereIconTimer = 60; EIcon.sHereIconForce = true; EIcon.hereIconShow = false; } if (EIcon.sHereIconTimer > 0) { EIcon.sHereIconTimer--; if (EIcon.sHereIconTimer <= 0) { EIcon.sHereIconForce = false; } if (instance.gMode == 1 && !EIcon.hereIconShow && EIcon.lastPollType == EIcon.PollType.NONE && EIcon.sHereIconTimer > 0 && EIcon.sHereIconTimer < 58) { EIcon.ShowHereIcon(po); } } else { EIcon.CloseHereIcon(); } }
public static void ShowWorldBubble() { EventEngine instance = PersistenSingleton <EventEngine> .Instance; BubbleUI.Flag[] bubbleFlagData = EIcon.GetBubbleFlagData(EIcon.sFIconType); Action <PosObj, Obj, UInt32>[] listener = new Action <PosObj, Obj, UInt32>[] { new Action <PosObj, Obj, UInt32>(EventCollision.BubbleUIListener) }; PosObj controlChar = instance.GetControlChar(); Vector3 uidefaultOffset = BubbleUI.UIDefaultOffset; if (controlChar.go == (UnityEngine.Object)null) { return; } if (EventCollision.IsChocoboFlyingOverForest() || (EIcon.dialogBubble && EIcon.dialogAlternativeKey)) { Singleton <BubbleUI> .Instance.ChangePrimaryKey(Control.Cancel); EIcon.dialogAlternativeKey = false; } else { Singleton <BubbleUI> .Instance.ChangePrimaryKey(Control.Confirm); } EIcon.ShowDelay = Singleton <BubbleUI> .Instance.AnimationDuration; Vector3 transformOffset; EIcon.GetWorldActorOffset(out transformOffset, ref uidefaultOffset); Singleton <BubbleUI> .Instance.Show(controlChar.go.transform, controlChar, (Obj)null, EIcon.WorldCamera, transformOffset, uidefaultOffset, bubbleFlagData, listener); }
public static void ShowWorldBubble() { EventEngine instance = PersistenSingleton <EventEngine> .Instance; BubbleUI.Flag[] bubbleFlagData = GetBubbleFlagData(s_FIconType); Action <PosObj, Obj, uint>[] listener = new Action <PosObj, Obj, uint>[1] { EventCollision.BubbleUIListener }; PosObj controlChar = instance.GetControlChar(); Vector3 uiOffset = BubbleUI.UIDefaultOffset; if (controlChar.go == null) { return; } if (EventCollision.IsChocoboFlyingOverForest() || IsDialogBubble && s_dialogAlternativeKey) { Singleton <BubbleUI> .Instance.ChangePrimaryKey(Control.Cancel); s_dialogAlternativeKey = false; } else { Singleton <BubbleUI> .Instance.ChangePrimaryKey(Control.Confirm); } ShowDelay = Singleton <BubbleUI> .Instance.AnimationDuration; Vector3 actorOffset; GetWorldActorOffset(out actorOffset, ref uiOffset); Singleton <BubbleUI> .Instance.Show(controlChar.go.transform, controlChar, null, WorldCamera, actorOffset, uiOffset, bubbleFlagData, listener); }
public void copy(PosObj po) { for (Int32 i = 0; i < 3; i++) { this.pos[i] = po.pos[i]; } for (Int32 j = 0; j < 3; j++) { this.rot[j] = po.rot[j]; this.rotAngle[j] = po.rotAngle[j]; } this.bgiRad = po.bgiRad; this.pad0 = po.pad0; this.lastTri = po.lastTri; this.pflags = po.pflags; this.ovalRatio = po.ovalRatio; this.lastFloor = po.lastFloor; this.rot0 = po.rot0; this.eye = po.eye; this.model = po.model; this.anim = po.anim; this.frameN = po.frameN; this.lastAnimFrame = po.lastAnimFrame; this.animFrame = po.animFrame; this.modelID = po.modelID; this.collRad = po.collRad; this.talkRad = po.talkRad; this.follow = po.follow; this.scaley = po.scaley; this.lastx = po.lastx; this.lasty = po.lasty; this.lastz = po.lastz; this.posField = po.posField; this.rotField = po.rotField; this.meshflags = po.meshflags; this.garnet = po.garnet; this.shortHair = po.shortHair; this.attatchTargetUid = po.attatchTargetUid; this.attachTargetBoneIndex = po.attachTargetBoneIndex; this.isShadowOff = po.isShadowOff; Actor actor = (Actor)po; this.charFlags = actor.charFlags; this.activeTri = actor.activeTri; this.activeFloor = actor.activeFloor; if (actor.meshIsRendering != null) { this.meshIsRendering = actor.meshIsRendering; for (Int32 k = 0; k < (Int32)this.meshIsRendering.Length; k++) { this.meshIsRendering[k] = false; } } this.geo_struct_flags = actor.geo_struct_flags; this.geo_struct_lookat = actor.geo_struct_lookat; Actor actor2 = (Actor)this; actor2.copy(actor); }
private static Int32 CalculateRadiusFromOvalRatio(PosObj po, PosObj targetPosObj, Int32 radius) { Int32 fixedPointAngle = EventCollision.CollisionAngle(targetPosObj, po); Int32 num = ff9.rcos(fixedPointAngle); Int32 num2 = (num * num >> 4) * (Int32)targetPosObj.ovalRatio + 16777216; radius = Convert.ToInt32((Single)radius * ff9.SquareRoot0((Single)num2)) >> 12; return(radius); }
public void UpdateWorldActor(PosObj po) { Vector3 uidefaultOffset = BubbleUI.UIDefaultOffset; Vector3 targetTransformOffset; EIcon.GetWorldActorOffset(out targetTransformOffset, ref uidefaultOffset); this.WorldFollower.target = po.go.transform; this.WorldFollower.targetTransformOffset = targetTransformOffset; this.WorldFollower.UIOffset = uidefaultOffset; }
public void Show(Transform target, PosObj po, Obj coll, Camera worldCam, Vector3 transformOffset, Vector3 uiOffset, BubbleUI.Flag[] flags, Action <PosObj, Obj, UInt32>[] listener) { this.Follower.enabled = false; this.WorldFollower.enabled = true; this.WorldFollower.target = target; this.WorldFollower.targetTransformOffset = transformOffset; this.WorldFollower.worldCam = worldCam; this.WorldFollower.UIOffset = uiOffset; this.WorldFollower.updateEveryFrame = true; this.InitialBubble(po, coll, flags, listener); }
public void Show(Transform target, PosObj po, Obj coll, FieldMap fieldMap, Vector3 offset, BubbleUI.Flag[] flags, Action <PosObj, Obj, UInt32>[] listener) { this.WorldFollower.enabled = false; this.Follower.enabled = true; this.Follower.target = target; this.Follower.fieldMap = fieldMap; this.Follower.TransformOffset = offset; this.Follower.UIOffset = BubbleUI.UIDefaultOffset; this.Follower.updateEveryFrame = true; this.InitialBubble(po, coll, flags, listener); }
public static void StiltzkinAchievement(PosObj gCur, Int32 gilDecrease) { if (gCur.model == 212) { if (gilDecrease == 333 || gilDecrease == 444 || gilDecrease == 555 || gilDecrease == 666 || gilDecrease == 777 || gilDecrease == 888 || gilDecrease == 2222 || gilDecrease == 5555) { FF9StateSystem.Achievement.StiltzkinBuy++; } AchievementManager.ReportAchievement(AcheivementKey.AllStiltzkinItem, FF9StateSystem.Achievement.StiltzkinBuy); } }
private static void ShowHereIcon(PosObj po) { s_hereIconShow = true; ShowDelay = 0.175f; BubbleUI.Flag flag = BubbleUI.Flag.CURSOR; Transform bone; Vector3 offset; BubbleMappingInfo.GetActorInfo(po, out bone, out offset); Singleton <BubbleUI> .Instance.Show(bone, po, null, FieldMap, offset, new BubbleUI.Flag[1] { flag }, null); }
private static void ShowHereIcon(PosObj po) { EIcon.hereIconShow = true; EIcon.ShowDelay = 0.175f; BubbleUI.Flag flag = BubbleUI.Flag.CURSOR; Transform target; Vector3 offset; BubbleMappingInfo.GetActorInfo(po, out target, out offset); Singleton <BubbleUI> .Instance.Show(target, po, (Obj)null, EIcon.FieldMap, offset, new BubbleUI.Flag[] { flag }, null); }
public static void BubbleUIListener(PosObj userObject, Obj collObj, UInt32 key) { if (userObject != null) { if (userObject.cid == 4) { EventCollision.CheckNPCInput(userObject); } else { EventCollision.CheckQuadInput(userObject); } } }
private static WMActor GetStartupControlledActor() { if (FF9StateSystem.World.IsBeeScene) { return(WMActor.GetControlledDebugActor(1, 0)); } PosObj controlChar = PersistenSingleton <EventEngine> .Instance.GetControlChar(); if (controlChar != null) { return(((Actor)controlChar).wmActor); } return((WMActor)null); }
public Int32 DoEventCodeField(PosObj po, Int32 code) { switch ((EBin.event_code_binary)code) { case EBin.event_code_binary.SHADOWON: ff9shadow.FF9ShadowOnField((Int32)po.uid); return(0); case EBin.event_code_binary.SHADOWOFF: ff9shadow.FF9ShadowOffField((Int32)po.uid); po.isShadowOff = true; return(0); case EBin.event_code_binary.SHADOWSCALE: Int32 xScale = this.getv1(); Int32 zScale = this.getv1(); ff9shadow.FF9ShadowSetScaleField((Int32)po.uid, xScale, zScale); return(0); case EBin.event_code_binary.SHADOWOFFSET: Int32 num1 = this.getv2(); Int32 num2 = this.getv2(); ff9shadow.FF9ShadowSetOffsetField((Int32)po.uid, (Single)num1, (Single)num2); return(0); case EBin.event_code_binary.SHADOWLOCK: Int32 num3 = this.getv1(); ff9shadow.FF9ShadowLockYRotField((Int32)po.uid, (Single)(num3 << 4)); return(0); case EBin.event_code_binary.SHADOWUNLOCK: ff9shadow.FF9ShadowUnlockYRotField((Int32)po.uid); return(0); case EBin.event_code_binary.SHADOWAMP: Int32 num4 = this.getv1(); ff9shadow.FF9ShadowSetAmpField((Int32)po.uid, (Int32)(Byte)num4); return(0); case EBin.event_code_binary.RAIN: Int32 strength = this.getv1(); Int32 speed = this.getv1(); this.fieldmap.rainRenderer.SetRainParam(strength, speed); this._ff9.btl_rain = (Byte)strength; return(0); default: return(1); } }
public static void SetCenterPosition(Int32 type) { switch (type) { case 0: Obj objUid = PersistenSingleton <EventEngine> .Instance.GetObjUID(250); if (objUid != null && objUid.cid == 4) { PosObj posObj = (PosObj)objUid; FieldMap fieldMap = PersistenSingleton <EventEngine> .Instance.fieldmap; Camera mainCamera = fieldMap.GetMainCamera(); BGCAM_DEF currentBgCamera = fieldMap.GetCurrentBgCamera(); Vector3 position = PSXCalculateGTE_RTPT(new Vector3(posObj.pos[0], posObj.pos[1], posObj.pos[2]), Matrix4x4.identity, currentBgCamera.GetMatrixRT(), currentBgCamera.GetViewDistance(), fieldMap.GetProjectionOffset()); Vector3 vector3 = mainCamera.WorldToScreenPoint(position); vector3.x /= mainCamera.pixelWidth; vector3.y /= mainCamera.pixelHeight; _px = vector3.x; _py = vector3.y; //Debug.Log(string.Concat("px : ", _px, " , py : ", _py)); break; } _px = 0.5f; _py = 0.5f; break; case 1: if (ff9.w_moveActorPtr != null) { Vector3 pos = ff9.w_moveActorPtr.pos; Camera camera = ff9.w_frameCameraPtr; Vector3 vector3 = camera.WorldToScreenPoint(pos); vector3.x /= camera.pixelWidth; vector3.y /= camera.pixelHeight; _px = vector3.x; _py = vector3.y; //Debug.Log(string.Concat("px : ", _px, " , py : ", _py)); break; } _px = 0.5f; _py = 0.5f; break; default: _px = 0.5f; _py = 0.5f; break; } }
public int DoEventCodeField(PosObj po, int code) { switch ((EBin.event_code_binary)code) { case EBin.event_code_binary.SHADOWON: ff9shadow.FF9ShadowOnField((int)po.uid); return(0); case EBin.event_code_binary.SHADOWOFF: ff9shadow.FF9ShadowOffField((int)po.uid); return(0); case EBin.event_code_binary.SHADOWSCALE: int xScale = this.getv1(); int zScale = this.getv1(); ff9shadow.FF9ShadowSetScaleField((int)po.uid, xScale, zScale); return(0); case EBin.event_code_binary.SHADOWOFFSET: int num1 = this.getv2(); int num2 = this.getv2(); ff9shadow.FF9ShadowSetOffsetField((int)po.uid, (float)num1, (float)num2); return(0); case EBin.event_code_binary.SHADOWLOCK: int num3 = this.getv1(); ff9shadow.FF9ShadowLockYRotField((int)po.uid, (float)(num3 << 4)); return(0); case EBin.event_code_binary.SHADOWUNLOCK: ff9shadow.FF9ShadowUnlockYRotField((int)po.uid); return(0); case EBin.event_code_binary.SHADOWAMP: int num4 = this.getv1(); ff9shadow.FF9ShadowSetAmpField((int)po.uid, (int)(byte)num4); return(0); case EBin.event_code_binary.RAIN: int strength = this.getv1(); int speed = this.getv1(); this.fieldmap.rainRenderer.SetRainParam(strength, speed); this._ff9.btl_rain = (byte)strength; return(0); default: return(1); } }
private static Boolean IsQuadTalkable(PosObj ctrl, Obj quad) { if (PersistenSingleton <EventEngine> .Instance.gMode == 1) { Obj obj = (Obj)null; Int32 fldMapNo = (Int32)FF9StateSystem.Common.FF9.fldMapNo; Int32 uid = (Int32)quad.uid; Int32 key = EMinigame.CreateNPCID(fldMapNo, uid); if (EventEngineUtils.QuadTalkableData.ContainsKey(key)) { obj = PersistenSingleton <EventEngine> .Instance.GetObjUID(EventEngineUtils.QuadTalkableData[key]); } if (obj != null) { Int32 num = fldMapNo; Int32 num2; if (num == 2108) { num2 = EventCollision.GetDir((Actor)ctrl); return(num2 > 90 && num2 < 160); } if (num == 2109) { num2 = EventCollision.GetDir((Actor)ctrl); return(num2 > 159 && num2 < 223); } if (num == 2103) { num2 = EventCollision.GetDir((Actor)ctrl); return(num2 > 159 && num2 < 223); } if (num != 2802) { num2 = EventCollision.CollisionAngle(ctrl, obj); return(num2 > -880 && num2 < 880); } Obj objUID = PersistenSingleton <EventEngine> .Instance.GetObjUID(18); Single num3 = 0f; if (PersistenSingleton <EventEngine> .Instance.isPosObj(objUID)) { num3 = -((PosObj)objUID).pos[1]; } num2 = EventCollision.GetDir((Actor)ctrl); return(num2 > 16 && num2 < 112 && num3 > 950f); } } return(true); }
public static Vector3 GetPosObjRot(PosObj po) { EventEngine instance = PersistenSingleton <EventEngine> .Instance; Vector3 result = Vector3.zero; if (instance.gMode == 1) { result = po.rotAngle; } else if (instance.gMode == 3) { result = ((Actor)po).wmActor.rot; } return(result); }
public static Boolean CheckLadderFlag() { Boolean result = false; PosObj controlChar = PersistenSingleton <EventEngine> .Instance.GetControlChar(); if (controlChar != null) { GameObject go = controlChar.go; if (go != (UnityEngine.Object)null) { result = (go.GetComponent <FieldMapActorController>().GetLadderFlag() != 0); } } return(result); }