mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
Implement misc.lib (#483)
* Implement misc.lib * Lowercase files * Minor changes * Fix file cases * Fixes * Fix missing dtor * Add override * Match LegoImage::Read * Fix delete call --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
176
LEGO1/lego/sources/misc/legoimage.cpp
Normal file
176
LEGO1/lego/sources/misc/legoimage.cpp
Normal file
@@ -0,0 +1,176 @@
|
||||
#include "legoimage.h"
|
||||
|
||||
#include "decomp.h"
|
||||
#include "legostorage.h"
|
||||
#include "memory.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoPaletteEntry, 0x3);
|
||||
DECOMP_SIZE_ASSERT(LegoImage, 0x310);
|
||||
|
||||
// FUNCTION: LEGO1 0x100994c0
|
||||
LegoPaletteEntry::LegoPaletteEntry()
|
||||
{
|
||||
m_red = 0;
|
||||
m_green = 0;
|
||||
m_blue = 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100994d0
|
||||
LegoResult LegoPaletteEntry::Read(LegoStorage* p_storage)
|
||||
{
|
||||
LegoResult result;
|
||||
if ((result = p_storage->Read(&m_red, sizeof(m_red))) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
if ((result = p_storage->Read(&m_green, sizeof(m_green))) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
if ((result = p_storage->Read(&m_blue, sizeof(m_blue))) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099520
|
||||
LegoResult LegoPaletteEntry::Write(LegoStorage* p_storage)
|
||||
{
|
||||
LegoResult result;
|
||||
if ((result = p_storage->Write(&m_red, sizeof(m_red))) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
if ((result = p_storage->Write(&m_green, sizeof(m_green))) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
if ((result = p_storage->Write(&m_blue, sizeof(m_blue))) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099570
|
||||
LegoImage::LegoImage()
|
||||
{
|
||||
m_width = 0;
|
||||
m_height = 0;
|
||||
m_count = 0;
|
||||
m_bits = NULL;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100995a0
|
||||
LegoImage::LegoImage(LegoU32 p_width, LegoU32 p_height)
|
||||
{
|
||||
m_width = p_width;
|
||||
m_height = p_height;
|
||||
m_count = 0;
|
||||
m_bits = new LegoU8[m_width * m_height];
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100995f0
|
||||
LegoImage::~LegoImage()
|
||||
{
|
||||
if (m_bits) {
|
||||
delete[] m_bits;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099610
|
||||
LegoResult LegoImage::Read(LegoStorage* p_storage, LegoU32 p_square)
|
||||
{
|
||||
LegoResult result;
|
||||
if ((result = p_storage->Read(&m_width, sizeof(m_width))) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
if ((result = p_storage->Read(&m_height, sizeof(m_height))) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
if ((result = p_storage->Read(&m_count, sizeof(m_height))) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
for (LegoU32 i = 0; i < m_count; i++) {
|
||||
if ((result = m_palette[i].Read(p_storage)) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (m_bits) {
|
||||
delete[] m_bits;
|
||||
}
|
||||
m_bits = new LegoU8[m_width * m_height];
|
||||
if ((result = p_storage->Read(m_bits, m_width * m_height)) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (p_square && m_width != m_height) {
|
||||
LegoU8* newBits;
|
||||
|
||||
if (m_height < m_width) {
|
||||
LegoU32 aspect = m_width / m_height;
|
||||
newBits = new LegoU8[m_width * m_width];
|
||||
LegoU8* src = m_bits;
|
||||
LegoU8* dst = newBits;
|
||||
|
||||
for (LegoU32 row = 0; row < m_height; row++) {
|
||||
if (aspect) {
|
||||
for (LegoU32 dup = aspect; dup; dup--) {
|
||||
memcpy(dst, src, m_width);
|
||||
dst += m_width;
|
||||
}
|
||||
}
|
||||
src += m_width;
|
||||
}
|
||||
|
||||
m_height = m_width;
|
||||
}
|
||||
else {
|
||||
LegoU32 aspect = m_height / m_width;
|
||||
newBits = new LegoU8[m_height * m_height];
|
||||
LegoU8* src = m_bits;
|
||||
LegoU8* dst = newBits;
|
||||
|
||||
for (LegoU32 row = 0; row < m_height; row++) {
|
||||
for (LegoU32 col = 0; col < m_width; col++) {
|
||||
if (aspect) {
|
||||
for (LegoU32 dup = aspect; dup; dup--) {
|
||||
*dst = *src;
|
||||
dst++;
|
||||
}
|
||||
}
|
||||
|
||||
src++;
|
||||
}
|
||||
}
|
||||
|
||||
m_width = m_height;
|
||||
}
|
||||
|
||||
delete[] m_bits;
|
||||
m_bits = newBits;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100997e0
|
||||
LegoResult LegoImage::Write(LegoStorage* p_storage)
|
||||
{
|
||||
LegoResult result;
|
||||
if ((result = p_storage->Write(&m_width, sizeof(m_width))) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
if ((result = p_storage->Write(&m_height, sizeof(m_height))) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
if ((result = p_storage->Write(&m_count, sizeof(m_height))) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
for (LegoU32 i = 0; i < m_count; i++) {
|
||||
if ((result = m_palette[i].Write(p_storage)) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (m_bits) {
|
||||
if ((result = p_storage->Write(m_bits, m_width * m_height)) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
54
LEGO1/lego/sources/misc/legoimage.h
Normal file
54
LEGO1/lego/sources/misc/legoimage.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#ifndef __LEGOIMAGE_H
|
||||
#define __LEGOIMAGE_H
|
||||
|
||||
#include "legotypes.h"
|
||||
|
||||
class LegoStorage;
|
||||
|
||||
// SIZE 0x3
|
||||
class LegoPaletteEntry {
|
||||
public:
|
||||
LegoPaletteEntry();
|
||||
// LegoPaletteEntry(LegoU8 p_red, LegoU8 p_green, LegoU8 p_blue);
|
||||
LegoU8 GetRed() { return m_red; }
|
||||
void SetRed(LegoU8 p_red) { m_red = p_red; }
|
||||
LegoU8 GetGreen() { return m_green; }
|
||||
void SetGreen(LegoU8 p_green) { m_green = p_green; }
|
||||
LegoU8 GetBlue() { return m_blue; }
|
||||
void SetBlue(LegoU8 p_blue) { m_blue = p_blue; }
|
||||
LegoResult Read(LegoStorage* p_storage);
|
||||
LegoResult Write(LegoStorage* p_storage);
|
||||
|
||||
protected:
|
||||
LegoU8 m_red; // 0x00
|
||||
LegoU8 m_green; // 0x01
|
||||
LegoU8 m_blue; // 0x02
|
||||
};
|
||||
|
||||
// 0x310
|
||||
class LegoImage {
|
||||
public:
|
||||
LegoImage();
|
||||
LegoImage(LegoU32 p_width, LegoU32 p_height);
|
||||
~LegoImage();
|
||||
LegoU32 GetWidth() { return m_width; }
|
||||
void SetWidth(LegoU32 p_width) { m_width = p_width; }
|
||||
LegoU32 GetHeight() { return m_height; }
|
||||
void SetHeight(LegoU32 p_height) { m_height = p_height; }
|
||||
LegoPaletteEntry* GetPalette() { return m_palette; }
|
||||
LegoPaletteEntry& GetPaletteEntry(LegoU32 p_i) { return m_palette[p_i]; }
|
||||
void SetPaletteEntry(LegoU32 p_i, LegoPaletteEntry& p_paletteEntry) { m_palette[p_i] = p_paletteEntry; }
|
||||
LegoU8* GetBits() { return m_bits; }
|
||||
void SetBits(LegoU8* p_bits) { m_bits = p_bits; }
|
||||
LegoResult Read(LegoStorage* p_storage, LegoU32 p_square);
|
||||
LegoResult Write(LegoStorage* p_storage);
|
||||
|
||||
protected:
|
||||
LegoU32 m_width; // 0x00
|
||||
LegoU32 m_height; // 0x04
|
||||
LegoU32 m_count; // 0x08
|
||||
LegoPaletteEntry m_palette[256]; // 0x0c
|
||||
LegoU8* m_bits; // 0x30c
|
||||
};
|
||||
|
||||
#endif // __LEGOIMAGE_H
|
139
LEGO1/lego/sources/misc/legostorage.cpp
Normal file
139
LEGO1/lego/sources/misc/legostorage.cpp
Normal file
@@ -0,0 +1,139 @@
|
||||
#include "legostorage.h"
|
||||
|
||||
#include "decomp.h"
|
||||
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoStorage, 0x8);
|
||||
DECOMP_SIZE_ASSERT(LegoMemory, 0x10);
|
||||
DECOMP_SIZE_ASSERT(LegoFile, 0xc);
|
||||
|
||||
// FUNCTION: LEGO1 0x10099080
|
||||
LegoMemory::LegoMemory(void* p_buffer) : LegoStorage()
|
||||
{
|
||||
m_buffer = (LegoU8*) p_buffer;
|
||||
m_position = 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099160
|
||||
LegoResult LegoMemory::Read(void* p_buffer, LegoU32 p_size)
|
||||
{
|
||||
memcpy(p_buffer, m_buffer + m_position, p_size);
|
||||
m_position += p_size;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099190
|
||||
LegoResult LegoMemory::Write(const void* p_buffer, LegoU32 p_size)
|
||||
{
|
||||
memcpy(m_buffer + m_position, p_buffer, p_size);
|
||||
m_position += p_size;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100991c0
|
||||
LegoFile::LegoFile()
|
||||
{
|
||||
m_file = NULL;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099250
|
||||
LegoFile::~LegoFile()
|
||||
{
|
||||
if (m_file) {
|
||||
fclose(m_file);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100992c0
|
||||
LegoResult LegoFile::Read(void* p_buffer, LegoU32 p_size)
|
||||
{
|
||||
if (!m_file) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (fread(p_buffer, 1, p_size, m_file) != p_size) {
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099300
|
||||
LegoResult LegoFile::Write(const void* p_buffer, LegoU32 p_size)
|
||||
{
|
||||
if (!m_file) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (fwrite(p_buffer, 1, p_size, m_file) != p_size) {
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099340
|
||||
LegoResult LegoFile::GetPosition(LegoU32& p_position)
|
||||
{
|
||||
if (!m_file) {
|
||||
return FAILURE;
|
||||
}
|
||||
LegoU32 position = ftell(m_file);
|
||||
if (position == -1) {
|
||||
return FAILURE;
|
||||
}
|
||||
p_position = position;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099370
|
||||
LegoResult LegoFile::SetPosition(LegoU32 p_position)
|
||||
{
|
||||
if (!m_file) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (fseek(m_file, p_position, SEEK_SET) != 0) {
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100993a0
|
||||
LegoResult LegoFile::Open(const char* p_name, LegoU32 p_mode)
|
||||
{
|
||||
if (m_file) {
|
||||
fclose(m_file);
|
||||
}
|
||||
char mode[4];
|
||||
mode[0] = '\0';
|
||||
if (p_mode & c_read) {
|
||||
m_mode = c_read;
|
||||
strcat(mode, "r");
|
||||
}
|
||||
if (p_mode & c_write) {
|
||||
if (m_mode != c_read)
|
||||
m_mode = c_write;
|
||||
strcat(mode, "w");
|
||||
}
|
||||
if ((p_mode & c_text) != 0)
|
||||
strcat(mode, "t");
|
||||
else
|
||||
strcat(mode, "b");
|
||||
|
||||
if (!(m_file = fopen(p_name, mode))) {
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100994a0
|
||||
LegoResult LegoMemory::GetPosition(LegoU32& p_position)
|
||||
{
|
||||
p_position = m_position;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100994b0
|
||||
LegoResult LegoMemory::SetPosition(LegoU32 p_position)
|
||||
{
|
||||
m_position = p_position;
|
||||
return SUCCESS;
|
||||
}
|
95
LEGO1/lego/sources/misc/legostorage.h
Normal file
95
LEGO1/lego/sources/misc/legostorage.h
Normal file
@@ -0,0 +1,95 @@
|
||||
#ifndef __LEGOSTORAGE_H
|
||||
#define __LEGOSTORAGE_H
|
||||
|
||||
#include "legotypes.h"
|
||||
#include "mxstring.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
// VTABLE: LEGO1 0x100d7d80
|
||||
// SIZE 0x08
|
||||
class LegoStorage {
|
||||
public:
|
||||
enum OpenFlags {
|
||||
c_read = 1,
|
||||
c_write = 2,
|
||||
c_text = 4
|
||||
};
|
||||
|
||||
LegoStorage() : m_mode(0) {}
|
||||
|
||||
// FUNCTION: LEGO1 0x10045ad0
|
||||
virtual ~LegoStorage(){};
|
||||
|
||||
virtual LegoResult Read(void* p_buffer, LegoU32 p_size) = 0;
|
||||
virtual LegoResult Write(const void* p_buffer, LegoU32 p_size) = 0;
|
||||
virtual LegoResult GetPosition(LegoU32& p_position) = 0;
|
||||
virtual LegoResult SetPosition(LegoU32 p_position) = 0;
|
||||
|
||||
// FUNCTION: LEGO1 0x10045ae0
|
||||
virtual LegoBool IsWriteMode() { return m_mode == c_write; }
|
||||
|
||||
// FUNCTION: LEGO1 0x10045af0
|
||||
virtual LegoBool IsReadMode() { return m_mode == c_read; }
|
||||
|
||||
// SYNTHETIC: LEGO1 0x10045b00
|
||||
// LegoStorage::`scalar deleting destructor'
|
||||
|
||||
protected:
|
||||
LegoU8 m_mode; // 0x04
|
||||
};
|
||||
|
||||
// VTABLE: LEGO1 0x100db710
|
||||
// SIZE 0x10
|
||||
class LegoMemory : public LegoStorage {
|
||||
public:
|
||||
LegoMemory(void* p_buffer);
|
||||
virtual LegoResult Read(void* p_buffer, LegoU32 p_size);
|
||||
virtual LegoResult Write(const void* p_buffer, LegoU32 p_size);
|
||||
virtual LegoResult GetPosition(LegoU32& p_position);
|
||||
virtual LegoResult SetPosition(LegoU32 p_position);
|
||||
|
||||
// SYNTHETIC: LEGO1 0x10045a80
|
||||
// LegoMemory::~LegoMemory
|
||||
|
||||
// SYNTHETIC: LEGO1 0x100990f0
|
||||
// LegoMemory::`scalar deleting destructor'
|
||||
|
||||
protected:
|
||||
LegoU8* m_buffer; // 0x04
|
||||
LegoU32 m_position; // 0x08
|
||||
};
|
||||
|
||||
// VTABLE: LEGO1 0x100db730
|
||||
// SIZE 0x0c
|
||||
class LegoFile : public LegoStorage {
|
||||
public:
|
||||
LegoFile();
|
||||
virtual ~LegoFile() override;
|
||||
virtual LegoResult Read(void* p_buffer, LegoU32 p_size);
|
||||
virtual LegoResult Write(const void* p_buffer, LegoU32 p_size);
|
||||
virtual LegoResult GetPosition(LegoU32& p_position);
|
||||
virtual LegoResult SetPosition(LegoU32 p_position);
|
||||
LegoResult Open(const char* p_name, LegoU32 p_mode);
|
||||
|
||||
// FUNCTION: LEGO1 0x10006030
|
||||
LegoStorage* FUN_10006030(MxString p_str)
|
||||
{
|
||||
const char* data = p_str.GetData();
|
||||
LegoU32 fullLength = strlen(data);
|
||||
|
||||
LegoU16 limitedLength = fullLength;
|
||||
Write(&limitedLength, sizeof(limitedLength));
|
||||
Write((char*) data, (LegoS16) fullLength);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
// SYNTHETIC: LEGO1 0x10099230
|
||||
// LegoFile::`scalar deleting destructor'
|
||||
|
||||
protected:
|
||||
FILE* m_file; // 0x08
|
||||
};
|
||||
|
||||
#endif // __LEGOSTORAGE_H
|
31
LEGO1/lego/sources/misc/legotexture.cpp
Normal file
31
LEGO1/lego/sources/misc/legotexture.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "legotexture.h"
|
||||
|
||||
#include "decomp.h"
|
||||
#include "legoimage.h"
|
||||
#include "legostorage.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoTexture, 0x4);
|
||||
|
||||
// FUNCTION: LEGO1 0x10098fb0
|
||||
LegoTexture::LegoTexture()
|
||||
{
|
||||
m_image = new LegoImage();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099030
|
||||
LegoTexture::~LegoTexture()
|
||||
{
|
||||
delete m_image;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099050
|
||||
LegoResult LegoTexture::Read(LegoStorage* p_storage, LegoU32 p_square)
|
||||
{
|
||||
return m_image->Read(p_storage, p_square);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099070
|
||||
LegoResult LegoTexture::Write(LegoStorage* p_storage)
|
||||
{
|
||||
return m_image->Write(p_storage);
|
||||
}
|
23
LEGO1/lego/sources/misc/legotexture.h
Normal file
23
LEGO1/lego/sources/misc/legotexture.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef __LEGOTEXTURE_H
|
||||
#define __LEGOTEXTURE_H
|
||||
|
||||
#include "legotypes.h"
|
||||
|
||||
class LegoImage;
|
||||
class LegoStorage;
|
||||
|
||||
// SIZE 0x04
|
||||
class LegoTexture {
|
||||
public:
|
||||
LegoTexture();
|
||||
~LegoTexture();
|
||||
LegoImage* GetImage() { return m_image; }
|
||||
void SetImage(LegoImage* p_image) { m_image = p_image; }
|
||||
LegoResult Read(LegoStorage* p_storage, LegoU32 p_square);
|
||||
LegoResult Write(LegoStorage* p_storage);
|
||||
|
||||
protected:
|
||||
LegoImage* m_image; // 0x00
|
||||
};
|
||||
|
||||
#endif // __LEGOTEXTURE_H
|
44
LEGO1/lego/sources/misc/legotypes.h
Normal file
44
LEGO1/lego/sources/misc/legotypes.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
This unpublished source code contains trade secrets and
|
||||
copyrighted materials which are the property of Mindscape, Inc.
|
||||
Unauthorized use, copying or distribution is a violation of U.S.
|
||||
and international laws and is strictly prohibited.
|
||||
*/
|
||||
|
||||
#ifndef __LEGOTYPES_H
|
||||
#define __LEGOTYPES_H
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#ifndef SUCCESS
|
||||
#define SUCCESS 0
|
||||
#endif
|
||||
|
||||
#ifndef FAILURE
|
||||
#define FAILURE -1
|
||||
#endif
|
||||
|
||||
typedef char LegoS8;
|
||||
typedef unsigned char LegoU8;
|
||||
typedef short LegoS16;
|
||||
typedef unsigned short LegoU16;
|
||||
typedef long LegoS32;
|
||||
typedef unsigned long LegoU32;
|
||||
typedef float LegoFloat;
|
||||
typedef char LegoChar;
|
||||
|
||||
typedef LegoU8 LegoBool;
|
||||
typedef LegoS32 LegoTime;
|
||||
typedef LegoS32 LegoResult;
|
||||
|
||||
#endif // __LEGOTYPES_H
|
54
LEGO1/lego/sources/misc/legoutil.h
Normal file
54
LEGO1/lego/sources/misc/legoutil.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#ifndef __LEGOUTIL_H
|
||||
#define __LEGOUTIL_H
|
||||
|
||||
template <class T>
|
||||
inline T Min(T p_t1, T p_t2)
|
||||
{
|
||||
return p_t1 < p_t2 ? p_t1 : p_t2;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T Min(T p_t1, T p_t2, T p_t3)
|
||||
{
|
||||
return Min(p_t1, Min(p_t2, p_t3));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T Max(T p_t1, T p_t2)
|
||||
{
|
||||
return p_t1 > p_t2 ? p_t1 : p_t2;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T Max(T p_t1, T p_t2, T p_t3)
|
||||
{
|
||||
return Max(p_t1, Max(p_t2, p_t3));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T Abs(T p_t)
|
||||
{
|
||||
return p_t < 0 ? -p_t : p_t;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void Swap(T& p_t1, T& p_t2)
|
||||
{
|
||||
T t = p_t1;
|
||||
p_t1 = p_t2;
|
||||
p_t2 = t;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T DToR(T p_d)
|
||||
{
|
||||
return p_d * 3.1416F / 180.0F;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T RToD(T p_r)
|
||||
{
|
||||
return p_r * 180.0F / 3.1416F;
|
||||
}
|
||||
|
||||
#endif // __LEGOUTIL_H
|
6
LEGO1/lego/sources/misc/version.h
Normal file
6
LEGO1/lego/sources/misc/version.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef __VERSION_H
|
||||
#define __VERSION_H
|
||||
|
||||
#define MODEL_VERSION 3
|
||||
|
||||
#endif // __VERSION_H
|
Reference in New Issue
Block a user