Skip to content
This repository has been archived by the owner on Jun 22, 2020. It is now read-only.

Commit

Permalink
Added Gestures and ItemInventory
Browse files Browse the repository at this point in the history
  • Loading branch information
Atvaark committed Mar 12, 2015
1 parent 0184917 commit 8b979ea
Show file tree
Hide file tree
Showing 25 changed files with 206 additions and 69 deletions.
9 changes: 9 additions & 0 deletions DarkSoulsII.DebugView.Core/DarkSoulsII.DebugView.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,19 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DarkSoulsII\Character\Gestures\ChrAsmCtrlGesture.cs" />
<Compile Include="DarkSoulsII\Character\Gestures\ChrAsmCtrlGestures.cs" />
<Compile Include="DarkSoulsII\Character\Gestures\GestureType.cs" />
<Compile Include="DarkSoulsII\Controllers\MapTextureResolutionCtrl.cs" />
<Compile Include="DarkSoulsII\Controllers\SignKeyGuideCtrl.cs" />
<Compile Include="DarkSoulsII\Controllers\SignPreviewCtrl.cs" />
<Compile Include="DarkSoulsII\Drawing\MdlTexture.cs" />
<Compile Include="DarkSoulsII\Events\MapObjectBonfire.cs" />
<Compile Include="DarkSoulsII\GameData\Items\ItemInventory2BagList.cs" />
<Compile Include="DarkSoulsII\GameData\Items\ItemInventory2CofferList.cs" />
<Compile Include="DarkSoulsII\GameData\Items\ItemInventory2ListBase.cs" />
<Compile Include="DarkSoulsII\GameData\Items\ItemInventory2ShopList.cs" />
<Compile Include="DarkSoulsII\GameData\UserItemInventoryData.cs" />
<Compile Include="DarkSoulsII\GameObjects\GameEntities\SignKeyGuideEntity.cs" />
<Compile Include="DarkSoulsII\Managers\Ai\AiManager.cs" />
<Compile Include="DarkSoulsII\Managers\App\AppDecalManager.cs" />
Expand Down Expand Up @@ -92,6 +100,7 @@
<Compile Include="DarkSoulsII\GameData\SaveSlotData.cs" />
<Compile Include="DarkSoulsII\Controllers\ActiveSignCtrl.cs" />
<Compile Include="DarkSoulsII\Drawing\MapTexture.cs" />
<Compile Include="DarkSoulsII\GameData\ItemInventoryData.cs" />
<Compile Include="DarkSoulsII\Managers\Sign\ActiveSignManager.cs" />
<Compile Include="DarkSoulsII\Managers\Sign\SignEventAreaManager.cs" />
<Compile Include="DarkSoulsII\Managers\Sign\SignManager.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
namespace DarkSoulsII.DebugView.Core.DarkSoulsII.Character
using DarkSoulsII.DebugView.Core.DarkSoulsII.Character.Gestures;

