mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-02 09:47:58 +03:00
Implemented new anim textures in file format
This commit is contained in:
parent
98803594fc
commit
231b1f77aa
2 changed files with 70 additions and 2 deletions
|
@ -452,6 +452,30 @@ void LoadTextures()
|
||||||
g_Level.StaticsTextures.push_back(texture);
|
g_Level.StaticsTextures.push_back(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
numTextures = ReadInt32();
|
||||||
|
g_Level.AnimatedTextures.reserve(numTextures);
|
||||||
|
for (int i = 0; i < numTextures; i++)
|
||||||
|
{
|
||||||
|
TEXTURE texture;
|
||||||
|
|
||||||
|
texture.width = ReadInt32();
|
||||||
|
texture.height = ReadInt32();
|
||||||
|
|
||||||
|
size = ReadInt32();
|
||||||
|
texture.colorMapData.resize(size);
|
||||||
|
ReadBytes(texture.colorMapData.data(), size);
|
||||||
|
|
||||||
|
bool hasNormalMap = ReadInt8();
|
||||||
|
if (hasNormalMap)
|
||||||
|
{
|
||||||
|
size = ReadInt32();
|
||||||
|
texture.normalMapData.resize(size);
|
||||||
|
ReadBytes(texture.normalMapData.data(), size);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_Level.AnimatedTextures.push_back(texture);
|
||||||
|
}
|
||||||
|
|
||||||
numTextures = ReadInt32();
|
numTextures = ReadInt32();
|
||||||
g_Level.SpritesTextures.reserve(numTextures);
|
g_Level.SpritesTextures.reserve(numTextures);
|
||||||
for (int i = 0; i < numTextures; i++)
|
for (int i = 0; i < numTextures; i++)
|
||||||
|
@ -690,7 +714,9 @@ void FreeLevel()
|
||||||
g_Level.RoomTextures.clear();
|
g_Level.RoomTextures.clear();
|
||||||
g_Level.MoveablesTextures.clear();
|
g_Level.MoveablesTextures.clear();
|
||||||
g_Level.StaticsTextures.clear();
|
g_Level.StaticsTextures.clear();
|
||||||
|
g_Level.AnimatedTextures.clear();
|
||||||
g_Level.SpritesTextures.clear();
|
g_Level.SpritesTextures.clear();
|
||||||
|
g_Level.AnimatedTexturesSequences.clear();
|
||||||
g_Level.Rooms.clear();
|
g_Level.Rooms.clear();
|
||||||
g_Level.ObjectTextures.clear();
|
g_Level.ObjectTextures.clear();
|
||||||
g_Level.Bones.clear();
|
g_Level.Bones.clear();
|
||||||
|
@ -740,8 +766,29 @@ void LoadAnimatedTextures()
|
||||||
{
|
{
|
||||||
NumAnimatedTextures = ReadInt32();
|
NumAnimatedTextures = ReadInt32();
|
||||||
|
|
||||||
AnimTextureRanges = game_malloc<short>(NumAnimatedTextures);
|
/*AnimTextureRanges = game_malloc<short>(NumAnimatedTextures);
|
||||||
ReadBytes(AnimTextureRanges, NumAnimatedTextures * sizeof(short));
|
ReadBytes(AnimTextureRanges, NumAnimatedTextures * sizeof(short));*/
|
||||||
|
|
||||||
|
for (int i = 0; i < NumAnimatedTextures; i++)
|
||||||
|
{
|
||||||
|
ANIMATED_TEXTURES_SEQUENCE sequence;
|
||||||
|
sequence.atlas = ReadInt32();
|
||||||
|
sequence.numFrames = ReadInt32();
|
||||||
|
for (int j = 0; j < sequence.numFrames; j++)
|
||||||
|
{
|
||||||
|
ANIMATED_TEXTURES_FRAME frame;
|
||||||
|
frame.x1 = ReadFloat();
|
||||||
|
frame.y1 = ReadFloat();
|
||||||
|
frame.x2 = ReadFloat();
|
||||||
|
frame.y2 = ReadFloat();
|
||||||
|
frame.x3 = ReadFloat();
|
||||||
|
frame.y3 = ReadFloat();
|
||||||
|
frame.x4 = ReadFloat();
|
||||||
|
frame.y4 = ReadFloat();
|
||||||
|
sequence.frames.push_back(frame);
|
||||||
|
}
|
||||||
|
g_Level.AnimatedTexturesSequences.push_back(sequence);
|
||||||
|
}
|
||||||
|
|
||||||
nAnimUVRanges = ReadInt8();
|
nAnimUVRanges = ReadInt8();
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,25 @@ struct TEXTURE
|
||||||
std::vector<byte> normalMapData;
|
std::vector<byte> normalMapData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ANIMATED_TEXTURES_FRAME
|
||||||
|
{
|
||||||
|
float x1;
|
||||||
|
float y1;
|
||||||
|
float x2;
|
||||||
|
float y2;
|
||||||
|
float x3;
|
||||||
|
float y3;
|
||||||
|
float x4;
|
||||||
|
float y4;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ANIMATED_TEXTURES_SEQUENCE
|
||||||
|
{
|
||||||
|
int atlas;
|
||||||
|
int numFrames;
|
||||||
|
std::vector<ANIMATED_TEXTURES_FRAME> frames;
|
||||||
|
};
|
||||||
|
|
||||||
struct AIOBJECT
|
struct AIOBJECT
|
||||||
{
|
{
|
||||||
short objectNumber;
|
short objectNumber;
|
||||||
|
@ -117,6 +136,7 @@ struct LEVEL
|
||||||
std::vector<TEXTURE> RoomTextures;
|
std::vector<TEXTURE> RoomTextures;
|
||||||
std::vector<TEXTURE> MoveablesTextures;
|
std::vector<TEXTURE> MoveablesTextures;
|
||||||
std::vector<TEXTURE> StaticsTextures;
|
std::vector<TEXTURE> StaticsTextures;
|
||||||
|
std::vector<TEXTURE> AnimatedTextures;
|
||||||
std::vector<TEXTURE> SpritesTextures;
|
std::vector<TEXTURE> SpritesTextures;
|
||||||
TEXTURE MiscTextures;
|
TEXTURE MiscTextures;
|
||||||
std::vector<ROOM_INFO> Rooms;
|
std::vector<ROOM_INFO> Rooms;
|
||||||
|
@ -137,6 +157,7 @@ struct LEVEL
|
||||||
std::vector<int> Zones[MAX_ZONES][2];
|
std::vector<int> Zones[MAX_ZONES][2];
|
||||||
std::vector<short> SoundMap;
|
std::vector<short> SoundMap;
|
||||||
std::vector<SAMPLE_INFO> SoundDetails;
|
std::vector<SAMPLE_INFO> SoundDetails;
|
||||||
|
std::vector<ANIMATED_TEXTURES_SEQUENCE> AnimatedTexturesSequences;
|
||||||
int NumItems;
|
int NumItems;
|
||||||
int NumSpritesSequences;
|
int NumSpritesSequences;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue