more dat renaming
This commit is contained in:
parent
6187bdbbdb
commit
1a080dbf15
|
@ -67,8 +67,8 @@ namespace Otc
|
||||||
DatLight,
|
DatLight,
|
||||||
DatDontHide,
|
DatDontHide,
|
||||||
DatTranslucent,
|
DatTranslucent,
|
||||||
DatDrawShift,
|
DatDisplacment,
|
||||||
DatDrawHeight,
|
DatElevation,
|
||||||
DatLyingCorpse,
|
DatLyingCorpse,
|
||||||
DatAnimateAlways,
|
DatAnimateAlways,
|
||||||
DatMinimapColor,
|
DatMinimapColor,
|
||||||
|
@ -77,7 +77,7 @@ namespace Otc
|
||||||
DatIgnoreLook,
|
DatIgnoreLook,
|
||||||
DatClothe,
|
DatClothe,
|
||||||
DatAnimation,
|
DatAnimation,
|
||||||
LastDatFlag
|
LastDatFlag = 255
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ThingAttributesGroup {
|
enum ThingAttributesGroup {
|
||||||
|
|
|
@ -72,17 +72,17 @@ void Creature::draw(int x, int y)
|
||||||
const ThingAttributes& attributes = getAttributes();
|
const ThingAttributes& attributes = getAttributes();
|
||||||
|
|
||||||
// Render creature
|
// Render creature
|
||||||
for(m_yDiv = 0; m_yDiv < attributes.ydiv; m_yDiv++) {
|
for(m_yPattern = 0; m_yPattern < attributes.yPattern; m_yPattern++) {
|
||||||
|
|
||||||
// continue if we dont have this addon.
|
// continue if we dont have this addon.
|
||||||
if(m_yDiv > 0 && !(m_outfit.addons & (1 << (m_yDiv-1))))
|
if(m_yPattern > 0 && !(m_outfit.addons & (1 << (m_yPattern-1))))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// draw white item
|
// draw white item
|
||||||
internalDraw(x, y, 0);
|
internalDraw(x, y, 0);
|
||||||
|
|
||||||
// draw mask if exists
|
// draw mask if exists
|
||||||
if(attributes.blendframes > 1) {
|
if(attributes.layers > 1) {
|
||||||
// switch to blend color mode
|
// switch to blend color mode
|
||||||
g_graphics.bindBlendFunc(Fw::BlendColorzing);
|
g_graphics.bindBlendFunc(Fw::BlendColorzing);
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ void Creature::draw(int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update animation and position
|
// Update animation and position
|
||||||
if(m_walking && attributes.animcount > 1) {
|
if(m_walking && attributes.animationPhases > 1) {
|
||||||
|
|
||||||
if(g_platform.getTicks() - m_lastTicks >= m_walkTimePerPixel) {
|
if(g_platform.getTicks() - m_lastTicks >= m_walkTimePerPixel) {
|
||||||
int pixelsWalked = std::floor((g_platform.getTicks() - m_lastTicks) / m_walkTimePerPixel);
|
int pixelsWalked = std::floor((g_platform.getTicks() - m_lastTicks) / m_walkTimePerPixel);
|
||||||
|
@ -126,8 +126,8 @@ void Creature::draw(int x, int y)
|
||||||
m_walkOffsetX = std::max(m_walkOffsetX - pixelsWalked, 0);
|
m_walkOffsetX = std::max(m_walkOffsetX - pixelsWalked, 0);
|
||||||
|
|
||||||
int walkOffset = std::max(std::abs(m_walkOffsetX), std::abs(m_walkOffsetY));
|
int walkOffset = std::max(std::abs(m_walkOffsetX), std::abs(m_walkOffsetY));
|
||||||
if(walkOffset % (int)std::ceil(32 / (float)attributes.animcount) == 0) {
|
if(walkOffset % (int)std::ceil(32 / (float)attributes.animationPhases) == 0) {
|
||||||
if(m_lastWalkAnim+1 == attributes.animcount)
|
if(m_lastWalkAnim+1 == attributes.animationPhases)
|
||||||
m_lastWalkAnim = 1;
|
m_lastWalkAnim = 1;
|
||||||
else
|
else
|
||||||
m_lastWalkAnim++;
|
m_lastWalkAnim++;
|
||||||
|
@ -225,15 +225,15 @@ void Creature::walk(const Position& position)
|
||||||
g_map.addThing(asThing());
|
g_map.addThing(asThing());
|
||||||
|
|
||||||
if(m_walking) {
|
if(m_walking) {
|
||||||
// Calculate xDiv
|
// Calculate xPattern
|
||||||
if(m_direction >= 4) {
|
if(m_direction >= 4) {
|
||||||
if(m_direction == Otc::NorthEast || m_direction == Otc::SouthEast)
|
if(m_direction == Otc::NorthEast || m_direction == Otc::SouthEast)
|
||||||
m_xDiv = Otc::East;
|
m_xPattern = Otc::East;
|
||||||
else if(m_direction == Otc::NorthWest || m_direction == Otc::SouthWest)
|
else if(m_direction == Otc::NorthWest || m_direction == Otc::SouthWest)
|
||||||
m_xDiv = Otc::West;
|
m_xPattern = Otc::West;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_xDiv = m_direction;
|
m_xPattern = m_direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get walk speed
|
// get walk speed
|
||||||
|
@ -241,7 +241,7 @@ void Creature::walk(const Position& position)
|
||||||
|
|
||||||
ThingPtr ground = g_map.getThing(m_position, 0);
|
ThingPtr ground = g_map.getThing(m_position, 0);
|
||||||
if(ground)
|
if(ground)
|
||||||
groundSpeed = ground->getAttributes().speed;
|
groundSpeed = ground->getAttributes().groundSpeed;
|
||||||
|
|
||||||
float walkTime = walkTimeFactor * 1000.0 * (float)groundSpeed / m_speed;
|
float walkTime = walkTimeFactor * 1000.0 * (float)groundSpeed / m_speed;
|
||||||
walkTime = walkTime == 0 ? 1000 : walkTime;
|
walkTime = walkTime == 0 ? 1000 : walkTime;
|
||||||
|
|
|
@ -78,7 +78,7 @@ void DatManager::parseThingAttributes(std::stringstream& fin, ThingAttributes& t
|
||||||
uint8 opt;
|
uint8 opt;
|
||||||
fin.read((char*)&opt, 1);
|
fin.read((char*)&opt, 1);
|
||||||
|
|
||||||
if(opt == 0xFF)
|
if(opt == Otc::LastDatFlag)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
parseThingAttributesOpt(fin, thingAttributes, opt);
|
parseThingAttributesOpt(fin, thingAttributes, opt);
|
||||||
|
@ -86,22 +86,25 @@ void DatManager::parseThingAttributes(std::stringstream& fin, ThingAttributes& t
|
||||||
|
|
||||||
thingAttributes.width = Fw::getU8(fin);
|
thingAttributes.width = Fw::getU8(fin);
|
||||||
thingAttributes.height = Fw::getU8(fin);
|
thingAttributes.height = Fw::getU8(fin);
|
||||||
if(thingAttributes.width > 1 || thingAttributes.height > 1)
|
|
||||||
Fw::getU8(fin); // ??
|
|
||||||
|
|
||||||
thingAttributes.blendframes = Fw::getU8(fin);
|
if(thingAttributes.width > 1 || thingAttributes.height > 1)
|
||||||
thingAttributes.xdiv = Fw::getU8(fin);
|
thingAttributes.exactSize = Fw::getU8(fin);
|
||||||
thingAttributes.ydiv = Fw::getU8(fin);
|
else
|
||||||
thingAttributes.zdiv = Fw::getU8(fin);
|
thingAttributes.exactSize = 32;
|
||||||
thingAttributes.animcount = Fw::getU8(fin);
|
|
||||||
|
thingAttributes.layers = Fw::getU8(fin);
|
||||||
|
thingAttributes.xPattern = Fw::getU8(fin);
|
||||||
|
thingAttributes.yPattern = Fw::getU8(fin);
|
||||||
|
thingAttributes.zPattern = Fw::getU8(fin);
|
||||||
|
thingAttributes.animationPhases = Fw::getU8(fin);
|
||||||
|
|
||||||
int totalSprites = thingAttributes.width
|
int totalSprites = thingAttributes.width
|
||||||
* thingAttributes.height
|
* thingAttributes.height
|
||||||
* thingAttributes.blendframes
|
* thingAttributes.layers
|
||||||
* thingAttributes.xdiv
|
* thingAttributes.xPattern
|
||||||
* thingAttributes.ydiv
|
* thingAttributes.yPattern
|
||||||
* thingAttributes.zdiv
|
* thingAttributes.zPattern
|
||||||
* thingAttributes.animcount;
|
* thingAttributes.animationPhases;
|
||||||
|
|
||||||
thingAttributes.sprites.resize(totalSprites);
|
thingAttributes.sprites.resize(totalSprites);
|
||||||
for(uint16 i = 0; i < totalSprites; i++)
|
for(uint16 i = 0; i < totalSprites; i++)
|
||||||
|
@ -112,107 +115,107 @@ void DatManager::parseThingAttributesOpt(std::stringstream& fin, ThingAttributes
|
||||||
{
|
{
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case Otc::DatGround: // Grounds, must be drawn first
|
case Otc::DatGround: // Grounds, must be drawn first
|
||||||
thingAttributes.speed = Fw::getU16(fin);
|
thingAttributes.groundSpeed = Fw::getU16(fin);
|
||||||
thingAttributes.group = Otc::ThingGroundGroup;
|
thingAttributes.isGround = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatGroundClip: // Objects that clips (has transparent pixels) and must be drawn just after ground (e.g: ground borders)
|
case Otc::DatGroundClip: // Objects that clips (has transparent pixels) and must be drawn just after ground (e.g: ground borders)
|
||||||
thingAttributes.alwaysOnTop = true;
|
thingAttributes.isGroundClip = true;
|
||||||
thingAttributes.alwaysOnTopOrder = 1;
|
|
||||||
break;
|
break;
|
||||||
case Otc::DatOnBottom: // Bottom items, must be drawn above general items and below creatures (e.g: stairs)
|
case Otc::DatOnBottom: // Bottom items, must be drawn above general items and below creatures (e.g: stairs)
|
||||||
thingAttributes.alwaysOnTop = true;
|
thingAttributes.isOnBottom = true;
|
||||||
thingAttributes.alwaysOnTopOrder = 2;
|
|
||||||
break;
|
break;
|
||||||
case Otc::DatOnTop: // Top items, must be drawn above creatures (e.g: doors)
|
case Otc::DatOnTop: // Top items, must be drawn above creatures (e.g: doors)
|
||||||
thingAttributes.alwaysOnTop = true;
|
thingAttributes.isOnTop = true;
|
||||||
thingAttributes.alwaysOnTopOrder = 3;
|
|
||||||
break;
|
break;
|
||||||
case Otc::DatContainer: // Containers
|
case Otc::DatContainer: // Containers
|
||||||
thingAttributes.group = Otc::ThingContainerGroup;
|
thingAttributes.isContainer = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatStackable: // Stackable
|
case Otc::DatStackable: // Stackable
|
||||||
thingAttributes.stackable = true;
|
thingAttributes.isStackable = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatForceUse: // Items that are automatically used when step over?
|
case Otc::DatForceUse: // Items that are automatically used when step over?
|
||||||
|
thingAttributes.isForceUse = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatMultiUse: // Usable items
|
case Otc::DatMultiUse: // Usable items
|
||||||
thingAttributes.useable = true;
|
thingAttributes.isMultiUse = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatWritable: // Writable
|
case Otc::DatWritable: // Writable
|
||||||
thingAttributes.group = Otc::ThingWriteableGroup;
|
thingAttributes.isWritable = true;
|
||||||
thingAttributes.readable = true;
|
thingAttributes.maxTextLength = Fw::getU16(fin);
|
||||||
thingAttributes.subParam08 = Fw::getU16(fin);
|
|
||||||
break;
|
break;
|
||||||
case Otc::DatWritableOnce: // Writable once. objects that can't be edited by players
|
case Otc::DatWritableOnce: // Writable once. objects that can't be edited by players
|
||||||
thingAttributes.readable = true;
|
thingAttributes.isWritableOnce = true;
|
||||||
thingAttributes.subParam08 = Fw::getU16(fin);
|
thingAttributes.maxTextLength = Fw::getU16(fin);
|
||||||
break;
|
break;
|
||||||
case Otc::DatFluidContainer: // Fluid containers
|
case Otc::DatFluidContainer: // Fluid containers
|
||||||
thingAttributes.group = Otc::ThingFluidGroup;
|
thingAttributes.fluidParam = Fw::getU8(fin);
|
||||||
Fw::getU8(fin);
|
|
||||||
break;
|
break;
|
||||||
case Otc::DatSplash: // Splashes
|
case Otc::DatSplash: // Splashes
|
||||||
thingAttributes.group = Otc::ThingSplashGroup;
|
thingAttributes.isStackable = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatBlockWalk: // Blocks solid objects (creatures, walls etc)
|
case Otc::DatBlockWalk: // Blocks solid objects (creatures, walls etc)
|
||||||
thingAttributes.blockSolid = true;
|
thingAttributes.isNotWalkable = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatNotMovable: // Not movable
|
case Otc::DatNotMovable: // Not movable
|
||||||
thingAttributes.moveable = false;
|
thingAttributes.isNotMoveable = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatBlockProjectile: // Blocks missiles (walls, magic wall etc)
|
case Otc::DatBlockProjectile: // Blocks missiles (walls, magic wall etc)
|
||||||
thingAttributes.blockProjectile = true;
|
thingAttributes.isNotProjectable = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatBlockPathFind: // Blocks pathfind algorithms (monsters)
|
case Otc::DatBlockPathFind: // Blocks pathfind algorithms (monsters)
|
||||||
thingAttributes.blockPathFind = true;
|
thingAttributes.isNotPathable = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatPickupable: // Pickupable
|
case Otc::DatPickupable: // Pickupable
|
||||||
thingAttributes.pickupable = true;
|
thingAttributes.isPickupable = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatHangable: // Hangable objects (wallpaper etc)
|
case Otc::DatHangable: // Hangable objects (wallpaper etc)
|
||||||
thingAttributes.isHangable = true;
|
thingAttributes.isHangable = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatHookSouth: // Horizontal walls
|
case Otc::DatHookSouth: // Horizontal walls
|
||||||
thingAttributes.isHorizontal = true;
|
thingAttributes.isHookSouth = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatHookEast: // Vertical walls
|
case Otc::DatHookEast: // Vertical walls
|
||||||
thingAttributes.isVertical = true;
|
thingAttributes.isHookEast = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatRotable: // Rotable
|
case Otc::DatRotable: // Rotable
|
||||||
thingAttributes.rotable = true;
|
thingAttributes.isRotable = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatLight: // Light info
|
case Otc::DatLight: // Light info
|
||||||
|
thingAttributes.hasLight = true;
|
||||||
thingAttributes.lightLevel = Fw::getU16(fin);
|
thingAttributes.lightLevel = Fw::getU16(fin);
|
||||||
thingAttributes.lightColor = Fw::getU16(fin);
|
thingAttributes.lightColor = Fw::getU16(fin);
|
||||||
break;
|
break;
|
||||||
case Otc::DatDontHide: // A few monuments that are not supposed to be hidden by floors
|
case Otc::DatDontHide: // A few monuments that are not supposed to be hidden by floors
|
||||||
break;
|
break;
|
||||||
case Otc::DatTranslucent: // Grounds that are translucent
|
case Otc::DatTranslucent: // Grounds that are translucent
|
||||||
thingAttributes.changesFloor = true;
|
thingAttributes.isTranslucent = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatDrawShift: // Must shift draw
|
case Otc::DatDisplacment: // Must shift draw
|
||||||
thingAttributes.hasHeight = true;
|
thingAttributes.xDisplacment = Fw::getU16(fin);
|
||||||
thingAttributes.drawOffset = Fw::getU16(fin);
|
thingAttributes.yDisplacment = Fw::getU16(fin);
|
||||||
Fw::getU16(fin);
|
|
||||||
break;
|
break;
|
||||||
case Otc::DatDrawHeight: // pixels characters height
|
case Otc::DatElevation: // Must elevate draw
|
||||||
thingAttributes.drawNextOffset = Fw::getU16(fin);
|
thingAttributes.elevation = Fw::getU16(fin);
|
||||||
break;
|
break;
|
||||||
case Otc::DatLyingCorpse: // Some corpses
|
case Otc::DatLyingCorpse: // Some corpses
|
||||||
|
thingAttributes.isLyingCorpse = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatAnimateAlways: // Unknown, check if firesword is a kind of AnimateAlways.
|
case Otc::DatAnimateAlways: // Unknown, check if firesword is a kind of AnimateAlways.
|
||||||
|
thingAttributes.isAnimatedAlways = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatMinimapColor: // Minimap color
|
case Otc::DatMinimapColor: // Minimap color
|
||||||
thingAttributes.hasMiniMapColor = true;
|
thingAttributes.hasMiniMapColor = true;
|
||||||
thingAttributes.miniMapColor = Fw::getU16(fin);
|
thingAttributes.miniMapColor = Fw::getU16(fin);
|
||||||
break;
|
break;
|
||||||
case Otc::DatLensHelp: // Used for giving players tips?
|
case Otc::DatLensHelp: // Used for giving players tips?
|
||||||
Fw::getU16(fin);
|
thingAttributes.isLensHelp = true;
|
||||||
|
thingAttributes.lensHelpParam = Fw::getU16(fin);
|
||||||
break;
|
break;
|
||||||
case Otc::DatFullGround: // Grounds that has no transparent pixels
|
case Otc::DatFullGround: // Grounds that has no transparent pixels
|
||||||
|
thingAttributes.isFullGround = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatIgnoreLook: // Ignore look, then looks at the item on the bottom of it
|
case Otc::DatIgnoreLook: // Ignore look, then looks at the item on the bottom of it
|
||||||
thingAttributes.lookThrough = true;
|
thingAttributes.isIgnoreLook = true;
|
||||||
break;
|
break;
|
||||||
case Otc::DatClothe: // Clothes
|
case Otc::DatClothe: // Clothes
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -37,7 +37,7 @@ void Effect::draw(int x, int y)
|
||||||
if(!m_finished) {
|
if(!m_finished) {
|
||||||
if(g_platform.getTicks() - m_lastTicks > 75) {
|
if(g_platform.getTicks() - m_lastTicks > 75) {
|
||||||
const ThingAttributes& attributes = getAttributes();
|
const ThingAttributes& attributes = getAttributes();
|
||||||
if(m_animation+1 == attributes.animcount) {
|
if(m_animation+1 == attributes.animationPhases) {
|
||||||
g_dispatcher.addEvent(std::bind(&Map::removeThingByPtr, &g_map, asThing()));
|
g_dispatcher.addEvent(std::bind(&Map::removeThingByPtr, &g_map, asThing()));
|
||||||
m_finished = true;
|
m_finished = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,9 +36,9 @@ void Item::draw(int x, int y)
|
||||||
{
|
{
|
||||||
const ThingAttributes& attributes = g_dat.getItemAttributes(m_id);
|
const ThingAttributes& attributes = g_dat.getItemAttributes(m_id);
|
||||||
|
|
||||||
if(attributes.animcount > 1) {
|
if(attributes.animationPhases > 1) {
|
||||||
if(g_platform.getTicks() - m_lastTicks > 500) {
|
if(g_platform.getTicks() - m_lastTicks > 500) {
|
||||||
if(m_animation+1 == attributes.animcount)
|
if(m_animation+1 == attributes.animationPhases)
|
||||||
m_animation = 0;
|
m_animation = 0;
|
||||||
else
|
else
|
||||||
m_animation++;
|
m_animation++;
|
||||||
|
@ -48,11 +48,11 @@ void Item::draw(int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if(attributes.group == Otc::ThingSplashGroup || attributes.group == Otc::ThingFluidGroup) {
|
/*if(attributes.group == Otc::ThingSplashGroup || attributes.group == Otc::ThingFluidGroup) {
|
||||||
//xdiv = m_count % attributes.xdiv;
|
//xPattern = m_count % attributes.xPattern;
|
||||||
//ydiv = m_count / attributes.ydiv;
|
//yPattern = m_count / attributes.yPattern;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
for(int b = 0; b < attributes.blendframes; b++)
|
for(int b = 0; b < attributes.layers; b++)
|
||||||
internalDraw(x, y, b);
|
internalDraw(x, y, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,10 +72,10 @@ void Item::onPositionChange(const Position&)
|
||||||
{
|
{
|
||||||
const ThingAttributes& attributes = g_dat.getItemAttributes(m_id);
|
const ThingAttributes& attributes = g_dat.getItemAttributes(m_id);
|
||||||
|
|
||||||
if(!attributes.moveable) {
|
if(attributes.isNotMoveable) {
|
||||||
m_xDiv = m_position.x % attributes.xdiv;
|
m_xPattern = m_position.x % attributes.xPattern;
|
||||||
m_yDiv = m_position.y % attributes.ydiv;
|
m_yPattern = m_position.y % attributes.yPattern;
|
||||||
m_zDiv = m_position.z % attributes.zdiv;
|
m_zPattern = m_position.z % attributes.zPattern;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,26 +83,26 @@ void Item::onCountChange(int)
|
||||||
{
|
{
|
||||||
const ThingAttributes& attributes = g_dat.getItemAttributes(m_id);
|
const ThingAttributes& attributes = g_dat.getItemAttributes(m_id);
|
||||||
|
|
||||||
if(attributes.stackable && attributes.xdiv == 4 && attributes.ydiv == 2) {
|
if(attributes.isStackable && attributes.xPattern == 4 && attributes.yPattern == 2) {
|
||||||
if(m_count < 5) {
|
if(m_count < 5) {
|
||||||
m_xDiv = m_count-1;
|
m_xPattern = m_count-1;
|
||||||
m_yDiv = 0;
|
m_yPattern = 0;
|
||||||
}
|
}
|
||||||
else if(m_count < 10) {
|
else if(m_count < 10) {
|
||||||
m_xDiv = 0;
|
m_xPattern = 0;
|
||||||
m_yDiv = 1;
|
m_yPattern = 1;
|
||||||
}
|
}
|
||||||
else if(m_count < 25) {
|
else if(m_count < 25) {
|
||||||
m_xDiv = 1;
|
m_xPattern = 1;
|
||||||
m_yDiv = 1;
|
m_yPattern = 1;
|
||||||
}
|
}
|
||||||
else if(m_count < 50) {
|
else if(m_count < 50) {
|
||||||
m_xDiv = 2;
|
m_xPattern = 2;
|
||||||
m_yDiv = 1;
|
m_yPattern = 1;
|
||||||
}
|
}
|
||||||
else if(m_count <= 100) {
|
else if(m_count <= 100) {
|
||||||
m_xDiv = 3;
|
m_xPattern = 3;
|
||||||
m_yDiv = 1;
|
m_yPattern = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
|
|
||||||
Thing::Thing(Otc::ThingType type) : m_id(0), m_type(type)
|
Thing::Thing(Otc::ThingType type) : m_id(0), m_type(type)
|
||||||
{
|
{
|
||||||
m_xDiv = 0;
|
m_xPattern = 0;
|
||||||
m_yDiv = 0;
|
m_yPattern = 0;
|
||||||
m_zDiv = 0;
|
m_zPattern = 0;
|
||||||
m_animation = 0;
|
m_animation = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ void Thing::setPosition(const Position& position)
|
||||||
onPositionChange(oldPosition);
|
onPositionChange(oldPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thing::internalDraw(int x, int y, int blendframes, Otc::SpriteMask mask)
|
void Thing::internalDraw(int x, int y, int layers, Otc::SpriteMask mask)
|
||||||
{
|
{
|
||||||
const ThingAttributes& attributes = getAttributes();
|
const ThingAttributes& attributes = getAttributes();
|
||||||
|
|
||||||
|
@ -48,11 +48,11 @@ void Thing::internalDraw(int x, int y, int blendframes, Otc::SpriteMask mask)
|
||||||
for(int xi = 0; xi < attributes.width; xi++) {
|
for(int xi = 0; xi < attributes.width; xi++) {
|
||||||
int sprIndex = xi +
|
int sprIndex = xi +
|
||||||
yi * attributes.width +
|
yi * attributes.width +
|
||||||
blendframes * attributes.width * attributes.height +
|
layers * attributes.width * attributes.height +
|
||||||
m_xDiv * attributes.width * attributes.height * attributes.blendframes +
|
m_xPattern * attributes.width * attributes.height * attributes.layers +
|
||||||
m_yDiv * attributes.width * attributes.height * attributes.blendframes * attributes.xdiv +
|
m_yPattern * attributes.width * attributes.height * attributes.layers * attributes.xPattern +
|
||||||
m_zDiv * attributes.width * attributes.height * attributes.blendframes * attributes.xdiv * attributes.ydiv +
|
m_zPattern * attributes.width * attributes.height * attributes.layers * attributes.xPattern * attributes.yPattern +
|
||||||
m_animation * attributes.width * attributes.height * attributes.blendframes * attributes.xdiv * attributes.ydiv * attributes.zdiv;
|
m_animation * attributes.width * attributes.height * attributes.layers * attributes.xPattern * attributes.yPattern * attributes.zPattern;
|
||||||
|
|
||||||
int spriteId = attributes.sprites[sprIndex];
|
int spriteId = attributes.sprites[sprIndex];
|
||||||
if(!spriteId)
|
if(!spriteId)
|
||||||
|
@ -60,8 +60,8 @@ void Thing::internalDraw(int x, int y, int blendframes, Otc::SpriteMask mask)
|
||||||
|
|
||||||
TexturePtr spriteTex = g_sprites.getSpriteTexture(spriteId, mask);
|
TexturePtr spriteTex = g_sprites.getSpriteTexture(spriteId, mask);
|
||||||
|
|
||||||
Rect drawRect((x - xi*32) - attributes.drawOffset,
|
Rect drawRect((x - xi*32) - attributes.xDisplacment,
|
||||||
(y - yi*32) - attributes.drawOffset,
|
(y - yi*32) - attributes.yDisplacment,
|
||||||
32, 32);
|
32, 32);
|
||||||
g_graphics.drawTexturedRect(drawRect, spriteTex);
|
g_graphics.drawTexturedRect(drawRect, spriteTex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,13 +59,13 @@ public:
|
||||||
virtual LocalPlayerPtr asLocalPlayer() { return nullptr; }
|
virtual LocalPlayerPtr asLocalPlayer() { return nullptr; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void internalDraw(int x, int y, int blendframes, Otc::SpriteMask mask = Otc::SpriteNoMask);
|
void internalDraw(int x, int y, int layers, Otc::SpriteMask mask = Otc::SpriteNoMask);
|
||||||
|
|
||||||
uint32 m_id;
|
uint32 m_id;
|
||||||
Otc::ThingType m_type;
|
Otc::ThingType m_type;
|
||||||
Position m_position;
|
Position m_position;
|
||||||
|
|
||||||
int m_xDiv, m_yDiv, m_zDiv, m_animation;
|
int m_xPattern, m_yPattern, m_zPattern, m_animation;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -28,49 +28,101 @@
|
||||||
struct ThingAttributes
|
struct ThingAttributes
|
||||||
{
|
{
|
||||||
ThingAttributes() {
|
ThingAttributes() {
|
||||||
group = Otc::ThingNoGroup;
|
layers = 0;
|
||||||
blockSolid = false;
|
width = height = 0;
|
||||||
hasHeight = false;
|
exactSize = 0;
|
||||||
blockPathFind = false;
|
xPattern = yPattern = zPattern = 0;
|
||||||
blockProjectile = false;
|
animationPhases = 0;
|
||||||
alwaysOnTop = false;
|
xDisplacment = yDisplacment = 0;
|
||||||
alwaysOnTopOrder = 0;
|
elevation = 0;
|
||||||
stackable = false;
|
|
||||||
useable = false;
|
isGround = false;
|
||||||
moveable = true;
|
isGroundClip = false;
|
||||||
pickupable = false;
|
isOnBottom = false;
|
||||||
rotable = false;
|
isOnTop = false;
|
||||||
readable = false;
|
isContainer = false;
|
||||||
lookThrough = false;
|
isStackable = false;
|
||||||
speed = 0;
|
isForceUse = false;
|
||||||
lightLevel = 0;
|
isMultiUse = false;
|
||||||
lightColor = 0;
|
isWritable = false;
|
||||||
isVertical = false;
|
isWritableOnce = false;
|
||||||
isHorizontal = false;
|
isFluidContainer = false;
|
||||||
|
isSplash = false;
|
||||||
|
isNotWalkable = false;
|
||||||
|
isNotMoveable = false;
|
||||||
|
isNotProjectable = false;
|
||||||
|
isNotPathable = false;
|
||||||
|
isPickupable = false;
|
||||||
isHangable = false;
|
isHangable = false;
|
||||||
miniMapColor = 0;
|
isHookSouth = false;
|
||||||
|
isHookEast = false;
|
||||||
|
isRotable = false;
|
||||||
|
isDontHide = false;
|
||||||
|
isTranslucent = false;
|
||||||
|
isLyingCorpse = false;
|
||||||
|
isAnimatedAlways = false;
|
||||||
|
isLensHelp = false;
|
||||||
|
isFullGround = false;
|
||||||
|
isIgnoreLook = false;
|
||||||
|
isClothe = false;
|
||||||
|
hasLight = false;
|
||||||
hasMiniMapColor = false;
|
hasMiniMapColor = false;
|
||||||
changesFloor = false;
|
|
||||||
subParam07 = 0;
|
groundSpeed = 0;
|
||||||
subParam08 = 0;
|
fluidParam = 0;
|
||||||
width = 0;
|
maxTextLength = 0;
|
||||||
height = 0;
|
lightLevel = lightColor = 0;
|
||||||
blendframes = 0;
|
miniMapColor = 0;
|
||||||
xdiv = 0;
|
lensHelpParam = 0;
|
||||||
ydiv = 0;
|
|
||||||
zdiv = 0;
|
|
||||||
animcount = 0;
|
|
||||||
drawOffset = 0;
|
|
||||||
drawNextOffset = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool stackable, alwaysOnTop, useable, readable, moveable, blockSolid, blockProjectile, blockPathFind, pickupable,
|
uint8 layers;
|
||||||
isHangable, isHorizontal, isVertical, rotable, hasHeight, lookThrough, hasMiniMapColor, changesFloor;
|
uint8 width, height;
|
||||||
uint8 alwaysOnTopOrder, width, height, blendframes, xdiv, ydiv, zdiv, animcount, drawOffset, drawNextOffset;
|
uint8 exactSize;
|
||||||
uint16 speed, subParam07, subParam08, lightLevel, lightColor, miniMapColor;
|
uint8 xPattern, yPattern, zPattern;
|
||||||
|
uint8 animationPhases;
|
||||||
|
uint16 xDisplacment, yDisplacment;
|
||||||
|
uint16 elevation;
|
||||||
std::vector<int> sprites;
|
std::vector<int> sprites;
|
||||||
Otc::ThingAttributesGroup group;
|
|
||||||
|
bool isGround;
|
||||||
|
bool isGroundClip;
|
||||||
|
bool isOnBottom;
|
||||||
|
bool isOnTop;
|
||||||
|
bool isContainer;
|
||||||
|
bool isStackable;
|
||||||
|
bool isForceUse;
|
||||||
|
bool isMultiUse;
|
||||||
|
bool isWritable;
|
||||||
|
bool isWritableOnce;
|
||||||
|
bool isFluidContainer;
|
||||||
|
bool isSplash;
|
||||||
|
bool isNotWalkable;
|
||||||
|
bool isNotMoveable;
|
||||||
|
bool isNotProjectable;
|
||||||
|
bool isNotPathable;
|
||||||
|
bool isPickupable;
|
||||||
|
bool isHangable;
|
||||||
|
bool isHookSouth;
|
||||||
|
bool isHookEast;
|
||||||
|
bool isRotable;
|
||||||
|
bool isDontHide;
|
||||||
|
bool isTranslucent;
|
||||||
|
bool isLyingCorpse;
|
||||||
|
bool isAnimatedAlways;
|
||||||
|
bool isLensHelp;
|
||||||
|
bool isFullGround;
|
||||||
|
bool isIgnoreLook;
|
||||||
|
bool isClothe;
|
||||||
|
bool hasLight;
|
||||||
|
bool hasMiniMapColor;
|
||||||
|
|
||||||
|
uint16 groundSpeed;
|
||||||
|
uint8 fluidParam;
|
||||||
|
uint16 maxTextLength;
|
||||||
|
uint16 lightLevel, lightColor;
|
||||||
|
uint16 miniMapColor;
|
||||||
|
uint16 lensHelpParam;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<ThingAttributes> ThingAttributesList;
|
typedef std::vector<ThingAttributes> ThingAttributesList;
|
||||||
|
|
|
@ -45,9 +45,9 @@ void Tile::draw(int x, int y)
|
||||||
const ThingPtr& thing = *it;
|
const ThingPtr& thing = *it;
|
||||||
const ThingAttributes& thingAttributes = thing->getAttributes();
|
const ThingAttributes& thingAttributes = thing->getAttributes();
|
||||||
|
|
||||||
if(thingAttributes.alwaysOnTopOrder == 1) {
|
if(thingAttributes.isGroundClip) {
|
||||||
thing->draw(x - m_drawNextOffset, y - m_drawNextOffset);
|
thing->draw(x - m_drawNextOffset, y - m_drawNextOffset);
|
||||||
m_drawNextOffset += thingAttributes.drawNextOffset;
|
m_drawNextOffset += thingAttributes.elevation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,9 +55,9 @@ void Tile::draw(int x, int y)
|
||||||
const ThingPtr& thing = *it;
|
const ThingPtr& thing = *it;
|
||||||
const ThingAttributes& thingAttributes = thing->getAttributes();
|
const ThingAttributes& thingAttributes = thing->getAttributes();
|
||||||
|
|
||||||
if(thingAttributes.alwaysOnTopOrder == 2) {
|
if(thingAttributes.isOnBottom) {
|
||||||
thing->draw(x - m_drawNextOffset, y - m_drawNextOffset);
|
thing->draw(x - m_drawNextOffset, y - m_drawNextOffset);
|
||||||
m_drawNextOffset += thingAttributes.drawNextOffset;
|
m_drawNextOffset += thingAttributes.elevation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ void Tile::draw(int x, int y)
|
||||||
const ThingPtr& thing = *it;
|
const ThingPtr& thing = *it;
|
||||||
const ThingAttributes& thingAttributes = thing->getAttributes();
|
const ThingAttributes& thingAttributes = thing->getAttributes();
|
||||||
thing->draw(x - m_drawNextOffset, y - m_drawNextOffset);
|
thing->draw(x - m_drawNextOffset, y - m_drawNextOffset);
|
||||||
m_drawNextOffset += thingAttributes.drawNextOffset;
|
m_drawNextOffset += thingAttributes.elevation;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto it = m_creatures.rbegin(), end = m_creatures.rend(); it != end; ++it) {
|
for(auto it = m_creatures.rbegin(), end = m_creatures.rend(); it != end; ++it) {
|
||||||
|
@ -82,7 +82,7 @@ void Tile::draw(int x, int y)
|
||||||
const ThingPtr& thing = *it;
|
const ThingPtr& thing = *it;
|
||||||
const ThingAttributes& thingAttributes = thing->getAttributes();
|
const ThingAttributes& thingAttributes = thing->getAttributes();
|
||||||
|
|
||||||
if(thingAttributes.alwaysOnTopOrder == 3) {
|
if(thingAttributes.isOnTop) {
|
||||||
thing->draw(x, y);
|
thing->draw(x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,10 +97,10 @@ void Tile::addThing(ThingPtr thing, int stackpos)
|
||||||
const ThingAttributes& thingAttributes = thing->getAttributes();
|
const ThingAttributes& thingAttributes = thing->getAttributes();
|
||||||
|
|
||||||
if(thing->asItem()) {
|
if(thing->asItem()) {
|
||||||
if(thingAttributes.group == Otc::ThingGroundGroup)
|
if(thingAttributes.isGround)
|
||||||
m_ground = thing;
|
m_ground = thing;
|
||||||
else {
|
else {
|
||||||
if(thingAttributes.alwaysOnTop)
|
if(thingAttributes.isGroundClip || thingAttributes.isOnBottom || thingAttributes.isOnTop)
|
||||||
m_itemsTop.push_back(thing);
|
m_itemsTop.push_back(thing);
|
||||||
else {
|
else {
|
||||||
if(stackpos == -1)
|
if(stackpos == -1)
|
||||||
|
@ -173,7 +173,7 @@ void Tile::removeThingByPtr(ThingPtr thing)
|
||||||
if(thing->asItem()) {
|
if(thing->asItem()) {
|
||||||
const ThingAttributes& thingAttributes = thing->getAttributes();
|
const ThingAttributes& thingAttributes = thing->getAttributes();
|
||||||
|
|
||||||
if(!thingAttributes.alwaysOnTop) {
|
if(!(thingAttributes.isGroundClip || thingAttributes.isOnBottom || thingAttributes.isOnTop)) {
|
||||||
for(auto it = m_itemsBottom.begin(), end = m_itemsBottom.end(); it != end; ++it) {
|
for(auto it = m_itemsBottom.begin(), end = m_itemsBottom.end(); it != end; ++it) {
|
||||||
if(*it == thing) {
|
if(*it == thing) {
|
||||||
m_itemsBottom.erase(it);
|
m_itemsBottom.erase(it);
|
||||||
|
@ -240,7 +240,7 @@ int Tile::getStackSize(int stop)
|
||||||
|
|
||||||
bool Tile::isOpaque()
|
bool Tile::isOpaque()
|
||||||
{
|
{
|
||||||
if(m_ground && !m_ground->getAttributes().changesFloor)
|
if(m_ground && !m_ground->getAttributes().isTranslucent)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1038,7 +1038,7 @@ ItemPtr ProtocolGame::internalGetItem(InputMessage& msg, uint16 id)
|
||||||
item->setId(id);
|
item->setId(id);
|
||||||
|
|
||||||
const ThingAttributes& itemAttributes = g_dat.getItemAttributes(id);
|
const ThingAttributes& itemAttributes = g_dat.getItemAttributes(id);
|
||||||
if(itemAttributes.stackable || itemAttributes.group == Otc::ThingFluidGroup || itemAttributes.group == Otc::ThingSplashGroup)
|
if(itemAttributes.isStackable || itemAttributes.isFluidContainer || itemAttributes.isSplash == Otc::ThingSplashGroup)
|
||||||
item->setCount(msg.getU8());
|
item->setCount(msg.getU8());
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
|
Loading…
Reference in New Issue