Direction flags for engravings.

develop
Petr Mrázek 2011-04-03 03:19:34 +02:00
parent a68702000d
commit 46c5041bea
3 changed files with 46 additions and 10 deletions

@ -2794,9 +2794,11 @@
<Group name="World"> <Group name="World">
<Address name="control_mode" value="0x8c3dff0" /> <Address name="control_mode" value="0x8c3dff0" />
<Address name="game_mode" value="0x8c3e000" /> <Address name="game_mode" value="0x8c3e000" />
<!--
<Address name="current_weather" value="0x936e248" valid="false" /> <Address name="current_weather" value="0x936e248" valid="false" />
<Address name="current_year" value="0x936e264" valid="false" /> <Address name="current_year" value="0x936e264" valid="false" />
<Address name="current_tick" value="0x936e284" valid="false" /> <Address name="current_tick" value="0x936e284" valid="false" />
-->
</Group> </Group>
</Offsets> </Offsets>
</Version> </Version>
@ -2819,7 +2821,7 @@
<Group name="vector" valid="true" /> <Group name="vector" valid="true" />
<Group name="Position" valid="true"> <Group name="Position" valid="true">
<Address name="cursor_xyz" value="0x8c3de60"/> <Address name="cursor_xyz" value="0x8c3de60"/>
<Address name="window_dims" value="0x8c3e4c8" /> <!--<Address name="window_dims" value="0x8c3e4c8" />-->
<Address name="window_x" value="0x8dfaa98" /> <Address name="window_x" value="0x8dfaa98" />
<Address name="window_y" value="0x8dfaa9c" /> <Address name="window_y" value="0x8dfaa9c" />
<Address name="window_z" value="0x8dfaaa0" /> <Address name="window_z" value="0x8dfaaa0" />

@ -12,6 +12,21 @@
*/ */
namespace DFHack namespace DFHack
{ {
/**
* engraving flags
* \ingroup grp_engraving
*/
struct flg_engraving
{
unsigned int floor : 1; // engraved on a floor
unsigned int west : 1; // engraved from west
unsigned int east : 1; // engraved from east
unsigned int north : 1; // engraved from north
unsigned int south : 1; // engraved from south
unsigned int hidden : 1; // hide the engraving
unsigned int rest : 26; // probably unused
};
/** /**
* type the engraving is made of * type the engraving is made of
* \ingroup grp_engraving * \ingroup grp_engraving
@ -21,9 +36,9 @@ namespace DFHack
//0 //0
int32_t artistIdx; /*!< Index of the artist in some global vector */ int32_t artistIdx; /*!< Index of the artist in some global vector */
// 4 // 4
int32_t unknownIdx; int32_t unknownIdx; // likes to stay -1
// 8 // 8
uint32_t unknown1; uint32_t unknown1; // likes to stay 1
// C // C
uint16_t x; /*!< X coordinate */ uint16_t x; /*!< X coordinate */
uint16_t y; /*!< Y coordinate */ uint16_t y; /*!< Y coordinate */
@ -31,7 +46,7 @@ namespace DFHack
uint16_t z; /*!< Z coordinate */ uint16_t z; /*!< Z coordinate */
uint16_t padding; /*!< Could be used for hiding values. */ uint16_t padding; /*!< Could be used for hiding values. */
// 14 // 14
uint32_t flags; // 0x20 = hide symbol flg_engraving flags; // 0x20 = hide symbol
// 18 // 18
uint32_t display_character; // really? 4 bytes for that? uint32_t display_character; // really? 4 bytes for that?
// 1C // 1C

@ -13,6 +13,29 @@
#include <DFHack.h> #include <DFHack.h>
using namespace DFHack; using namespace DFHack;
void describe (dfh_engraving &engraving)
{
t_engraving &data = engraving.s;
printf("Engraving %d/%d/%d @ 0x%x\n", data.x, data.y, data.z, engraving.origin);
// inorganic stuff - we can recognize that
printf("type %d, index %d, character %c\n",data.type, data.subtype_idx, data.display_character);
printf("quality %d\n",data.quality);
printf("engraved: ");
if(data.flags.floor)
printf("On the floor.");
if(data.flags.north)
printf("From north.");
if(data.flags.south)
printf("From south.");
if(data.flags.east)
printf("From east.");
if(data.flags.west)
printf("From west.");
printf("\n");
if(data.flags.hidden)
printf("The symbol is hidden.\n");
};
int main (int numargs, const char ** args) int main (int numargs, const char ** args)
{ {
DFHack::ContextManager DFMgr("Memory.xml"); DFHack::ContextManager DFMgr("Memory.xml");
@ -48,9 +71,7 @@ int main (int numargs, const char ** args)
Cons->Read(i,engraved); Cons->Read(i,engraved);
if(cx == data.x && cy == data.y && cz == data.z) if(cx == data.x && cy == data.y && cz == data.z)
{ {
printf("Engraving %d/%d/%d @ 0x%x\n", data.x, data.y, data.z, engraved.origin); describe(engraved);
// inorganic stuff - we can recognize that
printf("type %d, index %d, character %c\n",data.type, data.subtype_idx, data.display_character);
hexdump(DF,engraved.origin,0x28); hexdump(DF,engraved.origin,0x28);
} }
} }
@ -63,9 +84,7 @@ int main (int numargs, const char ** args)
{ {
Cons->Read(i,engraved); Cons->Read(i,engraved);
{ {
printf("Engraving %d/%d/%d @ 0x%x\n", data.x, data.y, data.z, engraved.origin); describe(engraved);
// inorganic stuff - we can recognize that
printf("type %d, index %d, character %c\n",data.type, data.subtype_idx, data.display_character);
hexdump(DF,engraved.origin,0x28); hexdump(DF,engraved.origin,0x28);
} }
} }