summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Block.cpp4
-rw-r--r--ContentLoader.cpp19
-rw-r--r--ContentLoader.h2
-rw-r--r--Creatures.cpp9
-rw-r--r--GUI.cpp150
-rw-r--r--GUI.h1
-rw-r--r--MapLoading.cpp134
-rw-r--r--SpriteObjects.cpp3
-rw-r--r--UserInput.cpp31
-rw-r--r--common.h1
-rw-r--r--commonTypes.h1
-rw-r--r--main.cpp10
-rw-r--r--resources/SSJobIcons.pngbin0 -> 7355 bytes
-rw-r--r--resources/SSProfIcons.pngbin9057 -> 25359 bytes
-rw-r--r--resources/creatures/large_256/domestic.pngbin0 -> 134035 bytes
-rw-r--r--resources/creatures/large_256/domestic.xml114
-rw-r--r--resources/creatures/large_256/dwarff.pngbin161994 -> 165363 bytes
-rw-r--r--resources/creatures/large_256/dwarfm.pngbin183309 -> 186687 bytes
-rw-r--r--resources/creatures/large_256/goat.pngbin31803 -> 0 bytes
-rw-r--r--resources/creatures/large_256/goat.xml37
-rw-r--r--resources/creatures/large_256/index.txt5
-rw-r--r--resources/creatures/large_256/sheep.pngbin23925 -> 0 bytes
-rw-r--r--resources/creatures/large_256/sheep.xml26
-rw-r--r--resources/creatures/large_256/waterbuf.pngbin21295 -> 0 bytes
-rw-r--r--resources/creatures/large_256/waterbuf.xml25
-rw-r--r--resources/creatures/large_256/wild.pngbin0 -> 15821 bytes
-rw-r--r--resources/creatures/large_256/wild.xml22
27 files changed, 429 insertions, 165 deletions
diff --git a/Block.cpp b/Block.cpp
index a99c339..3a5bb7d 100644
--- a/Block.cpp
+++ b/Block.cpp
@@ -146,6 +146,7 @@ void Block::Draw()
pointToScreen((int*)&drawx, (int*)&drawy, drawz);
drawx -= (TILEWIDTH>>1)*config.scale;
+ //TODO the following check should get incorporated into segment beautification
if(((drawx + TILEWIDTH*config.scale) < 0) || (drawx > al_get_bitmap_width(al_get_target_bitmap())) || ((drawy + (TILEHEIGHT + FLOORHEIGHT)*config.scale) < 0) || (drawy - WALLHEIGHT*config.scale > al_get_bitmap_height(al_get_target_bitmap())))
return;
@@ -616,8 +617,7 @@ void Block::DrawPixel(int drawx, int drawy)
(tileMaterial == tiletype_material::GRASS_DRY) ||
(tileMaterial == tiletype_material::GRASS_DEAD)))
{
- DFHack::t_matglossPair woodymat; woodymat.index = WOOD, woodymat.type = grassmat;
- temp = lookupMaterialColor(woodymat);
+ temp = lookupMaterialColor(WOOD, grassmat);
al_draw_pixel(drawx, drawy, al_map_rgba_f(temp.r,temp.g, temp.b, (float)grasslevel/100.0f));
}
}
diff --git a/ContentLoader.cpp b/ContentLoader.cpp
index a3f7c26..c597f0b 100644
--- a/ContentLoader.cpp
+++ b/ContentLoader.cpp
@@ -749,16 +749,21 @@ void ContentLoader::flushCreatureConfig()
ALLEGRO_COLOR lookupMaterialColor(DFHack::t_matglossPair matt)
{
- DFHack::t_matglossPair dyematt;
- dyematt.index = -1, dyematt.type = -1;
- return lookupMaterialColor(matt, dyematt);
+ return lookupMaterialColor((int) matt.type, (int) matt.index, -1, -1);
}
ALLEGRO_COLOR lookupMaterialColor(DFHack::t_matglossPair matt, DFHack::t_matglossPair dyematt)
-{
- int matType = (int) matt.type;
- int matIndex = (int) matt.index;
+{
+ return lookupMaterialColor((int) matt.type, (int) matt.index, (int) dyematt.type, (int) dyematt.index);
+}
+ALLEGRO_COLOR lookupMaterialColor(int matType, int matIndex)
+{
+ return lookupMaterialColor( matType, matIndex, -1, -1);
+}
+
+ALLEGRO_COLOR lookupMaterialColor(int matType, int matIndex, int dyeType, int dyeIndex)
+{
if (matType < 0)
{
//This should not normally happen, but if it does, we don't want crashes, so we'll return magic pink so show something's wrong.
@@ -785,7 +790,7 @@ ALLEGRO_COLOR lookupMaterialColor(DFHack::t_matglossPair matt, DFHack::t_matglos
MaterialInfo mat, dye;
if(mat.decode(matType, matIndex))
{
- if(dyematt.type>=0 && dyematt.index>=0 && dye.decode(dyematt.type, dyematt.index))
+ if(dyeType>=0 && dyeIndex>=0 && dye.decode(dyeType, dyeIndex))
return al_map_rgb_f(
contentLoader->Mats->color[dye.material->powder_dye].red * contentLoader->Mats->color[mat.material->state_color[0]].red,
contentLoader->Mats->color[dye.material->powder_dye].green * contentLoader->Mats->color[mat.material->state_color[0]].green,
diff --git a/ContentLoader.h b/ContentLoader.h
index a1d0d9e..4bedeed 100644
--- a/ContentLoader.h
+++ b/ContentLoader.h
@@ -110,5 +110,7 @@ uint8_t lookupMaterialBright(int matType,int matIndex);
const char *lookupTreeName(int matIndex);
ALLEGRO_COLOR lookupMaterialColor(DFHack::t_matglossPair matt, DFHack::t_matglossPair dyematt);
ALLEGRO_COLOR lookupMaterialColor(DFHack::t_matglossPair matt);
+ALLEGRO_COLOR lookupMaterialColor(int matType, int matIndex, int dyeType, int dyeIndex);
+ALLEGRO_COLOR lookupMaterialColor(int matType, int matIndex);
const char * lookupFormName(int formType);
ShadeBy getShadeType(const char* Input);
diff --git a/Creatures.cpp b/Creatures.cpp
index a14f148..38cef17 100644
--- a/Creatures.cpp
+++ b/Creatures.cpp
@@ -300,6 +300,15 @@ void DrawCreature(int drawx, int drawy, t_unit* creature, Block * b){
unsigned int sheety = 16 * (creature->profession / 7);
al_draw_bitmap_region(IMGProfSheet, sheetx, sheety, 16, 16, drawx -8 + (SPRITEWIDTH*config.scale/2), drawy - (16 + WALLHEIGHT*config.scale + offsety), 0);
}
+
+ offsety += config.show_creature_professions ? 16 : 0;
+
+ if(config.show_creature_jobs && creature->current_job.active)
+ {
+ unsigned int sheetx = 16 * (creature->current_job.jobType % 7);
+ unsigned int sheety = 16 * (creature->current_job.jobType / 7);
+ al_draw_bitmap_region(IMGJobSheet, sheetx, sheety, 16, 16, drawx -8 + (SPRITEWIDTH*config.scale/2), drawy - (16 + WALLHEIGHT*config.scale + offsety), 0);
+ }
}
void DrawCreatureText(int drawx, int drawy, t_unit* creature ){
diff --git a/GUI.cpp b/GUI.cpp
index 39da953..1109866 100644
--- a/GUI.cpp
+++ b/GUI.cpp
@@ -57,6 +57,7 @@ ALLEGRO_BITMAP* IMGCreatureSheet;
ALLEGRO_BITMAP* IMGRampSheet;
ALLEGRO_BITMAP* IMGStatusSheet;
ALLEGRO_BITMAP* IMGProfSheet;
+ALLEGRO_BITMAP* IMGJobSheet;
ALLEGRO_BITMAP* IMGBloodSheet;
ALLEGRO_BITMAP* IMGEngFloorSheet;
ALLEGRO_BITMAP* IMGEngLeftSheet;
@@ -325,22 +326,20 @@ void draw_ustr_border(const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x, fl
}
void pointToScreen(int *inx, int *iny, int inz){
- int offx = al_get_bitmap_width(al_get_target_bitmap()) / 2;
- int offy = (-20)-(BLOCKHEIGHT * config.lift_segment_offscreen);
- int z=inz-1;
+ int z = inz-1;
+
int x = *inx-*iny;
- int y = *inx+*iny;
x = x * TILEWIDTH / 2;
- y = y * TILEHEIGHT / 2;
- y-=z * BLOCKHEIGHT;
- x+=offx;
- y+=offy;
- x-=al_get_bitmap_width(al_get_target_bitmap()) / 2;
- y-=al_get_bitmap_height(al_get_target_bitmap()) / 2;
- x*=config.scale;
- y*=config.scale;
+ x *= config.scale;
x+=al_get_bitmap_width(al_get_target_bitmap()) / 2;
- y+=al_get_bitmap_height(al_get_target_bitmap()) / 2;
+
+ int y = *inx+*iny;
+ y = y*TILEHEIGHT / 2;
+ y -= z*BLOCKHEIGHT;
+ y -= TILEHEIGHT*5/4;
+ y -= BLOCKHEIGHT*config.lift_segment_offscreen;
+ y *= config.scale;
+
*inx=x;*iny=y;
}
@@ -374,10 +373,10 @@ void DrawCurrentLevelOutline(bool backPart){
Crd2D p2 = WorldBlockToScreen(x, y + sizey , z);
Crd2D p3 = WorldBlockToScreen(x + sizex , y, z);
Crd2D p4 = WorldBlockToScreen(x + sizex , y + sizey , z);
- p1.y += FLOORHEIGHT;
- p2.y += FLOORHEIGHT;
- p3.y += FLOORHEIGHT;
- p4.y += FLOORHEIGHT;
+ p1.y += FLOORHEIGHT*config.scale;
+ p2.y += FLOORHEIGHT*config.scale;
+ p3.y += FLOORHEIGHT*config.scale;
+ p4.y += FLOORHEIGHT*config.scale;
if(backPart){
al_draw_line(p1.x, p1.y, p1.x, p1.y-BLOCKHEIGHT*config.scale, color_segmentoutline, 0);
al_draw_line(p1.x, p1.y, p1.x, p1.y-BLOCKHEIGHT*config.scale, color_segmentoutline, 0);
@@ -859,7 +858,18 @@ void DrawSpriteFromSheet( int spriteNum, ALLEGRO_BITMAP* spriteSheet, ALLEGRO_CO
color.g *= 0.25f;
color.b *= 0.25f;
}
- al_draw_tinted_scaled_bitmap(spriteSheet, premultiply(color), sheetx * SPRITEWIDTH * in_scale, sheety * SPRITEHEIGHT * in_scale, SPRITEWIDTH * in_scale, SPRITEHEIGHT * in_scale, x, y - (WALLHEIGHT)*config.scale, SPRITEWIDTH*config.scale, SPRITEHEIGHT*config.scale, 0);
+ al_draw_tinted_scaled_bitmap(
+ spriteSheet,
+ premultiply(color),
+ sheetx * SPRITEWIDTH * in_scale,
+ sheety * SPRITEHEIGHT * in_scale,
+ SPRITEWIDTH * in_scale,
+ SPRITEHEIGHT * in_scale,
+ x,
+ y - (WALLHEIGHT)*config.scale,
+ SPRITEWIDTH*config.scale,
+ SPRITEHEIGHT*config.scale,
+ 0);
}
ALLEGRO_BITMAP * CreateSpriteFromSheet( int spriteNum, ALLEGRO_BITMAP* spriteSheet)
@@ -1048,6 +1058,7 @@ void loadGraphicsFromDisk()
if(!load_from_path(p, "ramps.png", IMGRampSheet)) return;
if(!load_from_path(p, "SSStatusIcons.png", IMGStatusSheet)) return;
if(!load_from_path(p, "SSProfIcons.png", IMGProfSheet)) return;
+ if(!load_from_path(p, "SSJobIcons.png", IMGJobSheet)) return;
if(!load_from_path(p, "gibs.png", IMGBloodSheet)) return;
if(!load_from_path(p, "engravings_floor.png", IMGEngFloorSheet)) return;
if(!load_from_path(p, "engravings_left.png", IMGEngLeftSheet)) return;
@@ -1087,6 +1098,11 @@ void flushImgFiles()
al_destroy_bitmap(IMGProfSheet);
IMGProfSheet = 0;
}
+ if(IMGJobSheet)
+ {
+ al_destroy_bitmap(IMGJobSheet);
+ IMGJobSheet = 0;
+ }
if(IMGEngFloorSheet)
{
al_destroy_bitmap(IMGEngFloorSheet);
@@ -1282,6 +1298,7 @@ void saveScreenshot(){
//al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA);
ALLEGRO_BITMAP* temp = al_create_bitmap(al_get_bitmap_width(al_get_target_bitmap()), al_get_bitmap_height(al_get_target_bitmap()));
al_set_target_bitmap(temp);
+ PrintMessage("saving screenshot to %s\n", filename);
if(!config.transparentScreenshots)
al_clear_to_color(al_map_rgb(config.backr,config.backg,config.backb));
paintboard();
@@ -1389,14 +1406,12 @@ void dumpSegment()
*/
}
-// FIXME: even more black magic.
void saveMegashot(bool tall)
{
- return;
- /*
config.showRenderStatus = true;
al_lock_mutex(config.readMutex);
- draw_textf_border(font, al_map_rgb(255,255,255), al_get_bitmap_width(al_get_target_bitmap())/2, al_get_bitmap_height(al_get_target_bitmap())/2, ALLEGRO_ALIGN_CENTRE, "Saving large screenshot...");
+
+ draw_textf_border(font, al_map_rgb(255,255,255), al_get_bitmap_width(al_get_target_bitmap())/2, al_get_bitmap_height(al_get_target_bitmap())/2, ALLEGRO_ALIGN_CENTRE, "saving large screenshot...");
al_flip_display();
char filename[20] ={0};
FILE* fp;
@@ -1419,45 +1434,93 @@ void saveMegashot(bool tall)
int tempViewy = DisplayedSegmentY;
int tempViewz = DisplayedSegmentZ;
bool tempFollow = config.follow_DFscreen;
+ bool tempfog = config.fogenable;
int tempLift = config.lift_segment_offscreen;
//now make them real big.
config.follow_DFscreen = false;
+ config.fogenable = false;
config.lift_segment_offscreen = 0;
- config.segmentSize.x = config.cellDimX + 2;
- config.segmentSize.y = config.cellDimY + 2;
- if(tall)
- config.segmentSize.z = DisplayedSegmentZ + 1;
- int bigImageWidth = (config.cellDimX * TILEWIDTH);
- int bigImageHeight = ((config.cellDimX + config.cellDimY) * TILEHEIGHT / 2) + ((config.segmentSize.z - 1) * BLOCKHEIGHT);
- parms.sizex = config.segmentSize.x;
- parms.sizey = config.segmentSize.y;
+
+ if(tall) config.segmentSize.z = DisplayedSegmentZ + 1;
parms.sizez = config.segmentSize.z;
- DisplayedSegmentX = -1;
- DisplayedSegmentY = -1;
- parms.x = DisplayedSegmentX;
- parms.y = DisplayedSegmentY;
parms.z = DisplayedSegmentZ;
- //Rebuild stuff
- read_segment(NULL);
- //Draw the image and save it
+
+ //make the image
+ int bigImageWidth = (config.cellDimX * TILEWIDTH)*config.scale;
+ int bigImageHeight = ( ((config.cellDimX + config.cellDimY) * TILEHEIGHT / 2) + ((config.segmentSize.z - 1) * BLOCKHEIGHT) )*config.scale;
bigFile = al_create_bitmap(bigImageWidth, bigImageHeight);
+
+ //draw and save the image
if(bigFile)
{
- DFConsole->print("\nSaving large screenshot to %s\n", filename);
+ PrintMessage("saving large screenshot to %s\n", filename);
al_set_target_bitmap(bigFile);
if(!config.transparentScreenshots)
al_clear_to_color(al_map_rgb(config.backr,config.backg,config.backb));
- viewedSegment->drawAllBlocks();
+
+ //here we deal with the rotations
+ int startx, incrx, numx;
+ int starty, incry, numy;
+
+ startx = -1;
+ starty = -1;
+ incrx = parms.sizex-2;
+ incry = parms.sizey-2;
+ numx = (int)(config.cellDimX+3);
+ numx = numx/incrx + (numx%incrx==0 ? 0 : 1);
+ numy = (int)(config.cellDimY+3);
+ numy = numy/incry + (numx%incry==0 ? 0 : 1);
+
+ if(DisplayedRotation == 1 || DisplayedRotation == 2)
+ {
+ starty = (int)config.cellDimY + 2 - incry;
+ DisplayedSegmentY = (int)config.cellDimY - incry - 1;
+ incry = -incry;
+ }
+ else{
+ DisplayedSegmentY = -1;
+ }
+
+ if(DisplayedRotation == 3 || DisplayedRotation == 2)
+ {
+ startx = (int)config.cellDimX + 2 - incrx;
+ DisplayedSegmentX = (int)config.cellDimX - incrx - 1;
+ incrx = -incrx;
+ }
+ else{
+ DisplayedSegmentX = -1;
+ }
+
+ parms.x = startx;
+ parms.y = starty;
+
+ //now actually loop through and draw the subsegments
+ for(int i=0; i<numy; i++)
+ {
+ for(int j=0; j<numx; j++)
+ {
+ //read and draw each individual segment
+ read_segment(NULL);
+ WorldSegment * segment = map_segment->get();
+ segment->drawAllBlocks();
+
+ parms.x += incrx;
+ }
+ parms.x = startx;
+ parms.y += incry;
+ }
+
+
al_save_bitmap(filename, bigFile);
al_set_target_bitmap(al_get_backbuffer(al_get_current_display()));
- al_destroy_bitmap(bigFile);
timer = clock() - timer;
- DFConsole->print("Took %ims\n", timer);
+ PrintMessage("\ttime for screenshot %ims\n", timer);
}
else
{
- DFConsole->printerr("Failed to take large screenshot. try using software mode\n");
+ LogError("failed to take large screenshot; try zooming out or using software mode\n");
}
+ al_destroy_bitmap(bigFile);
//restore everything that we changed.
config.segmentSize = backupsize;
parms.sizex = config.segmentSize.x;
@@ -1469,11 +1532,12 @@ void saveMegashot(bool tall)
parms.x = DisplayedSegmentX;
parms.y = DisplayedSegmentY;
parms.z = DisplayedSegmentZ;
+ config.fogenable = tempfog;
config.follow_DFscreen = tempFollow;
config.lift_segment_offscreen = tempLift;
config.showRenderStatus = false;
+
al_unlock_mutex(config.readMutex);
- */
}
void draw_particle_cloud(int count, float centerX, float centerY, float rangeX, float rangeY, ALLEGRO_BITMAP *sprite, ALLEGRO_COLOR tint)
diff --git a/GUI.h b/GUI.h
index 0769dd7..2706b85 100644
--- a/GUI.h
+++ b/GUI.h
@@ -50,6 +50,7 @@ extern ALLEGRO_BITMAP* IMGCreatureSheet;
extern ALLEGRO_BITMAP* IMGRampSheet;
extern ALLEGRO_BITMAP* IMGStatusSheet;
extern ALLEGRO_BITMAP* IMGProfSheet;
+extern ALLEGRO_BITMAP* IMGJobSheet;
extern ALLEGRO_BITMAP* IMGBloodSheet;
extern ALLEGRO_BITMAP* IMGEngFloorSheet;
extern ALLEGRO_BITMAP* IMGEngLeftSheet;
diff --git a/MapLoading.cpp b/MapLoading.cpp
index 3ca0834..b1c8fe5 100644
--- a/MapLoading.cpp
+++ b/MapLoading.cpp
@@ -34,6 +34,11 @@ inline bool IDisFloor(int in){
return isFloorTerrain( (tiletype::tiletype) in );;
}
+inline bool IDhasNoFloor(int in){
+ //if not a custom type, do a lookup in dfHack's interface
+ return LowPassable( (tiletype::tiletype) in );;
+}
+
//big look up table
char rampblut[] =
// generated by blutmaker.py
@@ -132,9 +137,6 @@ bool isBlockOnVisibleEdgeOfSegment(WorldSegment* segment, Block* b)
if(b->z == segment->z + segment->sizez - 2)
return true;
- if(!(segment->getBlock(b->x, b->y, b->z+1)))
- return true;
-
if (DisplayedRotation == 0 &&
(
b->x == segment->x + segment->sizex - 2
@@ -179,8 +181,35 @@ bool isBlockOnVisibleEdgeOfSegment(WorldSegment* segment, Block* b)
return false;
}
-bool areNeighborsVisible(t_designation designations[16][16],int x,int y)
+bool areNeighborsVisible(WorldSegment* segment, Block* b)
{
+ Block* temp;
+
+ temp = segment->getBlock(b->x, b->y, b->z+1);
+ if(!temp || !(temp->designation.bits.hidden))
+ return true;
+
+ temp = segment->getBlock(b->x+1, b->y, b->z);
+ if(temp && !(temp->designation.bits.hidden))
+ return true;
+ temp = segment->getBlock(b->x-1, b->y, b->z);
+ if(temp && !(temp->designation.bits.hidden))
+ return true;
+ temp = segment->getBlock(b->x, b->y+1, b->z);
+ if(temp && !(temp->designation.bits.hidden))
+ return true;
+ temp = segment->getBlock(b->x, b->y-1, b->z);
+ if(temp && !(temp->designation.bits.hidden))
+ return true;
+return false;
+}
+
+bool areCellNeighborsVisible(t_designation designations[16][16],int x,int y)
+{
+ //don't do anything if this is the edge of the cell
+ if(x==0 || y==0 || x==15 || y==15)
+ return true;
+ //otherwise look at the neighbors and try to remove what we can
if(designations[x-1][y-1].bits.hidden == false)
return true;
if(designations[x-1][y].bits.hidden == false)
@@ -200,6 +229,35 @@ bool areNeighborsVisible(t_designation designations[16][16],int x,int y)
return false;
}
+/**
+ * returns true iff the block is enclosed by other solid blocks, and is itself solid
+ */
+bool enclosed(WorldSegment* segment, Block* b)
+{
+ if(!IDisWall(b->tileType))
+ return false;
+
+ Block* temp;
+ temp = segment->getBlock(b->x, b->y, b->z+1);
+ if(!temp || IDhasNoFloor(temp->tileType))
+ return false;
+
+ temp = segment->getBlock(b->x+1, b->y, b->z);
+ if(temp && !IDisWall(temp->tileType))
+ return false;
+ temp = segment->getBlock(b->x-1, b->y, b->z);
+ if(temp && !IDisWall(temp->tileType))
+ return false;
+ temp = segment->getBlock(b->x, b->y+1, b->z);
+ if(temp && !IDisWall(temp->tileType))
+ return false;
+ temp = segment->getBlock(b->x, b->y-1, b->z);
+ if(temp && !IDisWall(temp->tileType))
+ return false;
+
+ return true;
+}
+
void ReadCellToSegment(DFHack::Core& DF, WorldSegment& segment, int CellX, int CellY, int CellZ,
uint32_t BoundrySX, uint32_t BoundrySY,
uint32_t BoundryEX, uint32_t BoundryEY,
@@ -366,12 +424,14 @@ void ReadCellToSegment(DFHack::Core& DF, WorldSegment& segment, int CellX, int C
isHidden &= !config.show_hidden_blocks;
bool shouldBeIncluded = (!isOpenTerrain(b->tileType) || b->water.index || !trueBlock->designation[lx][ly].bits.outside) && !isHidden;
- //include hidden blocks as shaded black
- if(config.shade_hidden_blocks && isHidden && (isBlockOnVisibleEdgeOfSegment(&segment, b) || areNeighborsVisible(trueBlock->designation, lx, ly)))
- {
- b->building.info.type = (building_type::building_type) BUILDINGTYPE_BLACKBOX;
- shouldBeIncluded= true;
- }
+ //add back in blocks that are candidates for being shaded black (secondary check in beautify_Segment)
+ if( (!shouldBeIncluded)
+ && config.shade_hidden_blocks
+ && isHidden
+ && ( isBlockOnVisibleEdgeOfSegment(&segment, b)
+ || areCellNeighborsVisible(trueBlock->designation, lx, ly)
+ || (!segment.getBlock(b->x, b->y, b->z+1) )))
+ shouldBeIncluded = true;
if( shouldBeIncluded )
{
@@ -712,22 +772,17 @@ WorldSegment* ReadMapSegment(int x, int y, int z, int sizex, int sizey, int size
int cellDimX, cellDimY, cellDimZ;
Maps::getSize((unsigned int &)cellDimX, (unsigned int &)cellDimY, (unsigned int &)cellDimZ);
//Store these
- cellDimX = cellDimX * 16;
- cellDimY = cellDimY * 16;
+ cellDimX = cellDimX * CELLEDGESIZE;
+ cellDimY = cellDimY * CELLEDGESIZE;
cellDimZ = cellDimZ;
config.cellDimX = cellDimX;
config.cellDimY = cellDimY;
config.cellDimZ = cellDimZ;
- //bound view to world
- if(x > cellDimX * CELLEDGESIZE -sizex/2) DisplayedSegmentX = x = cellDimX * CELLEDGESIZE -sizex/2;
- if(y > cellDimY * CELLEDGESIZE -sizey/2) DisplayedSegmentY = y = cellDimY * CELLEDGESIZE -sizey/2;
- if(x < -sizex/2) DisplayedSegmentX = x = -sizex/2;
- if(y < -sizey/2) DisplayedSegmentY = y = -sizey/2;
//setup new world segment
WorldSegment* segment = new WorldSegment(x,y,z,sizex,sizey,sizez);
- segment->regionSize.x = cellDimX * CELLEDGESIZE;
- segment->regionSize.y = cellDimY * CELLEDGESIZE;
+ segment->regionSize.x = cellDimX;
+ segment->regionSize.y = cellDimY;
segment->regionSize.z = cellDimZ;
segment->rotation = DisplayedRotation;
@@ -837,17 +892,58 @@ WorldSegment* ReadMapSegment(int x, int y, int z, int sizex, int sizey, int size
return segment;
}
+/**
+ * checks to see if the block is a potentially viewable hidden block
+ * if so, put the black mask block overtop
+ * if not, makes block not visible
+ */
+void mask_block(WorldSegment * segment, Block* b)
+{
+ //include hidden blocks as shaded black, make remaining invisible
+ if( b->designation.bits.hidden )
+ {
+ if( isBlockOnVisibleEdgeOfSegment(segment, b)
+ || areNeighborsVisible(segment, b) )
+ b->building.info.type = (building_type::building_type) BUILDINGTYPE_BLACKBOX;
+ else b->visible = false;
+ }
+}
+
+/**
+ * checks to see if the block is a potentially viewable hidden block
+ * if not, makes block not visible
+ */
+void unhidden_block(WorldSegment * segment, Block* b)
+{
+ //make blocks that are impossible to see invisible
+ if( b->designation.bits.hidden
+ && (!isBlockOnVisibleEdgeOfSegment(segment, b))
+ && (enclosed(segment, b)) )
+ b->visible = false;
+}
+
void beautify_Segment(WorldSegment * segment)
{
if(!segment)
return;
clock_t start_time = clock();
//do misc beautification
+
uint32_t numblocks = segment->getNumBlocks();
for(uint32_t i=0; i < numblocks; i++){
Block* b = segment->getBlock(i);
+ //first check to see if this block is possible to be seen
+ if(config.shade_hidden_blocks && (!config.show_hidden_blocks))
+ mask_block(segment, b);
+ else
+ unhidden_block(segment, b);
+
+ if(!b->visible)
+ continue;
+
+ //next see if the block is behind something
if(config.occlusion)
occlude_block(b);
diff --git a/SpriteObjects.cpp b/SpriteObjects.cpp
index 3a30122..5b5ff5f 100644
--- a/SpriteObjects.cpp
+++ b/SpriteObjects.cpp
@@ -944,8 +944,7 @@ ALLEGRO_COLOR c_sprite::get_color(void* block)
case ShadeMat:
return lookupMaterialColor(b->material);
case ShadeGrass:
- DFHack::t_matglossPair woodymat; woodymat.index = WOOD, woodymat.type = b->grassmat;
- return lookupMaterialColor(woodymat);
+ return lookupMaterialColor(WOOD, b->grassmat);
case ShadeBuilding:
return lookupMaterialColor(b->building.info.material);
case ShadeLayer:
diff --git a/UserInput.cpp b/UserInput.cpp
index 96c31fb..7ba60d8 100644
--- a/UserInput.cpp
+++ b/UserInput.cpp
@@ -67,10 +67,22 @@ void changeRelativeToRotation( int &inputx, int &inputy, int stepx, int stepy ){
void moveViewRelativeToRotation( int stepx, int stepy )
{
+
if (config.follow_DFscreen)
changeRelativeToRotation(config.viewXoffset, config.viewYoffset, stepx, stepy );
- else
+ //if we're following the DF screen, we DO NOT bound the view, since we have a simple way to get back
+ else{
changeRelativeToRotation(DisplayedSegmentX, DisplayedSegmentY, stepx, stepy );
+ //bound view to world
+ if((int)DisplayedSegmentX > (int)config.cellDimX -(int)config.segmentSize.x/2)
+ DisplayedSegmentX = config.cellDimX -config.segmentSize.x/2;
+ if((int)DisplayedSegmentY > (int)config.cellDimY -(int)config.segmentSize.y/2)
+ DisplayedSegmentY = config.cellDimY -config.segmentSize.y/2;
+ if((int)DisplayedSegmentX < -(int)config.segmentSize.x/2)
+ DisplayedSegmentX = -config.segmentSize.x/2;
+ if((int)DisplayedSegmentY < -(int)config.segmentSize.y/2)
+ DisplayedSegmentY = -config.segmentSize.y/2;
+ }
}
@@ -236,6 +248,10 @@ void doKeys(int Key)
config.show_creature_professions = !config.show_creature_professions;
timeToReloadSegment = true;
}
+ if(Key == ALLEGRO_KEY_J){
+ config.show_creature_jobs = !config.show_creature_jobs;
+ timeToReloadSegment = true;
+ }
if(Key == ALLEGRO_KEY_C){
config.truncate_walls++;
if (config.truncate_walls > 4) config.truncate_walls = 0;
@@ -248,6 +264,19 @@ void doKeys(int Key)
config.follow_DFscreen = !config.follow_DFscreen;
timeToReloadSegment = true;
}
+ if(Key == ALLEGRO_KEY_Z){
+ if (config.follow_DFscreen)
+ {
+ config.viewXoffset = 0;
+ config.viewYoffset = 0;
+ config.viewZoffset = 0;
+ }
+ else
+ {
+ DisplayedSegmentX = (config.cellDimX -config.segmentSize.x)/2;
+ DisplayedSegmentY = (config.cellDimY -config.segmentSize.y)/2;
+ }
+ }
if(Key == ALLEGRO_KEY_1){
config.segmentSize.z--;
if(config.segmentSize.z <= 0) config.segmentSize.z = 1;
diff --git a/common.h b/common.h
index 0ee8145..118ed47 100644
--- a/common.h
+++ b/common.h
@@ -165,6 +165,7 @@ class SegmentWrap;
void correctBlockForSegmetOffset(int32_t& x, int32_t& y, int32_t& z);
void LogError(const char* msg, ...);
+void PrintMessage(const char* msg, ...);
void LogVerbose(const char* msg, ...);
void SetTitle(const char *format, ...);
diff --git a/commonTypes.h b/commonTypes.h
index 40c7c7f..3a13e74 100644
--- a/commonTypes.h
+++ b/commonTypes.h
@@ -191,6 +191,7 @@ typedef struct
bool show_creature_moods;
bool show_creature_professions;
+ bool show_creature_jobs;
bool transparentScreenshots;
diff --git a/main.cpp b/main.cpp
index f163d74..63cf86e 100644
--- a/main.cpp
+++ b/main.cpp
@@ -92,6 +92,16 @@ void LogError(const char* msg, ...){
fclose(fp);
}
+
+void PrintMessage(const char* msg, ...){
+ va_list arglist;
+ va_start(arglist, msg);
+ char buf[512] = {0};
+ vsprintf(buf, msg, arglist);
+ Core::print(buf);
+ va_end(arglist);
+}
+
void LogVerbose(const char* msg, ...){
if (!config.verbose_logging)
return;
diff --git a/resources/SSJobIcons.png b/resources/SSJobIcons.png
new file mode 100644
index 0000000..0bd2914
--- /dev/null
+++ b/resources/SSJobIcons.png
Binary files differ
diff --git a/resources/SSProfIcons.png b/resources/SSProfIcons.png
index 14cbfc3..800e8e5 100644
--- a/resources/SSProfIcons.png
+++ b/resources/SSProfIcons.png
Binary files differ
diff --git a/resources/creatures/large_256/domestic.png b/resources/creatures/large_256/domestic.png
new file mode 100644
index 0000000..85c4c79
--- /dev/null
+++ b/resources/creatures/large_256/domestic.png
Binary files differ
diff --git a/resources/creatures/large_256/domestic.xml b/resources/creatures/large_256/domestic.xml
new file mode 100644
index 0000000..0e9fc5a
--- /dev/null
+++ b/resources/creatures/large_256/domestic.xml
@@ -0,0 +1,114 @@
+<?xml version="1.0" ?>
+<creatures>
+
+ <creature gameID="WATER_BUFFALO" file="domestic.png" >
+
+ <variant special="Normal" prof="CHILD" sheetIndex="4" zoom="3" color="bodypart" bodypart="skin" >
+ <subsprite sheetIndex="5" zoom="3" color="bodypart" bodypart="hair" />
+ <subsprite sheetIndex="6" zoom="3" />
+ </variant>
+
+ <variant special="Normal" sex="F" sheetIndex="0" zoom="3" color="bodypart" bodypart="skin" >
+ <subsprite sheetIndex="1" zoom="3" color="bodypart" bodypart="hair" />
+ <subsprite sheetIndex="2" zoom="3" />
+ </variant>
+
+ <variant special="Normal" sex="M" sheetIndex="0" zoom="3" color="bodypart" bodypart="skin" >
+ <subsprite sheetIndex="1" zoom="3" color="bodypart" bodypart="hair" />
+ <subsprite sheetIndex="3" zoom="3" />
+ </variant>
+
+ </creature>
+
+
+ <creature gameID="GOAT" file="domestic.png" >
+
+ <variant special="Normal" prof="CHILD" sheetIndex="25" zoom="3" color="bodypart" bodypart="hair" >
+ <subsprite sheetIndex="26" zoom="3" />
+ </variant>
+
+ <variant special="Normal" sex="F" sheetIndex="20" zoom="3" color="bodypart" bodypart="hair" >
+ <subsprite sheetIndex="21" zoom="3" color="bodypart" bodypart="beard" />
+ <subsprite sheetIndex="22" zoom="3" />
+ </variant>
+
+ <variant special="Normal" sex="M" sheetIndex="20" zoom="3" color="bodypart" bodypart="hair" >
+ <subsprite sheetIndex="23" zoom="3" color="bodypart" bodypart="beard" />
+ <subsprite sheetIndex="24" zoom="3" />
+ </variant>
+
+ </creature>
+
+
+ <creature gameID="SHEEP" file="domestic.png" >
+
+ <variant special="Normal" prof="CHILD" sheetIndex="44" zoom="3" color="bodypart" bodypart="skin" >
+ <subsprite sheetIndex="45" zoom="3" color="bodypart" bodypart="wool" />
+ <subsprite sheetIndex="46" zoom="3" />
+ </variant>
+
+ <variant special="Normal" sex="F" sheetIndex="40" zoom="3" color="bodypart" bodypart="skin" >
+ <subsprite sheetIndex="41" zoom="3" color="bodypart" bodypart="wool" />
+ <subsprite sheetIndex="42" zoom="3" />
+ </variant>
+
+ <variant special="Normal" sex="M" sheetIndex="40" zoom="3" color="bodypart" bodypart="skin" >
+ <subsprite sheetIndex="41" zoom="3" color="bodypart" bodypart="wool" />
+ <subsprite sheetIndex="43" zoom="3" />
+ </variant>
+
+ </creature>
+
+
+ <creature gameID="REINDEER" file="domestic.png" >
+
+ <variant special="Normal" prof="CHILD" sheetIndex="62" zoom="3" color="bodypart" bodypart="hair" >
+ <subsprite sheetIndex="63" zoom="3" />
+ </variant>
+
+ <variant special="Normal" sheetIndex="60" zoom="3" color="bodypart" bodypart="hair" >
+ <subsprite sheetIndex="61" zoom="3" />
+ </variant>
+
+ </creature>
+
+
+ <creature gameID="PIG" file="domestic.png" >
+
+ <variant special="Normal" prof="CHILD" sheetIndex="81" zoom="3" color="bodypart" bodypart="skin" />
+
+ <variant special="Normal" sheetIndex="80" zoom="3" color="bodypart" bodypart="skin" />
+
+ </creature>
+
+
+ <creature gameID="BIRD_CHICKEN" file="domestic.png" >
+
+ <variant special="Normal" prof="CHILD" sheetIndex="104" zoom="3" >
+ <subsprite sheetIndex="105" zoom="3" color="bodypart" bodypart="feathers" />
+ </variant>
+
+ <variant special="Normal" sex="F" sheetIndex="100" zoom="3" >
+ <subsprite sheetIndex="101" zoom="3" color="bodypart" bodypart="feathers" />
+ </variant>
+
+ <variant special="Normal" sex="M" sheetIndex="102" zoom="3" >
+ <subsprite sheetIndex="103" zoom="3" color="bodypart" bodypart="feathers" />
+ </variant>
+
+ </creature>
+
+
+ <creature gameID="BIRD_DUCK" file="domestic.png" >
+
+ <variant special="Normal" prof="CHILD" sheetIndex="104" zoom="3" >
+ <subsprite sheetIndex="105" zoom="3" color="bodypart" bodypart="feathers" />
+ </variant>
+
+ <variant special="Normal" sheetIndex="120" zoom="3" >
+ <subsprite sheetIndex="121" zoom="3" color="bodypart" bodypart="feathers" />
+ </variant>
+
+ </creature>
+
+</creatures> \ No newline at end of file
diff --git a/resources/creatures/large_256/dwarff.png b/resources/creatures/large_256/dwarff.png
index 4b7bd61..7a6f54c 100644
--- a/resources/creatures/large_256/dwarff.png
+++ b/resources/creatures/large_256/dwarff.png
Binary files differ
diff --git a/resources/creatures/large_256/dwarfm.png b/resources/creatures/large_256/dwarfm.png
index a318676..366041d 100644
--- a/resources/creatures/large_256/dwarfm.png
+++ b/resources/creatures/large_256/dwarfm.png
Binary files differ
diff --git a/resources/creatures/large_256/goat.png b/resources/creatures/large_256/goat.png
deleted file mode 100644
index 1b5023a..0000000
--- a/resources/creatures/large_256/goat.png
+++ /dev/null
Binary files differ
diff --git a/resources/creatures/large_256/goat.xml b/resources/creatures/large_256/goat.xml
deleted file mode 100644
index 7ab7659..0000000
--- a/resources/creatures/large_256/goat.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" ?>
-<creatures>
-
- <creature gameID="GOAT_MOUNTAIN" file="goat.png" >
-
- <variant special="Normal" prof="CHILD" sheetIndex="40" zoom="3" color="bodypart" bodypart="hair" >
- <subsprite sheetIndex="42" zoom="3" />
- </variant>
-
- <variant special="Normal" sheetIndex="60" zoom="3" color="bodypart" bodypart="hair" >
- <subsprite sheetIndex="62" zoom="3" color="xml" red="160" green="140" blue="130" />
- <subsprite sheetIndex="63" zoom="3" />
- </variant>
-
- </creature>
-
- <creature gameID="GOAT" file="goat.png" >
-
- <variant special="Normal" prof="CHILD" sheetIndex="40" zoom="3" color="bodypart" bodypart="hair" >
- <subsprite sheetIndex="42" zoom="3" />
- </variant>
-
- <variant special="Normal" sex="F" sheetIndex="0" zoom="3" color="bodypart" bodypart="hair" >
- <subsprite sheetIndex="1" zoom="3" color="bodypart" bodypart="beard" />
- <subsprite sheetIndex="2" zoom="3" color="xml" red="160" green="140" blue="130" />
- <subsprite sheetIndex="3" zoom="3" />
- </variant>
-
- <variant special="Normal" sex="M" sheetIndex="20" zoom="3" color="bodypart" bodypart="hair" >
- <subsprite sheetIndex="21" zoom="3" color="bodypart" bodypart="beard" />
- <subsprite sheetIndex="22" zoom="3" color="xml" red="160" green="140" blue="130" />
- <subsprite sheetIndex="3" zoom="3" />
- </variant>
-
- </creature>
-
-</creatures> \ No newline at end of file
diff --git a/resources/creatures/large_256/index.txt b/resources/creatures/large_256/index.txt
index 02c787d..d57f3e6 100644
--- a/resources/creatures/large_256/index.txt
+++ b/resources/creatures/large_256/index.txt
@@ -1,8 +1,7 @@
jabber.xml
crundle.xml
-waterbuf.xml
-goat.xml
-sheep.xml
+wild.xml
+domestic.xml
dwarf.xml \ No newline at end of file
diff --git a/resources/creatures/large_256/sheep.png b/resources/creatures/large_256/sheep.png
deleted file mode 100644
index 37effe7..0000000
--- a/resources/creatures/large_256/sheep.png
+++ /dev/null
Binary files differ
diff --git a/resources/creatures/large_256/sheep.xml b/resources/creatures/large_256/sheep.xml
deleted file mode 100644
index 8eb13f6..0000000
--- a/resources/creatures/large_256/sheep.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" ?>
-<creatures>
-
- <creature gameID="SHEEP" file="sheep.png" >
-
- <variant special="Normal" prof="CHILD" sheetIndex="40" zoom="3" color="bodypart" bodypart="skin" >
- <subsprite sheetIndex="41" zoom="3" color="bodypart" bodypart="wool" />
- <subsprite sheetIndex="42" zoom="3" />
- <subsprite sheetIndex="43" zoom="3" color="xml" red="255" green="126" blue="0" />
- </variant>
-
- <variant special="Normal" sex="F" sheetIndex="0" zoom="3" color="bodypart" bodypart="skin" >
- <subsprite sheetIndex="1" zoom="3" color="bodypart" bodypart="wool" />
- <subsprite sheetIndex="2" zoom="3" />
- <subsprite sheetIndex="3" zoom="3" color="xml" red="255" green="126" blue="0" />
- </variant>
-
- <variant special="Normal" sex="M" sheetIndex="0" zoom="3" color="bodypart" bodypart="skin" >
- <subsprite sheetIndex="1" zoom="3" color="bodypart" bodypart="wool" />
- <subsprite sheetIndex="22" zoom="3" color="xml" red="160" green="140" blue="130" />
- <subsprite sheetIndex="3" zoom="3" color="xml" red="255" green="126" blue="0" />
- </variant>
-
- </creature>
-
-</creatures> \ No newline at end of file
diff --git a/resources/creatures/large_256/waterbuf.png b/resources/creatures/large_256/waterbuf.png
deleted file mode 100644
index bcbdff0..0000000
--- a/resources/creatures/large_256/waterbuf.png
+++ /dev/null
Binary files differ
diff --git a/resources/creatures/large_256/waterbuf.xml b/resources/creatures/large_256/waterbuf.xml
deleted file mode 100644
index ed66d31..0000000
--- a/resources/creatures/large_256/waterbuf.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" ?>
-<creatures>
- <creature gameID="WATER_BUFFALO" file="waterbuf.png" >
-
- <variant special="Normal" prof="CHILD" sheetIndex="40" zoom="3" color="bodypart" bodypart="skin" >
- <subsprite sheetIndex="41" zoom="3" color="bodypart" bodypart="hair" />
- <subsprite sheetIndex="42" zoom="3" />
- <subsprite sheetIndex="43" zoom="3" color="xml" red="180" green="160" blue="150" />
- </variant>
-
- <variant special="Normal" sex="F" sheetIndex="0" zoom="3" color="bodypart" bodypart="skin" >
- <subsprite sheetIndex="1" zoom="3" color="bodypart" bodypart="hair" />
- <subsprite sheetIndex="2" zoom="3" />
- <subsprite sheetIndex="3" zoom="3" color="xml" red="180" green="160" blue="150" />
- </variant>
-
- <variant special="Normal" sex="M" sheetIndex="0" zoom="3" color="bodypart" bodypart="skin" >
- <subsprite sheetIndex="1" zoom="3" color="bodypart" bodypart="hair" />
- <subsprite sheetIndex="2" zoom="3" />
- <subsprite sheetIndex="23" zoom="3" color="xml" red="180" green="160" blue="150" />
- </variant>
-
- </creature>
-
-</creatures> \ No newline at end of file
diff --git a/resources/creatures/large_256/wild.png b/resources/creatures/large_256/wild.png
new file mode 100644
index 0000000..5ff0606
--- /dev/null
+++ b/resources/creatures/large_256/wild.png
Binary files differ
diff --git a/resources/creatures/large_256/wild.xml b/resources/creatures/large_256/wild.xml
new file mode 100644
index 0000000..f50518d
--- /dev/null
+++ b/resources/creatures/large_256/wild.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" ?>
+<creatures>
+
+ <creature gameID="GOAT_MOUNTAIN" file="wild.png" >
+
+ <variant special="Normal" sheetIndex="0" zoom="3" color="bodypart" bodypart="hair" >
+ <subsprite sheetIndex="1" zoom="3" />
+ </variant>
+
+ </creature>
+
+
+ <creature gameID="GRAY_LANGUR" file="wild.png" >
+
+ <variant special="Normal" sheetIndex="20" zoom="3" color="bodypart" bodypart="skin" >
+ <subsprite sheetIndex="21" zoom="3" color="bodypart" bodypart="hair" />
+ <subsprite sheetIndex="22" zoom="3" />
+ </variant>
+
+ </creature>
+
+</creatures> \ No newline at end of file