mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-10 03:25:07 -05:00
09432ee7f4
* Initial Linux/GCC support commit * Add instructins for linux in the README * apply suggestions by @Erotemic and @Emill * Fix python 3.10 symlink line * Fix func_80041E80 type mismatch (#3) Type mismatch functions.h:664 * Makefile: clean OTRExporter/libultraship/ZAPDTR with distclean and fix CXX_FILES * Makefile: find C/CXX_FILES automatically * Makefile: remove ugly conditions in find commands * cleanup _MSC_VER usage * fix Windows build * cleanup extraction scripts * fix Windows build * Fix Windows path separator issue * fix rumble support for linux * use glew-cmake in dockerfile * add pulseaudio backend * fix ZAPDTR linkage * Check for "soh.elf" in directory (#6) hide second button if `soh.exe` or `soh.elf` is present * Fix hardcoded segment addresses (#5) * fix condition * hack lus -> soh dep for ZAPDTR Co-authored-by: sholdee <102821812+sholdee@users.noreply.github.com> Co-authored-by: qurious-pixel <62252937+qurious-pixel@users.noreply.github.com> Co-authored-by: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com>
64 lines
1.3 KiB
C++
64 lines
1.3 KiB
C++
#include "Array.h"
|
|
#include "Vertex.h"
|
|
|
|
namespace Ship
|
|
{
|
|
void ArrayV0::ParseFileBinary(BinaryReader* reader, Resource* res)
|
|
{
|
|
Array* arr = (Array*)res;
|
|
|
|
ResourceFile::ParseFileBinary(reader, res);
|
|
|
|
ZResourceType resType = (ZResourceType)reader->ReadUInt32();
|
|
uint32_t arrayCnt = reader->ReadUInt32();
|
|
|
|
for (uint32_t i = 0; i < arrayCnt; i++)
|
|
{
|
|
if (resType == ZResourceType::Vertex)
|
|
{
|
|
Vtx data;
|
|
data.x = reader->ReadInt16();
|
|
data.y = reader->ReadInt16();
|
|
data.z = reader->ReadInt16();
|
|
data.flag = reader->ReadUInt16();
|
|
data.s = reader->ReadInt16();
|
|
data.t = reader->ReadInt16();
|
|
data.r = reader->ReadUByte();
|
|
data.g = reader->ReadUByte();
|
|
data.b = reader->ReadUByte();
|
|
data.a = reader->ReadUByte();
|
|
arr->vertices.push_back(data);
|
|
}
|
|
else
|
|
{
|
|
ScalarType scalType = (ScalarType)reader->ReadUInt32();
|
|
|
|
int iter = 1;
|
|
|
|
if (resType == ZResourceType::Vector)
|
|
iter = reader->ReadUInt32();
|
|
|
|
for (int k = 0; k < iter; k++)
|
|
{
|
|
ScalarData data;
|
|
|
|
switch (scalType)
|
|
{
|
|
case ScalarType::ZSCALAR_S16:
|
|
data.s16 = reader->ReadInt16();
|
|
break;
|
|
case ScalarType::ZSCALAR_U16:
|
|
data.u16 = reader->ReadUInt16();
|
|
break;
|
|
// OTRTODO: IMPLEMENT OTHER TYPES!
|
|
default:
|
|
break;
|
|
}
|
|
|
|
arr->scalars.push_back(data);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|