[jasper/world] Make palBank fields 8 bit
All checks were successful
Build / build (push) Successful in 3m48s
All checks were successful
Build / build (push) Successful in 3m48s
This commit is contained in:
parent
68e2d390ba
commit
9187c07551
@ -30,7 +30,7 @@ struct WorldObject {
|
|||||||
ObjectId id{};
|
ObjectId id{};
|
||||||
ox::String name;
|
ox::String name;
|
||||||
uint16_t intervalMs{};
|
uint16_t intervalMs{};
|
||||||
uint16_t palBank{};
|
uint8_t palBank{};
|
||||||
ncore::SubSheetId subsheetId{};
|
ncore::SubSheetId subsheetId{};
|
||||||
CollisionMap collisionMap{};
|
CollisionMap collisionMap{};
|
||||||
uint8_t frames{};
|
uint8_t frames{};
|
||||||
|
@ -82,10 +82,10 @@ OX_MODEL_END()
|
|||||||
struct ObjTileRefSet {
|
struct ObjTileRefSet {
|
||||||
static constexpr auto TypeName = "net.drinkingtea.jasper.world.ObjTileRefSet";
|
static constexpr auto TypeName = "net.drinkingtea.jasper.world.ObjTileRefSet";
|
||||||
static constexpr auto TypeVersion = 1;
|
static constexpr auto TypeVersion = 1;
|
||||||
uint16_t palBank{};
|
|
||||||
uint16_t tilesheetIdx{};
|
uint16_t tilesheetIdx{};
|
||||||
uint16_t cbbIdx{};
|
uint16_t cbbIdx{};
|
||||||
uint8_t cbb{};
|
uint8_t cbb{};
|
||||||
|
uint8_t palBank{};
|
||||||
// which tilesheet to use
|
// which tilesheet to use
|
||||||
uint8_t tilesheetId{};
|
uint8_t tilesheetId{};
|
||||||
uint8_t tileCnt{};
|
uint8_t tileCnt{};
|
||||||
@ -95,10 +95,10 @@ struct ObjTileRefSet {
|
|||||||
};
|
};
|
||||||
|
|
||||||
OX_MODEL_BEGIN(ObjTileRefSet)
|
OX_MODEL_BEGIN(ObjTileRefSet)
|
||||||
OX_MODEL_FIELD(palBank)
|
|
||||||
OX_MODEL_FIELD(tilesheetIdx)
|
OX_MODEL_FIELD(tilesheetIdx)
|
||||||
OX_MODEL_FIELD(cbbIdx)
|
OX_MODEL_FIELD(cbbIdx)
|
||||||
OX_MODEL_FIELD(cbb)
|
OX_MODEL_FIELD(cbb)
|
||||||
|
OX_MODEL_FIELD(palBank)
|
||||||
OX_MODEL_FIELD(tilesheetId)
|
OX_MODEL_FIELD(tilesheetId)
|
||||||
OX_MODEL_FIELD(tileCnt)
|
OX_MODEL_FIELD(tileCnt)
|
||||||
OX_MODEL_FIELD(frames)
|
OX_MODEL_FIELD(frames)
|
||||||
|
@ -15,8 +15,8 @@ RmPalette::RmPalette(WorldObjectSet &doc, size_t const rmIdx) noexcept:
|
|||||||
m_objUpdates.reserve(m_doc.objects.size());
|
m_objUpdates.reserve(m_doc.objects.size());
|
||||||
for (size_t i = 0; auto const&obj : m_doc.objects) {
|
for (size_t i = 0; auto const&obj : m_doc.objects) {
|
||||||
if (obj.palBank >= m_rmIdx) {
|
if (obj.palBank >= m_rmIdx) {
|
||||||
auto const newPalBank = static_cast<uint16_t>(obj.palBank == m_rmIdx ?
|
uint8_t const newPalBank = obj.palBank == m_rmIdx ?
|
||||||
0 : obj.palBank - 1);
|
0 : obj.palBank - 1;
|
||||||
m_objUpdates.emplace_back(ObjUpdate{
|
m_objUpdates.emplace_back(ObjUpdate{
|
||||||
.idx = i,
|
.idx = i,
|
||||||
.oldPalBank = obj.palBank,
|
.oldPalBank = obj.palBank,
|
||||||
|
@ -19,8 +19,8 @@ class RmPalette: public studio::UndoCommand {
|
|||||||
size_t const m_rmIdx = 0;
|
size_t const m_rmIdx = 0;
|
||||||
struct ObjUpdate {
|
struct ObjUpdate {
|
||||||
size_t idx{};
|
size_t idx{};
|
||||||
uint16_t oldPalBank{};
|
uint8_t oldPalBank{};
|
||||||
uint16_t newPalBank{};
|
uint8_t newPalBank{};
|
||||||
};
|
};
|
||||||
ox::Vector<ObjUpdate> m_objUpdates;
|
ox::Vector<ObjUpdate> m_objUpdates;
|
||||||
public:
|
public:
|
||||||
|
@ -183,7 +183,7 @@ void WorldObjectSetEditorImGui::drawObjEditor() noexcept {
|
|||||||
ig::IDStackItem const subsheetSelectorStackItem("SubsheetSelector");
|
ig::IDStackItem const subsheetSelectorStackItem("SubsheetSelector");
|
||||||
if (ig::ComboBox("Palette", m_paletteDisplayNames, m_objEditor.palette)) {
|
if (ig::ComboBox("Palette", m_paletteDisplayNames, m_objEditor.palette)) {
|
||||||
std::ignore = pushCommand<EditObjectPalette>(
|
std::ignore = pushCommand<EditObjectPalette>(
|
||||||
m_doc, m_selectedObj, static_cast<uint16_t>(m_objEditor.palette));
|
m_doc, m_selectedObj, static_cast<uint8_t>(m_objEditor.palette));
|
||||||
}
|
}
|
||||||
if (ImGui::InputInt("Frames", &m_objEditor.frames, 1)) {
|
if (ImGui::InputInt("Frames", &m_objEditor.frames, 1)) {
|
||||||
m_objEditor.frames = ox::max(m_objEditor.frames, 1);
|
m_objEditor.frames = ox::max(m_objEditor.frames, 1);
|
||||||
|
@ -161,9 +161,9 @@ ox::Result<uint8_t> WorldStaticLoader::setupTileResrc(DocObjRef const&docObjRef)
|
|||||||
}
|
}
|
||||||
auto const out = static_cast<uint8_t>(m_worldStatic.objTileRefSets.size());
|
auto const out = static_cast<uint8_t>(m_worldStatic.objTileRefSets.size());
|
||||||
auto const&refSet = m_worldStatic.objTileRefSets.emplace_back(ObjTileRefSet{
|
auto const&refSet = m_worldStatic.objTileRefSets.emplace_back(ObjTileRefSet{
|
||||||
.palBank = obj->palBank,
|
|
||||||
.tilesheetIdx = static_cast<uint16_t>(*subsheetOffset),
|
.tilesheetIdx = static_cast<uint16_t>(*subsheetOffset),
|
||||||
.cbbIdx = m_cbbIt,
|
.cbbIdx = m_cbbIt,
|
||||||
|
.palBank = obj->palBank,
|
||||||
.tilesheetId = tsIdx,
|
.tilesheetId = tsIdx,
|
||||||
.tileCnt = subsheetTileCnt(*subsheet),
|
.tileCnt = subsheetTileCnt(*subsheet),
|
||||||
.frames = obj->frames,
|
.frames = obj->frames,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user