Merge branch 'master' of git://genodeen.net/adeon_dfhack

Conflicts:
	CMakeLists.txt
	library/modules/Position.cpp
develop
Petr Mrázek 2010-08-28 22:47:38 +02:00
commit 2dd8aed7a0
6 changed files with 36 additions and 29 deletions

1
.gitignore vendored

@ -9,6 +9,7 @@ output/*
# a file generated by cmake # a file generated by cmake
dfhack/include/config.h dfhack/include/config.h
library/private/config.h
# any build folders # any build folders
build*/ build*/

@ -4,6 +4,11 @@ cmake_minimum_required(VERSION 2.6)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules) SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
SET ( DFHACK_VERSION "0.4.1.0-dev" ) SET ( DFHACK_VERSION "0.4.1.0-dev" )
# Set this to project source dir. When dfhack is used
# as a submodule, CMAKE_SOURCE_DIR is not pointing to
# the root where this particular CMakeLists.txt file sits.
SET(CMAKE_SOURCE_DIR ${PROJECT_SOURCE_DIR})
# disable warning, autosearch # disable warning, autosearch
if(COMMAND cmake_policy) if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW) cmake_policy(SET CMP0003 NEW)

@ -2361,6 +2361,7 @@ map_data_1b60_offset 0x1B9c
</Entry> </Entry>
<Entry version="v0.31.12" os="linux" id="30_12lin" base="30_11lin" rebase="-0x1000"> <Entry version="v0.31.12" os="linux" id="30_12lin" base="30_11lin" rebase="-0x1000">
<String name="md5">e79cead03187ecb692961b316b7cdcd4</String> <String name="md5">e79cead03187ecb692961b316b7cdcd4</String>
<Address name="screen_tiles_pointer">0x09487970</Address>
</Entry> </Entry>
</MemoryDescriptors> </MemoryDescriptors>
</DFExtractor> </DFExtractor>

@ -178,10 +178,7 @@ bool Position::getScreenTiles (int32_t width, int32_t height, t_screen screen[])
if(!d->Inited) return false; if(!d->Inited) return false;
if(!d->StartedScreen) return false; if(!d->StartedScreen) return false;
uint32_t screen_addr; uint32_t screen_addr = d->owner->readDWord(d->screen_tiles_ptr_offset);
d->owner->readDWord(d->screen_tiles_ptr_offset,(uint32_t &) screen_addr);
//d->owner->read (d->screen_tiles_ptr_offset, sizeof(uint32_t), (uint8_t *) screen_addr);
uint8_t* tiles = new uint8_t[width*height*4/* + 80 + width*height*4*/]; uint8_t* tiles = new uint8_t[width*height*4/* + 80 + width*height*4*/];
d->owner->read (screen_addr, (width*height*4/* + 80 + width*height*4*/), (uint8_t *) tiles); d->owner->read (screen_addr, (width*height*4/* + 80 + width*height*4*/), (uint8_t *) tiles);
@ -190,12 +187,12 @@ bool Position::getScreenTiles (int32_t width, int32_t height, t_screen screen[])
{ {
for(int32_t ix=0; ix<width; ix++) for(int32_t ix=0; ix<width; ix++)
{ {
screen[ix + iy*width].symbol = tiles[iy*4 + ix*height*4 +0]; screen[ix + iy*width].symbol = tiles[(iy + ix*height)*4 +0];
screen[ix + iy*width].foreground = tiles[iy*4 + ix*height*4 +1]; screen[ix + iy*width].foreground = tiles[(iy + ix*height)*4 +1];
screen[ix + iy*width].background = tiles[iy*4 + ix*height*4 +2]; screen[ix + iy*width].background = tiles[(iy + ix*height)*4 +2];
screen[ix + iy*width].bright = tiles[iy*4 + ix*height*4 +3]; screen[ix + iy*width].bright = tiles[(iy + ix*height)*4 +3];
screen[ix + iy*width].gtile = tiles[iy*4 + ix*height*4 +4]; //screen[ix + iy*width].gtile = tiles[width*height*4 + 80 + iy + ix*height +0];
screen[ix + iy*width].grayscale = tiles[iy*4 + ix*height*4 +5]; //screen[ix + iy*width].grayscale = tiles[width*height*4 + 80 + iy + ix*height +1];
} }
} }

@ -275,6 +275,7 @@ void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature)
if( Creatures->ReadInventoryPtr(creature.origin, inventory) ) if( Creatures->ReadInventoryPtr(creature.origin, inventory) )
{ {
DFHack::Items * Items = DF->getItems();
printf("\tInventory:\n"); printf("\tInventory:\n");
for(unsigned int i = 0; i < inventory.size(); i++) for(unsigned int i = 0; i < inventory.size(); i++)
{ {
@ -426,7 +427,6 @@ int main (int numargs, char ** args)
Creatures = DF->getCreatures(); Creatures = DF->getCreatures();
Materials = DF->getMaterials(); Materials = DF->getMaterials();
Items = DF->getItems();
World = DF->getWorld(); World = DF->getWorld();
current_year = World->ReadCurrentYear(); current_year = World->ReadCurrentYear();
current_tick = World->ReadCurrentTick(); current_tick = World->ReadCurrentTick();

@ -159,15 +159,18 @@ int main (int numargs, const char ** args)
} }
DFHack::Position *Pos = DF->getPosition(); DFHack::Position *Pos = DF->getPosition();
DFHack::memory_info* mem = DF->getMemoryInfo(); DFHack::VersionInfo* mem = DF->getMemoryInfo();
DFHack::Process * p = DF->getProcess(); DFHack::Process * p = DF->getProcess();
uint32_t designations = mem->getOffset("map_data_designation"); OffsetGroup * OG_Maps = mem->getGroup("Maps");
uint32_t block_feature1 = mem->getOffset("map_data_feature_local"); OffsetGroup * OG_MapBlock = OG_Maps->getGroup("block");
uint32_t block_feature2 = mem->getOffset("map_data_feature_global"); OffsetGroup * OG_LocalFt = OG_Maps->getGroup("features")->getGroup("local");
uint32_t region_x_offset = mem->getAddress("region_x"); uint32_t designations = OG_MapBlock->getOffset("designation");
uint32_t region_y_offset = mem->getAddress("region_y"); uint32_t block_feature1 = OG_MapBlock->getOffset("feature_local");
uint32_t region_z_offset = mem->getAddress("region_z"); uint32_t block_feature2 = OG_MapBlock->getOffset("feature_global");
uint32_t feature1_start_ptr = mem->getAddress("local_feature_start_ptr"); uint32_t region_x_offset = OG_Maps->getAddress("region_x");
uint32_t region_y_offset = OG_Maps->getAddress("region_y");
uint32_t region_z_offset = OG_Maps->getAddress("region_z");
uint32_t feature1_start_ptr = OG_LocalFt->getAddress("start_ptr");
int32_t regionX, regionY, regionZ; int32_t regionX, regionY, regionZ;
// read position of the region inside DF world // read position of the region inside DF world