Skip to content

Commit

Permalink
Merge branch 'Albeoris:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
SamsamTS authored Sep 6, 2023
2 parents 850de43 + 068c85b commit 92d0a4c
Show file tree
Hide file tree
Showing 17 changed files with 135 additions and 106 deletions.
16 changes: 5 additions & 11 deletions Assembly-CSharp/Global/Dialog/DialogManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -441,16 +441,9 @@ private void ActivateDialogScene()
ff9.s_moveCHRStatus s_moveCHRStatus = ff9.w_moveCHRStatus[ff9.w_moveActorPtr.originalActor.index];
if (ff9.m_GetIDEvent(s_moveCHRStatus.id) != 0 && UIManager.World.CurrentState != WorldHUD.State.FullMap && !this.HasChocoboMenu && !ff9.w_isMogActive)
{
Boolean hasUIDialog = false;
foreach (Dialog dialog in this.activeDialogList)
{
if (dialog.Id == DialogManager.UIDialogId)
{
hasUIDialog = true;
break;
}
}
shouldActivate = hasUIDialog;
Boolean closableDialogIsShown = this.activeDialogList.Any(dial => dial.TextId == 87); // "Watched the waves around the world and relaxed!"
Boolean hasUIDialog = this.activeDialogList.Any(dial => dial.Id == DialogManager.UIDialogId);
shouldActivate = hasUIDialog || closableDialogIsShown;
}
}
if (shouldActivate)
Expand All @@ -465,8 +458,9 @@ private void DeactivateDialogScene()
Boolean shouldDeactivate = this.activeDialogList.Count == 0;
if (PersistenSingleton<UIManager>.Instance.State == UIManager.UIState.WorldHUD)
{
Boolean closableDialogIsShown = this.activeDialogList.Any(dial => dial.TextId == 87); // "Watched the waves around the world and relaxed!"
ff9.s_moveCHRStatus s_moveCHRStatus = ff9.w_moveCHRStatus[ff9.w_moveActorPtr.originalActor.index];
if (ff9.m_GetIDEvent(s_moveCHRStatus.id) != 0 && UIManager.World.CurrentState != WorldHUD.State.FullMap && !this.HasChocoboMenu && !ff9.w_isMogActive)
if (!closableDialogIsShown && ff9.m_GetIDEvent(s_moveCHRStatus.id) != 0 && UIManager.World.CurrentState != WorldHUD.State.FullMap && !this.HasChocoboMenu && !ff9.w_isMogActive)
shouldDeactivate = true;
}
if (shouldDeactivate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2265,7 +2265,7 @@ public Int32 DoEventCode()
SFieldCalculator.FieldRemoveStatus(FF9StateSystem.Common.FF9.GetPlayer(charId + 3), statusList);
if (charId == CharacterId.Beatrix)
foreach (PLAYER play in FF9StateSystem.Common.FF9.PlayerList)
if (play.Index > CharacterId.Beatrix)
if (play.Index > CharacterId.Amarant && play.Index != CharacterId.Beatrix)
SFieldCalculator.FieldRemoveStatus(play, statusList);
return 0;
}
Expand Down Expand Up @@ -2472,7 +2472,7 @@ public Int32 DoEventCode()
}
if (charId == CharacterId.Beatrix && hpHealProp >= 0f)
foreach (PLAYER play in FF9StateSystem.Common.FF9.PlayerList)
if (play.Index > CharacterId.Beatrix)
if (play.Index > CharacterId.Amarant && play.Index != CharacterId.Beatrix)
play.cur.hp = (UInt32)Math.Min(play.max.hp, play.cur.hp + hpHealProp * play.max.hp);
}
return 0;
Expand All @@ -2499,7 +2499,7 @@ public Int32 DoEventCode()
}
if (charId == CharacterId.Beatrix && mpHealProp >= 0f)
foreach (PLAYER play in FF9StateSystem.Common.FF9.PlayerList)
if (play.Index > CharacterId.Beatrix)
if (play.Index > CharacterId.Amarant && play.Index != CharacterId.Beatrix)
play.cur.mp = (UInt32)Math.Min(play.max.mp, play.cur.mp + mpHealProp * play.max.mp);
}
return 0;
Expand Down
2 changes: 1 addition & 1 deletion Assembly-CSharp/Global/Event/EventInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static void ChangeInputLayout(String language)
else
EventInput.SetOtherLangLayout();
EventInput.ConfirmMask = EventInput.Lcircle | EventInput.Pcircle;
CancelMask = EventInput.Lx | EventInput.Px;
EventInput.CancelMask = EventInput.Lx | EventInput.Px;
}

