mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-26 18:06:32 -05:00
Move files into src/
This commit is contained in:
32
src/core/block.cpp
Normal file
32
src/core/block.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "block.h"
|
||||
|
||||
Block::Block() {
|
||||
}
|
||||
|
||||
Block::Block(uint16_t word)
|
||||
{
|
||||
tile = word & 0x3ff;
|
||||
collision = (word >> 10) & 0x3;
|
||||
elevation = (word >> 12) & 0xf;
|
||||
}
|
||||
|
||||
Block::Block(const Block &block) {
|
||||
tile = block.tile;
|
||||
collision = block.collision;
|
||||
elevation = block.elevation;
|
||||
}
|
||||
|
||||
uint16_t Block::rawValue() {
|
||||
return static_cast<uint16_t>(
|
||||
(tile & 0x3ff) +
|
||||
((collision & 0x3) << 10) +
|
||||
((elevation & 0xf) << 12));
|
||||
}
|
||||
|
||||
bool Block::operator ==(Block other) {
|
||||
return (tile == other.tile) && (collision == other.collision) && (elevation == other.elevation);
|
||||
}
|
||||
|
||||
bool Block::operator !=(Block other) {
|
||||
return !(operator ==(other));
|
||||
}
|
||||
Reference in New Issue
Block a user