Skip to content

Commit

Permalink
fixed the phantom outlines that were showing up.
Browse files Browse the repository at this point in the history
  • Loading branch information
RosaryMala committed Feb 28, 2011
1 parent ded0a75 commit 92b8343
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 22 deletions.
16 changes: 8 additions & 8 deletions Block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,19 +218,19 @@ void Block::Draw(){
{
if(snowlevel > 75)
{
DrawSpriteFromSheet( 20, IMGObjectSheet, al_map_rgb(255,255,255), drawx, drawy );
DrawSpriteFromSheet( 20, IMGObjectSheet, al_map_rgb(255,255,255), drawx, drawy, this);
}
else if(snowlevel > 50)
{
DrawSpriteFromSheet( 21, IMGObjectSheet, al_map_rgb(255,255,255), drawx, drawy );
DrawSpriteFromSheet( 21, IMGObjectSheet, al_map_rgb(255,255,255), drawx, drawy, this );
}
else if(snowlevel > 25)
{
DrawSpriteFromSheet( 22, IMGObjectSheet, al_map_rgb(255,255,255), drawx, drawy );
DrawSpriteFromSheet( 22, IMGObjectSheet, al_map_rgb(255,255,255), drawx, drawy, this );
}
else if(snowlevel > 0)
{
DrawSpriteFromSheet( 23, IMGObjectSheet, al_map_rgb(255,255,255), drawx, drawy );
DrawSpriteFromSheet( 23, IMGObjectSheet, al_map_rgb(255,255,255), drawx, drawy, this );
}
}

Expand Down Expand Up @@ -260,7 +260,7 @@ void Block::Draw(){
//shadow
if (shadow > 0)
{
DrawSpriteFromSheet( BASE_SHADOW_TILE + shadow - 1, IMGObjectSheet, al_map_rgb(255,255,255), drawx, (ramp.type > 0)?(drawy - (WALLHEIGHT/2)):drawy );
DrawSpriteFromSheet( BASE_SHADOW_TILE + shadow - 1, IMGObjectSheet, al_map_rgb(255,255,255), drawx, (ramp.type > 0)?(drawy - (WALLHEIGHT/2)):drawy , this);
}

//Building
Expand Down Expand Up @@ -357,15 +357,15 @@ void Block::Draw(){
{
if(snowlevel > 75)
{
DrawSpriteFromSheet( 24, IMGObjectSheet, al_map_rgb(255,255,255), drawx, drawy );
DrawSpriteFromSheet( 24, IMGObjectSheet, al_map_rgb(255,255,255), drawx, drawy, this );
}
else if(snowlevel > 50)
{
DrawSpriteFromSheet( 25, IMGObjectSheet, al_map_rgb(255,255,255), drawx, drawy );
DrawSpriteFromSheet( 25, IMGObjectSheet, al_map_rgb(255,255,255), drawx, drawy, this );
}
else if(snowlevel > 25)
{
DrawSpriteFromSheet( 26, IMGObjectSheet, al_map_rgb(255,255,255), drawx, drawy );
DrawSpriteFromSheet( 26, IMGObjectSheet, al_map_rgb(255,255,255), drawx, drawy, this );
}
}

Expand Down
2 changes: 1 addition & 1 deletion Block.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Block
t_building info;
vector<c_sprite> sprites;
uint32_t index;
uint32_t custom_building_type;
int32_t custom_building_type;
Block * parent;
} building;

Expand Down
2 changes: 1 addition & 1 deletion BlockTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ void c_block_tree::set_by_xml(TiXmlElement *elemTree, int fileindex)
add_sprite(x, y, z, sprite);

//add branches, if any.
TiXmlElement* elemBranch = elemTree->FirstChildElement("branch");
//TiXmlElement* elemBranch = elemTree->FirstChildElement("branch");
for(TiXmlElement* elemBranch = elemTree->FirstChildElement("branch");
elemBranch;
elemBranch = elemBranch->NextSiblingElement("branch"))
Expand Down
2 changes: 1 addition & 1 deletion Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void parseConfigLine( string line ){
}
if( line.find("[SEGMENTSIZE_XY") != -1){
int value = parseIntFromLine( "SEGMENTSIZE_XY", line );
if(value < 5) value = DEFAULT_SEGMENTSIZE;
if(value < 1) value = DEFAULT_SEGMENTSIZE;
if(value > 100) value = 100;
//plus 2 to allow edge readings
config.segmentSize.x = value+2;
Expand Down
8 changes: 7 additions & 1 deletion GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ void DrawMinimap(){
MiniMapBottomRightY = posy+mapheight;
}

void DrawSpriteFromSheet( int spriteNum, ALLEGRO_BITMAP* spriteSheet, ALLEGRO_COLOR color, int x, int y){
void DrawSpriteFromSheet( int spriteNum, ALLEGRO_BITMAP* spriteSheet, ALLEGRO_COLOR color, int x, int y, Block * b){
int sheetx = spriteNum % SHEET_OBJECTSWIDE;
int sheety = spriteNum / SHEET_OBJECTSWIDE;
//
Expand All @@ -623,6 +623,12 @@ void DrawSpriteFromSheet( int spriteNum, ALLEGRO_BITMAP* spriteSheet, ALLEGRO_CO
10, 60 , SPRITEWIDTH, SPRITEHEIGHT);
*/
//draw_trans_sprite(target, tiny, x, y);
if(b && b->designation.bits.pile && config.fog_of_war)
{
color.r *= 0.25f;
color.g *= 0.25f;
color.b *= 0.25f;
}
al_draw_tinted_bitmap_region(spriteSheet, color, sheetx * SPRITEWIDTH, sheety * SPRITEHEIGHT, SPRITEWIDTH, SPRITEHEIGHT, x, y - (WALLHEIGHT), 0);
}

Expand Down
2 changes: 1 addition & 1 deletion GUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void flushImgFiles();
//returns index into getImgFile. Will only create new bitmaps when needed
int loadImgFile(char* filename);
int loadImgFile(ALLEGRO_PATH* filepath);
void DrawSpriteFromSheet( int spriteNum,ALLEGRO_BITMAP* spriteSheet, ALLEGRO_COLOR color, int x, int y);
void DrawSpriteFromSheet( int spriteNum,ALLEGRO_BITMAP* spriteSheet, ALLEGRO_COLOR color, int x, int y, Block * b = 0);
ALLEGRO_BITMAP * CreateSpriteFromSheet( int spriteNum, ALLEGRO_BITMAP* spriteSheet);
ALLEGRO_BITMAP* load_bitmap_withWarning(char* path);
void DrawSpriteIndexOverlay(int i);
Expand Down
4 changes: 4 additions & 0 deletions GameBuildings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "GameBuildings.h"
#include "BuildingConfiguration.h"
#include "ContentLoader.h"
#include "gui.h"

//vector<BuildingConfiguration> buildingTypes;
//vector <string> v_buildingtypes;//should be empty for all buildings
Expand Down Expand Up @@ -205,6 +206,9 @@ void loadBuildingSprites ( Block* b, DFHack::Context& DF){
//add yellow box, if needed. But only if the building was not found (this way we can have blank slots in buildings)
if(b->building.sprites.size() == 0 && foundBlockBuildingInfo == false){
c_sprite unknownBuildingSprite;
unknownBuildingSprite.set_defaultsheet(IMGObjectSheet);
unknownBuildingSprite.set_fileindex(-1);
unknownBuildingSprite.set_sheetindex(0);
b->building.sprites.push_back( unknownBuildingSprite );
}
}
Expand Down
10 changes: 6 additions & 4 deletions MapLoading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,12 @@ WorldSegment* ReadMapSegment(DFHack::Context &DF, int x, int y, int z, int sizex
for(uint32_t i=0; i < numblocks; i++){
Block* b = segment->getBlock(i);



//setup building sprites
if( b->building.info.type != BUILDINGTYPE_NA && b->building.info.type != BUILDINGTYPE_BLACKBOX )
loadBuildingSprites( b, DF );

//populate trees
if(b->tree.index)
{
Expand All @@ -904,10 +910,6 @@ WorldSegment* ReadMapSegment(DFHack::Context &DF, int x, int y, int z, int sizex
}


//setup building sprites
if( b->building.info.type != BUILDINGTYPE_NA && b->building.info.type != BUILDINGTYPE_BLACKBOX )
loadBuildingSprites( b, DF );

//setup deep water
if( b->water.index == 7 && b->water.type == 0)
{
Expand Down
7 changes: 3 additions & 4 deletions SpriteObjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,12 +667,11 @@ void c_sprite::draw_world_offset(int x, int y, int z, Block * b, int tileoffset,
sheety = ((sheetindex+tileoffset+randoffset) / SHEET_OBJECTSWIDE) * spriteheight;
}
ALLEGRO_COLOR shade_color = get_color(b);
if(!b->designation.bits.pile)
if(!b->designation.bits.pile && config.fog_of_war)
{
shade_color.r *= 0.25f;
shade_color.g *= 0.25f;
shade_color.b *= 0.25f;

}
if(chop && ( halftile == HALFTILECHOP))
{
Expand Down Expand Up @@ -700,11 +699,11 @@ void c_sprite::draw_world_offset(int x, int y, int z, Block * b, int tileoffset,
//drawy -= (WALLHEIGHT);
//Northern border
if(b->depthBorderNorth)
DrawSpriteFromSheet(281, IMGObjectSheet, al_map_rgb(255,255,255), drawx + offset_x, drawy + offset_y );
DrawSpriteFromSheet(281, IMGObjectSheet, al_map_rgb(255,255,255), drawx + offset_x, drawy + offset_y, b );

//Western border
if(b->depthBorderWest)
DrawSpriteFromSheet(280, IMGObjectSheet, al_map_rgb(255,255,255), drawx + offset_x, drawy + offset_y );
DrawSpriteFromSheet(280, IMGObjectSheet, al_map_rgb(255,255,255), drawx + offset_x, drawy + offset_y, b );

//drawy += (WALLHEIGHT);
}
Expand Down
2 changes: 1 addition & 1 deletion VegetationConfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ c_block_tree * getVegetationTree(vector<VegetationConfiguration>& vegetationConf
return &(current->tree);
}
static c_block_tree* tree = new c_block_tree;
tree->set_sheetindex(-1);
tree->reset();
return tree;
}
2 changes: 2 additions & 0 deletions commonTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ typedef struct {

bool transparentScreenshots;

bool fog_of_war;

uint16_t bloodcutoff;
uint16_t poolcutoff;
//follows are anti-crash things
Expand Down
Binary file modified stonesense.exe
Binary file not shown.

0 comments on commit 92b8343

Please sign in to comment.