mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-15 04:15:36 -05:00
Use Block masks to update value limits, parse fieldmap.c
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
#include "bitpacker.h"
|
||||
#include "config.h"
|
||||
|
||||
// Upper limit for metatile ID, collision, and elevation masks. Used externally.
|
||||
const uint16_t Block::maxValue = 0xFFFF;
|
||||
|
||||
static BitPacker bitsMetatileId = BitPacker(0x3FF);
|
||||
static BitPacker bitsCollision = BitPacker(0xC00);
|
||||
static BitPacker bitsElevation = BitPacker(0xF000);
|
||||
@@ -43,16 +46,32 @@ uint16_t Block::rawValue() const {
|
||||
| bitsElevation.pack(m_elevation);
|
||||
}
|
||||
|
||||
// TODO: Resolve TODOs for max block limits, and disable collision tab if collision and elevation are 0
|
||||
// TODO: After parsing, recalc max collision/elevation for selector image (in Metatile::setLayout?)
|
||||
// TODO: More generous config limits
|
||||
// TODO: Settings editor -- disable UI & restore after refresh, red flag overlapping masks
|
||||
// TODO: Generalize API tab disabling, i.e. check if disabled before allowing selection
|
||||
// TODO: Metatile selector looks like it's having a fit during group block select
|
||||
// TODO: After parsing, recalc config (or parsed!) values that depend on max collision/elevation
|
||||
/* - newMapMetatileId
|
||||
- newMapElevation
|
||||
- newMapCollision
|
||||
- newMapBorderMetatileIds
|
||||
- collisionSheetWidth
|
||||
- collisionSheetHeight
|
||||
- NUM_METATILES_IN_PRIMARY
|
||||
- event elevations
|
||||
- metatile labels?
|
||||
|
||||
*/
|
||||
// TODO: Settings editor -- disable UI & restore after refresh
|
||||
void Block::setLayout() {
|
||||
bitsMetatileId.setMask(projectConfig.getBlockMetatileIdMask());
|
||||
bitsCollision.setMask(projectConfig.getBlockCollisionMask());
|
||||
bitsElevation.setMask(projectConfig.getBlockElevationMask());
|
||||
|
||||
// Some settings may need to be reevaluated based on the layout
|
||||
/*uint16_t metatileId = projectConfig.getNewMapMetatileId();
|
||||
if (bitsMetatileId.clamp(metatileId) != metatileId)
|
||||
projectConfig.setNewMapMetatileId(bitsMetatileId.clamp(metatileId));
|
||||
uint16_t metatileId = projectConfig.getNewMapMetatileId();
|
||||
if (bitsMetatileId.clamp(metatileId) != metatileId)
|
||||
projectConfig.setNewMapMetatileId(bitsMetatileId.clamp(metatileId));*/
|
||||
|
||||
}
|
||||
|
||||
bool Block::operator ==(Block other) const {
|
||||
|
||||
Reference in New Issue
Block a user