namespace DarkSoulsII.DebugView.Core.DarkSoulsII.Character
{
public class ChrAsmCtrl : IReadable<ChrAsmCtrl>
{
public ChrAsmCtrlGestures Gestures { get; set; }
public ChrAsmCtrlEquipment Equipment { get; set; }

public ChrAsmCtrl Read(IReader reader, int address, bool relative = false)
{
Gestures = Pointer<ChrAsmCtrlGestures>.CreateAndUnbox(reader, address + 0x0010);
Equipment = Pointer<ChrAsmCtrlEquipment>.CreateAndUnbox(reader, address + 0x0014);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace DarkSoulsII.DebugView.Core.DarkSoulsII.Character.Gestures
{
public class ChrAsmCtrlGesture : IReadable<ChrAsmCtrlGesture>
{
public GestureType Gesture { get; set; }

public ChrAsmCtrlGesture Read(IReader reader, int address, bool relative = false)
{
Gesture = (GestureType) reader.ReadInt32(address + 0x0004, relative);
return this;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Collections.Generic;

namespace DarkSoulsII.DebugView.Core.DarkSoulsII.Character.Gestures
{
public class ChrAsmCtrlGestures : IReadable<ChrAsmCtrlGestures>
{
public ChrAsmCtrlGestures()
{
Gestures = new List<ChrAsmCtrlGesture>();
}

public List<ChrAsmCtrlGesture> Gestures { get; set; }

public ChrAsmCtrlGestures Read(IReader reader, int address, bool relative = false)
{
int gestureAddress = address + 0x0004;
for (int i = 0; i < 52; i++, gestureAddress += 20)
{
// TODO: Check what the values < 44 are
if (i >= 44)
Gestures.Add(Pointer<ChrAsmCtrlGesture>.Create(gestureAddress, relative).Unbox(reader));
}
return this;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace DarkSoulsII.DebugView.Core.DarkSoulsII.Character.Gestures
{
public enum GestureType
{
Point = 10,
IWontBite = 20,
Bow = 30,
Welcome = 40,
DuelBow = 50,
Wave = 60,
Joy = 70,
RightyHo = 80,
NoWay = 90,
ThisOnesMe = 100,
Hurrah = 120,
HaveMercy = 130,
Decapitate = 150,
Mock = 220,
PumpedUp = 240,
Prostration = 250,
Warmup = 270,
Warcry = 280,
Unnamed = 290,
PraiseTheSun = 300,
FistBump = 310
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public class MapObjectBonfire : IReadable<MapObjectBonfire>
public MapObjectBonfire Read(IReader reader, int address, bool relative = false)
{
Id = reader.ReadInt16(address + 0x0000, relative);

// TODO: Split in a boolean Kindled property and an AscentionLevel property
AscentionLevel = reader.ReadByte(address + 0x0002, relative);
// 0004 ParamEntry

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace DarkSoulsII.DebugView.Core.DarkSoulsII.GameData
{
public class ItemInventoryData : IReadable<ItemInventoryData>
{
public UserItemInventoryData UserData { get; set; }

public ItemInventoryData Read(IReader reader, int address, bool relative = false)
{
UserData = Pointer<UserItemInventoryData>.CreateAndUnbox(reader, address + 0x0008, relative);
return this;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace DarkSoulsII.DebugView.Core.DarkSoulsII.GameData.Items
{
public class ItemInventory2BagList : ItemInventory2ListBase, IReadable<ItemInventory2BagList>
{
public ItemInventory2BagList Read(IReader reader, int address, bool relative = false)
{
base.Read(reader, address, relative);
return this;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace DarkSoulsII.DebugView.Core.DarkSoulsII.GameData.Items
{
public class ItemInventory2CofferList : ItemInventory2ListBase, IReadable<ItemInventory2CofferList>
{
public ItemInventory2CofferList Read(IReader reader, int address, bool relative = false)
{
base.Read(reader, address, relative);
return this;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace DarkSoulsII.DebugView.Core.DarkSoulsII.GameData.Items
{
public class ItemInventory2ListBase : IReadable<ItemInventory2ListBase>
{
public ItemInventory2ListBase Read(IReader reader, int address, bool relative = false)
{
return this;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace DarkSoulsII.DebugView.Core.DarkSoulsII.GameData.Items
{
public class ItemInventory2ShopList : ItemInventory2ListBase, IReadable<ItemInventory2ShopList>
{
public ItemInventory2ShopList Read(IReader reader, int address, bool relative = false)
{
base.Read(reader, address, relative);
return this;
}
}
}
14 changes: 7 additions & 7 deletions DarkSoulsII.DebugView.Core/DarkSoulsII/GameData/PlayerClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ public enum PlayerClass : byte
{
Unknown0 = 0,
Warrior,
Unknown2,
Knight,
Unknown3,
Unknown4,
Bandit,
Unknown5,
Unknown6,
Unknown7,
Unknown8,
Unknown9,
Unknown10
Cleric,
Sourcerer,
Explorer,
Swordman,
Deprived
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using DarkSoulsII.DebugView.Core.DarkSoulsII.GameData.Items;

namespace DarkSoulsII.DebugView.Core.DarkSoulsII.GameData
{
public class UserItemInventoryData : IReadable<UserItemInventoryData>
{
public ItemInventory2BagList ItemInventory2BagList { get; set; }
public ItemInventory2CofferList ItemInventory2CofferList { get; set; }
public ItemInventory2ShopList ItemInventory2ShopList { get; set; }

public UserItemInventoryData Read(IReader reader, int address, bool relative = false)
{
ItemInventory2BagList = Pointer<ItemInventory2BagList>.CreateAndUnbox(reader, address + 0x0008, relative);
ItemInventory2CofferList = Pointer<ItemInventory2CofferList>.CreateAndUnbox(reader, address + 0x000C,
relative);
ItemInventory2ShopList = Pointer<ItemInventory2ShopList>.CreateAndUnbox(reader, address + 0x0010, relative);
// TODO: +0014->+0008->+0000 = torch time
return this;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class CharacterCtrl : CharacterCtrlBase, IReadable<CharacterCtrl>
{
public double AngleY { get; set; }
public Vector3 Position { get; set; }
public CharacterVisualState VisualState { get; set; }
public int Health { get; set; }
public int HealthMaxHuman { get; set; }
public int HealthMaxHollow { get; set; }
Expand All @@ -18,6 +19,7 @@ public class CharacterCtrl : CharacterCtrlBase, IReadable<CharacterCtrl>
public float PetrificationMax { get; set; }
public float Poison { get; set; }
public float PoisonMax { get; set; }
public float SpeedFactor { get; set; }
public ChrAsmCtrl AsmControl { get; set; }

public new CharacterCtrl Read(IReader reader, int address, bool relative = false)
Expand All @@ -32,6 +34,8 @@ public class CharacterCtrl : CharacterCtrlBase, IReadable<CharacterCtrl>

Position = Pointer<Vector3>.Create(address + 0x0070).Unbox(reader);

VisualState = Pointer<CharacterVisualState>.CreateAndUnbox(reader, address + 0x0090, relative);

Name = Pointer<StdString>.Create(address + 0x00C8).Unbox(reader).Value;

Health = reader.ReadInt32(address + 0x00FC);
Expand All @@ -44,7 +48,7 @@ public class CharacterCtrl : CharacterCtrlBase, IReadable<CharacterCtrl>
PetrificationMax = reader.ReadSingle(address + 0x01A8);
Poison = reader.ReadSingle(address + 0x01AC);
PoisonMax = reader.ReadSingle(address + 0x01B4);

SpeedFactor = reader.ReadSingle(address + 0x0208, relative);

AsmControl = Pointer<ChrAsmCtrl>.CreateAndUnbox(reader, address + 0x2D4);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
{
public class CharacterVisualState : IReadable<CharacterVisualState>
{
public CharacterGlowEffectType GlowEffectType { get; set; }
public CharacterGlowEffectType PrimaryGlowEffectType { get; set; }
public byte Collison { get; set; }
public byte Hostility1 { get; set; }
public byte Hostility2 { get; set; }
public byte Hostility3 { get; set; }
public CharacterGlowEffectType SecondaryGlowEffectType { get; set; }

public CharacterVisualState Read(IReader reader, int address, bool relative = false)
{
GlowEffectType = (CharacterGlowEffectType) reader.ReadInt32(address + 0x0038);
PrimaryGlowEffectType = (CharacterGlowEffectType) reader.ReadInt32(address + 0x0038);
Collison = reader.ReadByte(address + 0x003C);
Hostility1 = reader.ReadByte(address + 0x003D);
Hostility2 = reader.ReadByte(address + 0x003E);
Hostility3 = reader.ReadByte(address + 0x003F);

SecondaryGlowEffectType = (CharacterGlowEffectType) reader.ReadInt32(address + 0x0048);
return this;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ namespace DarkSoulsII.DebugView.Core.DarkSoulsII.Managers
{
public class GameDataManager : IReadable<GameDataManager>
{
public ItemInventoryData ItemInventoryData { get; set; }
public CharacterSlotData CharacterSlotData { get; set; }
public UserData000 UserData000 { get; set; }
public SaveSlotData SaveSlotData { get; set; }

public GameDataManager Read(IReader reader, int address, bool relative = false)
{
ItemInventoryData = Pointer<ItemInventoryData>.CreateAndUnbox(reader, address + 0x0008, relative);
CharacterSlotData =
Pointer<CharacterSlotData>.Create().Read(reader, address + 0x0060, relative).Unbox(reader);
UserData000 = Pointer<UserData000>.CreateAndUnbox(reader, address + 0x0064, relative);
SaveSlotData = Pointer<SaveSlotData>.CreateAndUnbox(reader, address + 0x006C, relative);
// TODO: Add ItemInventoryWrapperWrapper
return this;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class GameManagerImpl : GameManager, IReadable<GameManagerImpl>
public new GameManagerImpl Read(IReader reader, int address, bool relative = false)
{
base.Read(reader, address, relative);

CharacterManager = Pointer<CharacterManager>.CreateAndUnbox(reader, address + 0x0018, relative);
CameraManager = Pointer<CameraManager>.CreateAndUnbox(reader, address + 0x001C, relative);
AiManager = Pointer<AiManager>.CreateAndUnbox(reader, address + 0x0020, relative);
Expand Down
21 changes: 0 additions & 21 deletions DarkSoulsII.DebugView.Core/DarkSoulsII/Map/Item/MapItemPack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,7 @@ public MapItemPack Read(IReader reader, int address, bool relative = false)
}
return items;
});


int count = reader.ReadInt32(address + 0x0010, relative);
//Items = GenericPointer.Create(reader, address + 0x000C, relative)
// .Unbox(reader, (containerReader, containerAddress) =>
// {
// List<MapItem> items = new List<MapItem>();

// var nodePointer = containerAddress + 0x0000;
// for (int i = 0; i < count; i++) // TODO: Can this be read without the counter?
// {
// nodePointer = GenericPointer.Create(containerReader, nodePointer, false)
// .Unbox(containerReader, (nodeReader, nodeAddress) =>
// {
// items.Add(Pointer<MapItem>.CreateAndUnbox(nodeReader, nodeAddress + 0x0008));
// return nodeAddress + 0x0000;
// });

// }

// return items;
// });
return this;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class FileResourceObject : ResourceObject, IReadable<FileResourceObject>
{
base.Read(reader, address, relative);
Name = GenericPointer.Create(reader, address + 0x005C, relative).Unbox(reader,
(r, a) => r.ReadNullTerminatedStringChunked(a, false, 16, Encoding.Unicode, 2));
(r, a) => r.ReadNullTerminatedStringChunked(Encoding.Unicode, 2, 16, a, false));
return this;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ public Param Read(IReader reader, int address, bool relative = false)
return this;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public TextLookUpTable Read(IReader reader, int address, bool relative = false)
for (int i = 0; i < stringCount; i++)
{
var address1 = address + offsets[i];
strings[i] = reader.ReadNullTerminatedStringChunked(address1, relative, 16, Encoding.Unicode, 2);
strings[i] = reader.ReadNullTerminatedStringChunked(Encoding.Unicode, 2, 16, address1, relative);
}

int itemAddress = address + 0x001C;
Expand Down
9 changes: 6 additions & 3 deletions DarkSoulsII.DebugView.Core/IReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ public interface IReader
char ReadChar(int charSize, Encoding encoding, int address, bool relative = false);
string ReadString(int length, int address, bool relative = false);
string ReadString(int length, int charSize, Encoding encoding, int address, bool relative = false);
string ReadNullTerminatedString(int address, bool relative, Encoding encoding = null, int charSize = 1);
string ReadNullTerminatedString(int address, bool relative);
string ReadNullTerminatedString(Encoding encoding, int charSize, int address, bool relative);
string ReadNullTerminatedStringChunked(int address, bool relative);
string ReadNullTerminatedStringChunked(int lookaheadCharCount, int address, bool relative);

string ReadNullTerminatedStringChunked(int address, bool relative, int lookaheadCharCount = 16,
Encoding encoding = null, int charSize = 1);
string ReadNullTerminatedStringChunked(Encoding encoding, int charSize, int lookaheadCharCount, int address,
bool relative);
}
}
Loading

0 comments on commit 8b979ea

Please sign in to comment.