forked from Mirrorlandia_minetest/minetest
Change TileSpec::frames to be std::vector not std::map
Signed-off-by: Craig Robbins <kde.psych@gmail.com>
This commit is contained in:
parent
0d55f43977
commit
1e8e700ee6
@ -1136,7 +1136,7 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
|
|||||||
m_animation_frame_offsets[i] = 0;
|
m_animation_frame_offsets[i] = 0;
|
||||||
}
|
}
|
||||||
// Replace tile texture with the first animation frame
|
// Replace tile texture with the first animation frame
|
||||||
FrameSpec animation_frame = p.tile.frames.find(0)->second;
|
FrameSpec animation_frame = p.tile.frames[0];
|
||||||
p.tile.texture = animation_frame.texture;
|
p.tile.texture = animation_frame.texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1322,7 +1322,7 @@ bool MapBlockMesh::animate(bool faraway, float time, int crack, u32 daynight_rat
|
|||||||
scene::IMeshBuffer *buf = m_mesh->getMeshBuffer(i->first);
|
scene::IMeshBuffer *buf = m_mesh->getMeshBuffer(i->first);
|
||||||
ITextureSource *tsrc = m_gamedef->getTextureSource();
|
ITextureSource *tsrc = m_gamedef->getTextureSource();
|
||||||
|
|
||||||
FrameSpec animation_frame = tile.frames.find(frame)->second;
|
FrameSpec animation_frame = tile.frames[frame];
|
||||||
buf->getMaterial().setTexture(0, animation_frame.texture);
|
buf->getMaterial().setTexture(0, animation_frame.texture);
|
||||||
if (m_enable_shaders) {
|
if (m_enable_shaders) {
|
||||||
if (animation_frame.normal_texture) {
|
if (animation_frame.normal_texture) {
|
||||||
|
@ -934,7 +934,10 @@ void CNodeDefManager::fillTileAttribs(ITextureSource *tsrc, TileSpec *tile,
|
|||||||
tile->material_flags &= ~MATERIAL_FLAG_ANIMATION_VERTICAL_FRAMES;
|
tile->material_flags &= ~MATERIAL_FLAG_ANIMATION_VERTICAL_FRAMES;
|
||||||
} else {
|
} else {
|
||||||
std::ostringstream os(std::ios::binary);
|
std::ostringstream os(std::ios::binary);
|
||||||
|
tile->frames.resize(frame_count);
|
||||||
|
|
||||||
for (int i = 0; i < frame_count; i++) {
|
for (int i = 0; i < frame_count; i++) {
|
||||||
|
|
||||||
FrameSpec frame;
|
FrameSpec frame;
|
||||||
|
|
||||||
os.str("");
|
os.str("");
|
||||||
|
@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include <IrrlichtDevice.h>
|
#include <IrrlichtDevice.h>
|
||||||
#include "threads.h"
|
#include "threads.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <vector>
|
||||||
|
|
||||||
class IGameDef;
|
class IGameDef;
|
||||||
|
|
||||||
@ -272,7 +272,7 @@ struct TileSpec
|
|||||||
// Animation parameters
|
// Animation parameters
|
||||||
u8 animation_frame_count;
|
u8 animation_frame_count;
|
||||||
u16 animation_frame_length_ms;
|
u16 animation_frame_length_ms;
|
||||||
std::map<u32, FrameSpec> frames;
|
std::vector<FrameSpec> frames;
|
||||||
|
|
||||||
u8 rotation;
|
u8 rotation;
|
||||||
};
|
};
|
||||||
|
@ -252,7 +252,7 @@ void WieldMeshSceneNode::setCube(const TileSpec tiles[6],
|
|||||||
if (tiles[i].animation_frame_count == 1) {
|
if (tiles[i].animation_frame_count == 1) {
|
||||||
material.setTexture(0, tiles[i].texture);
|
material.setTexture(0, tiles[i].texture);
|
||||||
} else {
|
} else {
|
||||||
FrameSpec animation_frame = tiles[i].frames.find(0)->second;
|
FrameSpec animation_frame = tiles[i].frames[0];
|
||||||
material.setTexture(0, animation_frame.texture);
|
material.setTexture(0, animation_frame.texture);
|
||||||
}
|
}
|
||||||
tiles[i].applyMaterialOptions(material);
|
tiles[i].applyMaterialOptions(material);
|
||||||
@ -351,7 +351,7 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, IGameDef *gamedef)
|
|||||||
material.setFlag(video::EMF_TRILINEAR_FILTER, m_trilinear_filter);
|
material.setFlag(video::EMF_TRILINEAR_FILTER, m_trilinear_filter);
|
||||||
bool animated = (f.tiles[i].animation_frame_count > 1);
|
bool animated = (f.tiles[i].animation_frame_count > 1);
|
||||||
if (animated) {
|
if (animated) {
|
||||||
FrameSpec animation_frame = f.tiles[i].frames.find(0)->second;
|
FrameSpec animation_frame = f.tiles[i].frames[0];
|
||||||
material.setTexture(0, animation_frame.texture);
|
material.setTexture(0, animation_frame.texture);
|
||||||
} else {
|
} else {
|
||||||
material.setTexture(0, f.tiles[i].texture);
|
material.setTexture(0, f.tiles[i].texture);
|
||||||
@ -360,7 +360,7 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, IGameDef *gamedef)
|
|||||||
if (m_enable_shaders) {
|
if (m_enable_shaders) {
|
||||||
if (f.tiles[i].normal_texture) {
|
if (f.tiles[i].normal_texture) {
|
||||||
if (animated) {
|
if (animated) {
|
||||||
FrameSpec animation_frame = f.tiles[i].frames.find(0)->second;
|
FrameSpec animation_frame = f.tiles[i].frames[0];
|
||||||
material.setTexture(1, animation_frame.normal_texture);
|
material.setTexture(1, animation_frame.normal_texture);
|
||||||
} else {
|
} else {
|
||||||
material.setTexture(1, f.tiles[i].normal_texture);
|
material.setTexture(1, f.tiles[i].normal_texture);
|
||||||
|
Loading…
Reference in New Issue
Block a user