2011-06-16 15:53:39 -06:00
|
|
|
/*
|
|
|
|
https://github.com/peterix/dfhack
|
|
|
|
Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com)
|
|
|
|
|
|
|
|
This software is provided 'as-is', without any express or implied
|
|
|
|
warranty. In no event will the authors be held liable for any
|
|
|
|
damages arising from the use of this software.
|
|
|
|
|
|
|
|
Permission is granted to anyone to use this software for any
|
|
|
|
purpose, including commercial applications, and to alter it and
|
|
|
|
redistribute it freely, subject to the following restrictions:
|
|
|
|
|
|
|
|
1. The origin of this software must not be misrepresented; you must
|
|
|
|
not claim that you wrote the original software. If you use this
|
|
|
|
software in a product, an acknowledgment in the product documentation
|
|
|
|
would be appreciated but is not required.
|
|
|
|
|
|
|
|
2. Altered source versions must be plainly marked as such, and
|
|
|
|
must not be misrepresented as being the original software.
|
|
|
|
|
|
|
|
3. This notice may not be removed or altered from any source
|
|
|
|
distribution.
|
|
|
|
*/
|
|
|
|
|
2011-04-10 05:12:28 -06:00
|
|
|
#pragma once
|
2011-04-02 16:15:47 -06:00
|
|
|
#ifndef CL_MOD_ENGRAVINGS
|
|
|
|
#define CL_MOD_ENGRAVINGS
|
|
|
|
/*
|
|
|
|
* DF engravings
|
|
|
|
*/
|
2011-12-31 04:48:42 -07:00
|
|
|
#include "Export.h"
|
|
|
|
#include "Module.h"
|
2011-04-02 16:15:47 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \defgroup grp_engraving Engraving module parts
|
|
|
|
* @ingroup grp_modules
|
|
|
|
*/
|
|
|
|
namespace DFHack
|
|
|
|
{
|
2011-04-02 19:19:34 -06:00
|
|
|
/**
|
|
|
|
* engraving flags
|
|
|
|
* \ingroup grp_engraving
|
|
|
|
*/
|
|
|
|
struct flg_engraving
|
|
|
|
{
|
2011-04-04 03:57:09 -06:00
|
|
|
// there are 9 directions an engraving can have.
|
|
|
|
// unfortunately, a tile can't be engraved from more than one direction by the game
|
|
|
|
unsigned int floor : 1; // engraved on a floor 0x1
|
|
|
|
unsigned int west : 1; // engraved from west 0x2
|
|
|
|
unsigned int east : 1; // engraved from east 0x4
|
|
|
|
unsigned int north : 1; // engraved from north 0x8
|
|
|
|
unsigned int south : 1; // engraved from south 0x10
|
|
|
|
unsigned int hidden : 1; // hide the engraving 0x20
|
|
|
|
unsigned int northwest : 1; // engraved from... 0x40
|
|
|
|
unsigned int northeast : 1; // engraved from... 0x80
|
|
|
|
unsigned int southwest : 1; // engraved from... 0x100
|
|
|
|
unsigned int southeast : 1; // engraved from... 0x200
|
|
|
|
unsigned int rest : 22; // probably unused
|
2011-04-02 19:19:34 -06:00
|
|
|
};
|
|
|
|
|
2011-04-02 16:15:47 -06:00
|
|
|
/**
|
|
|
|
* type the engraving is made of
|
|
|
|
* \ingroup grp_engraving
|
|
|
|
*/
|
|
|
|
struct t_engraving
|
|
|
|
{
|
|
|
|
//0
|
|
|
|
int32_t artistIdx; /*!< Index of the artist in some global vector */
|
|
|
|
// 4
|
2011-04-02 19:19:34 -06:00
|
|
|
int32_t unknownIdx; // likes to stay -1
|
2011-04-02 16:15:47 -06:00
|
|
|
// 8
|
2011-04-02 19:19:34 -06:00
|
|
|
uint32_t unknown1; // likes to stay 1
|
2011-04-02 16:15:47 -06:00
|
|
|
// C
|
|
|
|
uint16_t x; /*!< X coordinate */
|
|
|
|
uint16_t y; /*!< Y coordinate */
|
|
|
|
// 10
|
|
|
|
uint16_t z; /*!< Z coordinate */
|
|
|
|
uint16_t padding; /*!< Could be used for hiding values. */
|
|
|
|
// 14
|
2011-04-02 19:19:34 -06:00
|
|
|
flg_engraving flags; // 0x20 = hide symbol
|
2011-04-02 16:15:47 -06:00
|
|
|
// 18
|
2011-04-02 19:25:12 -06:00
|
|
|
uint8_t display_character; // really? 4 bytes for that?
|
|
|
|
uint8_t padding2[3];
|
2011-04-02 16:15:47 -06:00
|
|
|
// 1C
|
|
|
|
uint32_t type; // possibly an enum, decides what vectors to use for imagery
|
|
|
|
// 20
|
2011-04-02 18:49:03 -06:00
|
|
|
int16_t subtype_idx; // index in a vector kind of deal related to previous value
|
|
|
|
uint16_t quality; // from 0 to 5
|
2011-04-02 18:00:56 -06:00
|
|
|
// 24
|
2011-04-02 18:49:03 -06:00
|
|
|
uint32_t unknown2;
|
2011-04-02 18:00:56 -06:00
|
|
|
// 28 = length
|
2011-04-02 16:15:47 -06:00
|
|
|
};
|
|
|
|
/**
|
|
|
|
* structure for holding a DF engraving
|
|
|
|
* \ingroup grp_engraving
|
|
|
|
*/
|
|
|
|
struct dfh_engraving
|
|
|
|
{
|
|
|
|
t_engraving s;
|
2012-01-03 17:45:11 -07:00
|
|
|
t_engraving * origin;
|
2011-04-02 16:15:47 -06:00
|
|
|
};
|
|
|
|
/**
|
|
|
|
* The Engravings module - allows reading engravings :D
|
|
|
|
* \ingroup grp_modules
|
|
|
|
* \ingroup grp_engraving
|
|
|
|
*/
|
|
|
|
class DFHACK_EXPORT Engravings : public Module
|
|
|
|
{
|
|
|
|
public:
|
2011-06-17 07:02:43 -06:00
|
|
|
Engravings();
|
2011-04-02 16:15:47 -06:00
|
|
|
~Engravings();
|
|
|
|
bool Start(uint32_t & numEngravings);
|
|
|
|
bool Read (const uint32_t index, dfh_engraving & engr);
|
|
|
|
bool Write (const dfh_engraving & engr);
|
|
|
|
bool Finish();
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct Private;
|
|
|
|
Private *d;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|