private static void SetJapaneseLayput()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -754,21 +754,20 @@ private void MovePC()
if (movingUp || movingDown || movingLeft || movingRight || this.hasTarget && actualMoveVec != Vector3.zero)
{
Single moveAngle = Mathf.Atan2(-this.moveVec.x, -this.moveVec.z) * 57.29578f;
Single actorRot = Mathf.Lerp(this.actor.actor.rotAngle[1], moveAngle, 0.4f);
if (Mathf.Abs(moveAngle - this.actor.actor.rotAngle[1]) > 180f)
{
if (moveAngle > this.actor.actor.rotAngle[1])
actorRot += 180f;
moveAngle -= 360f;
else
actorRot -= 180f;
moveAngle += 360f;
}
if (actorRot > 180f)
Single actorRot = Mathf.Lerp(this.actor.actor.rotAngle[1], moveAngle, 0.4f);
while (actorRot > 180f)
actorRot -= 360f;
else if (actorRot < -180f)
while (actorRot < -180f)
actorRot += 360f;
this.actor.actor.rotAngle[1] = actorRot;
Single collDist;
PosObj posObj = this.walkMesh.Collision(this, 0, out collDist);
PosObj posObj = this.walkMesh.Collision(this, 0, out Single collDist);
if (posObj != null)
{
instance.sLockFree = (Int64)(((posObj.flags & 16) != 0) ? 0L : 1L);
Expand Down
1 change: 1 addition & 0 deletions Assembly-CSharp/Global/TitleUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1729,6 +1729,7 @@ private void Awake()
UICamera.onNavigate = (UICamera.KeyCodeDelegate)Delegate.Combine(UICamera.onNavigate, new UICamera.KeyCodeDelegate(this.OnKeyNavigate));

DataPatchers.Initialize();
QualitySettings.antiAliasing = Configuration.Graphics.AntiAliasing;
}

private class SlideShow
Expand Down
2 changes: 1 addition & 1 deletion Assembly-CSharp/Global/btl_para.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static UInt32 GetLogicalHP(BTL_DATA btl, Boolean max)

public static void SetLogicalHP(BTL_DATA btl, UInt32 newHP, Boolean max)
{
if (Configuration.Battle.CustomBattleFlagsMeaning == 1 && btl.bi.player == 0 && (btl_util.getEnemyPtr(btl).info.flags & 0x4) != 0)
if (Configuration.Battle.CustomBattleFlagsMeaning != 0 && btl.bi.player == 0 && (btl_util.getEnemyPtr(btl).info.flags & 0x4) != 0)
{
if (newHP == 0)
newHP = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public static class GameState
public static Int16 Frogs => FF9StateSystem.Common.FF9.Frogs.Number;
public static Int16[] CategoryKillCount => FF9StateSystem.Common.FF9.categoryKillCount;
public static Int16 ModelKillCount(Int16 modelId) => FF9StateSystem.Common.FF9.modelKillCount[modelId];
public static Int32 TotalKillCount => FF9StateSystem.Common.FF9.modelKillCount.Values.Sum(count => count);
public static Byte Tonberies => battle.TONBERI_COUNT;
public static UInt16 EscapeCount => FF9StateSystem.Common.FF9.party.escape_no;
public static Int32 BattleCount => FF9StateSystem.Common.FF9.party.battle_no;
Expand All @@ -43,7 +44,9 @@ public static class GameState
public static Int32 TetraMasterPlayerPoints => QuadMistDatabase.MiniGame_GetPlayerPoints();
public static Int32 GameTime => Convert.ToInt32(FF9StateSystem.Settings.time);
public static Int32 AbilityUsage(BattleAbilityId index) => FF9StateSystem.EventState.GetAAUsageCounter(index);
public static Int32 ItemCount(Int32 id) => ff9item.FF9Item_GetCount_Generic(id);
public static Int32 ItemCount(RegularItem id) => ff9item.FF9Item_GetCount(id);
public static Boolean HasKeyItem(Int32 id) => ff9item.FF9Item_IsExistImportant(id);
public static Int32 GetCardCountOfType(TetraMasterCardId id) => QuadMistDatabase.MiniGame_GetCardCount(id);
public static Int32 PartyLevel(Int32 index) => index < 0 || index >= 4 ? 0 : FF9StateSystem.Common.FF9.party.member[index]?.level ?? 0;
public static Single PartyAverageLevel => (Single)(FF9StateSystem.Common.FF9.party.member.Average(p => p?.level) ?? 0);
public static CharacterId PartyCharacterId(Int32 index) => index < 0 || index >= 4 ? CharacterId.NONE : FF9StateSystem.Common.FF9.party.GetCharacterId(index);
Expand Down
1 change: 1 addition & 0 deletions Assembly-CSharp/Memoria/Configuration/Access/Graphics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public static class Graphics
public static Int32 SkipIntros = Instance._graphics.SkipIntros;
public static Int32 GarnetHair => Instance._graphics.GarnetHair;
public static Int32 TileSize => Instance._graphics.TileSize;
public static Int32 AntiAliasing => Instance._graphics.AntiAliasing;

private static volatile Boolean _widescreenSupport = InitializeWidescreenSupport();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ private sealed class GraphicsSection : IniSection
public readonly IniValue<Int32> BattleSwirlFrames;
public readonly IniValue<Boolean> WidescreenSupport;
public readonly IniValue<Int32> TileSize;
public readonly IniValue<Int32> AntiAliasing;
public readonly IniValue<Int32> SkipIntros;
public readonly IniValue<Int32> GarnetHair;

Expand All @@ -34,6 +35,7 @@ public GraphicsSection() : base(nameof(GraphicsSection), false)
BattleSwirlFrames = BindInt32(nameof(BattleSwirlFrames), 115);
WidescreenSupport = BindBoolean(nameof(WidescreenSupport), true);
TileSize = BindInt32(nameof(TileSize), 32);
AntiAliasing = BindInt32(nameof(AntiAliasing), 0);
SkipIntros = BindInt32(nameof(SkipIntros), 0);
GarnetHair = BindInt32(nameof(GarnetHair), 0);
}
Expand Down
4 changes: 3 additions & 1 deletion Assembly-CSharp/Memoria/Data/Battle/TargetType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public enum TargetType : byte
RandomAlly = 10,
RandomEnemy = 11,
Everyone = 12,
Self = 13
Self = 13,
Automatic = 14,
Special = 15
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public void GetStatusInitQuietly(BattleUnit unit, out BattleStatus permanent, ou

public void TriggerOnAbility(BattleCalculator calc, String when, Boolean asTarget)
{
if (Id >= 0 && calc.Context.DisabledSA.Contains(Id))
if (!EnableAsEnemy && !EnableAsMonsterTransform && Id >= 0 && calc.Context.DisabledSA.Contains(Id))
return;
try
{
Expand Down Expand Up @@ -343,6 +343,8 @@ public void TriggerOnAbility(BattleCalculator calc, String when, Boolean asTarge
e.EvaluateParameter += NCalcUtility.commonNCalcParameters;
if (String.Compare(formula.Key, "CasterHP") == 0) caster.CurrentHp = (UInt32)NCalcUtility.ConvertNCalcResult(e.Evaluate(), caster.CurrentHp);
else if (String.Compare(formula.Key, "CasterMP") == 0) caster.CurrentMp = (UInt32)NCalcUtility.ConvertNCalcResult(e.Evaluate(), caster.CurrentMp);
else if (String.Compare(formula.Key, "CasterMaxHP") == 0) caster.MaximumHp = (UInt32)NCalcUtility.ConvertNCalcResult(e.Evaluate(), caster.MaximumHp);
else if (String.Compare(formula.Key, "CasterMaxMP") == 0) caster.MaximumMp = (UInt32)NCalcUtility.ConvertNCalcResult(e.Evaluate(), caster.MaximumMp);
else if (String.Compare(formula.Key, "CasterATB") == 0) caster.CurrentAtb = (Int16)NCalcUtility.ConvertNCalcResult(e.Evaluate(), caster.CurrentAtb);
else if (String.Compare(formula.Key, "CasterTrance") == 0) caster.Trance = (Byte)NCalcUtility.ConvertNCalcResult(e.Evaluate(), caster.Trance);
else if (String.Compare(formula.Key, "CasterCurrentStatus") == 0) cCurStat = (BattleStatus)NCalcUtility.ConvertNCalcResult(e.Evaluate(), (UInt32)cCurStat);
Expand Down Expand Up @@ -378,6 +380,8 @@ public void TriggerOnAbility(BattleCalculator calc, String when, Boolean asTarge
else if (String.Compare(formula.Key, "CasterBonusCard") == 0 && !caster.IsPlayer) caster.Enemy.Data.bonus_card = (TetraMasterCardId)NCalcUtility.ConvertNCalcResult(e.Evaluate(), (Int32)caster.Enemy.Data.bonus_card);
else if (String.Compare(formula.Key, "TargetHP") == 0) target.CurrentHp = (UInt32)NCalcUtility.ConvertNCalcResult(e.Evaluate(), target.CurrentHp);
else if (String.Compare(formula.Key, "TargetMP") == 0) target.CurrentMp = (UInt32)NCalcUtility.ConvertNCalcResult(e.Evaluate(), target.CurrentMp);
else if (String.Compare(formula.Key, "TargetMaxHP") == 0) target.MaximumHp = (UInt32)NCalcUtility.ConvertNCalcResult(e.Evaluate(), target.MaximumHp);
else if (String.Compare(formula.Key, "TargetMaxMP") == 0) target.MaximumMp = (UInt32)NCalcUtility.ConvertNCalcResult(e.Evaluate(), target.MaximumMp);
else if (String.Compare(formula.Key, "TargetATB") == 0) target.CurrentAtb = (Int16)NCalcUtility.ConvertNCalcResult(e.Evaluate(), target.CurrentAtb);
else if (String.Compare(formula.Key, "TargetTrance") == 0) target.Trance = (Byte)NCalcUtility.ConvertNCalcResult(e.Evaluate(), target.Trance);
else if (String.Compare(formula.Key, "TargetCurrentStatus") == 0) tCurStat = (BattleStatus)NCalcUtility.ConvertNCalcResult(e.Evaluate(), (UInt32)tCurStat);
Expand Down Expand Up @@ -565,6 +569,8 @@ public void TriggerOnCommand(BattleUnit abilityUser, BattleCommand command, ref
else if (String.Compare(formula.Key, "CommandTargetId") == 0) command.Data.tar_id = (UInt16)NCalcUtility.ConvertNCalcResult(e.Evaluate(), command.Data.tar_id);
else if (String.Compare(formula.Key, "HP") == 0) abilityUser.CurrentHp = (UInt32)NCalcUtility.ConvertNCalcResult(e.Evaluate(), abilityUser.CurrentHp);
else if (String.Compare(formula.Key, "MP") == 0) abilityUser.CurrentMp = (UInt32)NCalcUtility.ConvertNCalcResult(e.Evaluate(), abilityUser.CurrentMp);
else if (String.Compare(formula.Key, "MaxHP") == 0) abilityUser.MaximumHp = (UInt32)NCalcUtility.ConvertNCalcResult(e.Evaluate(), abilityUser.MaximumHp);
else if (String.Compare(formula.Key, "MaxMP") == 0) abilityUser.MaximumMp = (UInt32)NCalcUtility.ConvertNCalcResult(e.Evaluate(), abilityUser.MaximumMp);
else if (String.Compare(formula.Key, "ATB") == 0) abilityUser.CurrentAtb = (Int16)NCalcUtility.ConvertNCalcResult(e.Evaluate(), abilityUser.CurrentAtb);
else if (String.Compare(formula.Key, "Trance") == 0) abilityUser.Trance = (Byte)NCalcUtility.ConvertNCalcResult(e.Evaluate(), abilityUser.Trance);
else if (String.Compare(formula.Key, "CurrentStatus") == 0) uCurStat = (BattleStatus)NCalcUtility.ConvertNCalcResult(e.Evaluate(), (UInt32)uCurStat);
Expand Down
2 changes: 1 addition & 1 deletion Assembly-CSharp/Memoria/Data/ff9item.2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ private static void FF9Item_Achievement(RegularItem id, Int32 count)
case RegularItem.RuneClaws:
AchievementManager.ReportAchievement(AcheivementKey.RuneClaws, count);
break;
case RegularItem.TigerFangs:
case RegularItem.TigerRacket:
AchievementManager.ReportAchievement(AcheivementKey.TigerHands, count);
break;
case RegularItem.WhaleWhisker:
Expand Down
9 changes: 5 additions & 4 deletions Assembly-CSharp/NCalc/NCalcUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static String EvaluateNCalcString(Object obj, String defaultResult = "")
else if (name == "GetAbilityUsageCount" && args.Parameters.Length == 1)
args.Result = GameState.AbilityUsage((BattleAbilityId)NCalcUtility.ConvertNCalcResult(args.Parameters[0].Evaluate(), 0));
else if (name == "GetItemCount" && args.Parameters.Length == 1)
args.Result = GameState.ItemCount((Int32)NCalcUtility.ConvertNCalcResult(args.Parameters[0].Evaluate(), Byte.MaxValue));
args.Result = GameState.ItemCount((RegularItem)NCalcUtility.ConvertNCalcResult(args.Parameters[0].Evaluate(), (Int32)RegularItem.NoItem));
else if (name == "GetPartyMemberLevel" && args.Parameters.Length == 1)
args.Result = GameState.PartyLevel((Int32)NCalcUtility.ConvertNCalcResult(args.Parameters[0].Evaluate(), -1));
else if (name == "GetPartyMemberIndex" && args.Parameters.Length == 1)
Expand Down Expand Up @@ -198,6 +198,7 @@ public static String EvaluateNCalcString(Object obj, String defaultResult = "")
else if (name == "StealCount") args.Result = (Int32)GameState.Thefts;
else if (name == "EscapeCount") args.Result = (Int32)GameState.EscapeCount;
else if (name == "BattleCount") args.Result = (Int32)GameState.BattleCount;
else if (name == "TotalKillCount") args.Result = (Int32)GameState.TotalKillCount;
else if (name == "StepCount") args.Result = (Int32)GameState.StepCount; // TODO: not currently tracked
else if (name == "TonberryCount") args.Result = (Int32)GameState.Tonberies;
else if (name == "TetraMasterWinCount") args.Result = (Int32)GameState.TetraMasterWin;
Expand All @@ -223,11 +224,11 @@ public static String EvaluateNCalcString(Object obj, String defaultResult = "")
else if (name == "BattleBonusAP") args.Result = battle.btl_bonus.ap;
else if (name == "UseSFXRework") args.Result = Configuration.Battle.SFXRework;
else
{
{
foreach (Type t in UsableEnumTypes)
{
if (name.StartsWith(t.Name + "_"))
{
{
String enumValueStr = name.Substring(t.Name.Length + 1);
if (t == typeof(BattleStatus) && enumValueStr.TryStaticFieldParse(typeof(BattleStatusConst), out FieldInfo field))
{
Expand All @@ -237,7 +238,7 @@ public static String EvaluateNCalcString(Object obj, String defaultResult = "")
args.Result = Convert.ToInt32(Enum.Parse(t, enumValueStr));
return;
}
}
}
}
};

Expand Down
Loading

0 comments on commit 92d0a4c

Please sign in to comment.