Skip to content

Commit

Permalink
fix for prologue detection, added actor properties, added more condit…
Browse files Browse the repository at this point in the history
…ions for empty actor slot
  • Loading branch information
TalicZealot committed Apr 26, 2021
1 parent 28bb39a commit cdbc941
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
4 changes: 3 additions & 1 deletion SotnApi/SotnApi/ActorApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ private long FindAvailableActorSlot()
{
long hitboxWidth = memAPI.ReadByte(start + Actors.HitboxWidthOffset);
long hitboxHeight = memAPI.ReadByte(start + Actors.HitboxHeightOffset);
long hp = memAPI.ReadU16(start + Actors.HpOffset);
long damage = memAPI.ReadU16(start + Actors.DamageOffset);

if (hitboxWidth == 0 && hitboxHeight == 0)
if (hitboxWidth == 0 && hitboxHeight == 0 && hp == 0 && damage == 0)
{
return start;
}
Expand Down
1 change: 1 addition & 0 deletions SotnApi/SotnApi/Constants/Values/Game/Various.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public static class Various
public static long RowOffset = 0x800;
public static uint PrologueArea = 0x20;
public static uint PrologueZone = 0x21;
public static uint LoadingZone = 0x32;
public static uint LibraryWarped = 0x78;

public static Dictionary<uint, char> CharacterMap = new Dictionary<uint, char> {
Expand Down
7 changes: 6 additions & 1 deletion SotnApi/SotnApi/GameApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,16 @@ public bool InPrologue()
{
bool inGame = this.Status == SotnApi.Constants.Values.Game.Status.InGame;
bool isAlucard = this.CurrentCharacter == Character.Alucard;
bool notInPrologue = this.Area != Various.PrologueArea && this.Area > 0 && this.Zone != Various.PrologueZone;
bool notInPrologue = this.Area != Various.PrologueArea && this.Area > 0 && this.Zone != Various.PrologueZone && this.SecondCastle;

if (this.Area == Various.PrologueArea && this.Zone != Various.PrologueZone && this.SecondCastle)
{
notInPrologue = true;
}
if (this.Area == 0 && this.Zone == Various.LoadingZone && !this.SecondCastle)
{
notInPrologue = true;
}

return (inGame && isAlucard && !notInPrologue);
}
Expand Down
24 changes: 24 additions & 0 deletions SotnApi/SotnApi/Models/Actor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,30 @@ public uint DamageTypeB
}
}

public ushort Palette
{
get
{
return Value[Actors.PaletteOffset];
}
set
{
Value[Actors.PaletteOffset] = (byte)value;
}
}

public ushort ColorMode
{
get
{
return Value[Actors.ColorMode];
}
set
{
Value[Actors.ColorMode] = (byte)value;
}
}

public ushort HitboxWidth
{
get
Expand Down

0 comments on commit cdbc941

Please sign in to comment.