mirror of
https://github.com/kwsch/NHSE.git
synced 2026-08-07 10:14:37 -05:00
rewritten core side to include tons more metadata/structure need to rewrite renderer to output full map image rather than skipping sea
47 lines
1.8 KiB
C#
47 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace NHSE.Core;
|
|
|
|
public class PlayerRoom1(Memory<byte> raw) : IPlayerRoom
|
|
{
|
|
public const int SIZE = 0x65C8;
|
|
public virtual string Extension => "nhpr";
|
|
|
|
public Span<byte> Data => raw.Span;
|
|
|
|
public byte[] Write() => Data.ToArray();
|
|
|
|
/*
|
|
s_d8bc748b ItemLayerList[8]; // @0x0 size 0xc80, align 4
|
|
s_c20a4615 ItemSwitchList[8]; // @0x6400 size 0x34, align 4
|
|
GSaveAudioInfo AudioInfo; // @0x65a0 size 0x4, align 2
|
|
GSaveRoomFloorWall RoomFloorWall; // @0x65a4 size 0x24, align 4
|
|
*/
|
|
|
|
public const int LayerCount = 8;
|
|
public LayerRoomItem[] GetItemLayers() => LayerRoomItem.GetArray(Data[..(LayerCount * LayerRoomItem.SIZE)].ToArray());
|
|
public void SetItemLayers(IReadOnlyList<LayerRoomItem> value) => LayerRoomItem.SetArray(value).CopyTo(Data);
|
|
|
|
public bool GetIsActive(int layer, int x, int y) => FlagUtil.GetFlag(Data, 0x6400 + (layer * 0x34), (y * 20) + x);
|
|
public void SetIsActive(int layer, int x, int y, bool value = true) => FlagUtil.SetFlag(Data, 0x6400 + (layer * 0x34), (y * 20) + x, value);
|
|
|
|
public GSaveAudioInfo AudioInfo
|
|
{
|
|
get => Data.Slice(0x65A0, GSaveAudioInfo.SIZE).ToStructure<GSaveAudioInfo>();
|
|
set => value.ToBytes().CopyTo(Data[0x65A0..]);
|
|
}
|
|
|
|
public GSaveRoomFloorWall RoomFloorWall
|
|
{
|
|
get => Data.Slice(0x65A4, GSaveRoomFloorWall.SIZE).ToStructure<GSaveRoomFloorWall>();
|
|
set => value.ToBytes().CopyTo(Data[0x65A4..]);
|
|
}
|
|
|
|
public PlayerRoom2 Upgrade()
|
|
{
|
|
var data = new byte[PlayerRoom2.SIZE];
|
|
Data.CopyTo(data);
|
|
return new PlayerRoom2(data);
|
|
}
|
|
} |