mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-10 23:08:05 -05:00
Finish iw3 zone code generation
This commit is contained in:
@ -0,0 +1,31 @@
|
||||
#include "gfximage_actions.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
using namespace IW3;
|
||||
|
||||
Actions_GfxImage::Actions_GfxImage(Zone* zone)
|
||||
: AssetLoadingActions(zone)
|
||||
{
|
||||
}
|
||||
|
||||
void Actions_GfxImage::OnImageLoaded(GfxImage* image) const
|
||||
{
|
||||
image->cardMemory.platform[0] = 0;
|
||||
}
|
||||
|
||||
void Actions_GfxImage::LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const
|
||||
{
|
||||
if (loadDef->resourceSize > 0)
|
||||
{
|
||||
const size_t loadDefSize = offsetof(IW3::GfxImageLoadDef, data) + loadDef->resourceSize;
|
||||
|
||||
image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone->GetMemory()->Alloc(loadDefSize));
|
||||
memcpy(image->texture.loadDef, loadDef, loadDefSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
image->texture.loadDef = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "Loading/AssetLoadingActions.h"
|
||||
#include "Game/IW3/IW3.h"
|
||||
|
||||
namespace IW3
|
||||
{
|
||||
class Actions_GfxImage final : public AssetLoadingActions
|
||||
{
|
||||
public:
|
||||
explicit Actions_GfxImage(Zone* zone);
|
||||
|
||||
void OnImageLoaded(GfxImage* image) const;
|
||||
void LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const;
|
||||
};
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
#include "loadedsound_actions.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace IW3;
|
||||
|
||||
Actions_LoadedSound::Actions_LoadedSound(Zone* zone)
|
||||
: AssetLoadingActions(zone)
|
||||
{
|
||||
}
|
||||
|
||||
void Actions_LoadedSound::SetSoundData(MssSound* sound) const
|
||||
{
|
||||
if (sound->info.data_len > 0)
|
||||
{
|
||||
char* tempData = sound->data;
|
||||
sound->data = static_cast<char*>(m_zone->GetMemory()->Alloc(sound->info.data_len));
|
||||
memcpy(sound->data, tempData, sound->info.data_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
sound->data = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "Loading/AssetLoadingActions.h"
|
||||
#include "Game/IW3/IW3.h"
|
||||
|
||||
namespace IW3
|
||||
{
|
||||
class Actions_LoadedSound final : public AssetLoadingActions
|
||||
{
|
||||
public:
|
||||
explicit Actions_LoadedSound(Zone* zone);
|
||||
|
||||
void SetSoundData(MssSound* sound) const;
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user