Skip to content

Commit

Permalink
Brought back ramp tops.
Browse files Browse the repository at this point in the history
  • Loading branch information
Caldfir authored and RosaryMala committed Dec 15, 2012
1 parent f5c662a commit 9cf7464
Show file tree
Hide file tree
Showing 3 changed files with 202 additions and 201 deletions.
65 changes: 31 additions & 34 deletions Block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,22 +201,34 @@ void Block::Assemble()


//Draw Ramp Tops
if(false){//tileType == tiletype::RampTop){
Block * b = this->ownerSegment->getBlockLocal(this->x, this->y, this->z-1);
if(tileType == tiletype::RampTop){
Block * b = this->ownerSegment->getBlock(this->x, this->y, this->z-1);
if(b && b->tileShapeBasic == tiletype_shape_basic::Ramp) {
c_sprite * spriteobject = GetBlockSpriteMap(b->tileType,material,b->consForm);
if (spriteobject->get_sheetindex() == UNCONFIGURED_INDEX) {
spriteobject->set_sheetindex(0);
spriteobject->set_fileindex(INVALID_INDEX);
}
if (spriteobject->get_sheetindex() != INVALID_INDEX) {
spriteobject->set_size(SPRITEWIDTH, TILEHEIGHT);
spriteobject->set_offset(0, -(FLOORHEIGHT));
spriteobject->set_tile_layout(RAMPTOPTILE);
spriteobject->set_defaultsheet(IMGRampSheet);
spriteobject->draw_world(x, y, z, this, (chopThisBlock && this->z == ownerSegment->z + ownerSegment->sizez -2));
spriteobject->set_offset(0, 0);
}
spriteobject = GetBlockSpriteMap(b->tileType, b->material, b->consForm);
if (spriteobject->get_sheetindex() == UNCONFIGURED_INDEX) {
spriteobject->set_sheetindex(0);
spriteobject->set_fileindex(INVALID_INDEX);
spriteobject->set_defaultsheet(IMGRampSheet);
}
if (spriteobject->get_sheetindex() != INVALID_INDEX) {
spriteobject->set_size(SPRITEWIDTH, TILEHEIGHT);
spriteobject->set_tile_layout(RAMPTOPTILE);
spriteobject->set_offset(0, WALLHEIGHT);
spriteobject->draw_world_offset_src(x, y, z, 0, this, b, (chopThisBlock && this->z == ownerSegment->z + ownerSegment->sizez -2));
spriteobject->set_offset(0, 0);
}
//if (spriteobject->get_sheetindex() == UNCONFIGURED_INDEX) {
// spriteobject->set_sheetindex(0);
// spriteobject->set_fileindex(INVALID_INDEX);
//}
//if (spriteobject->get_sheetindex() != INVALID_INDEX) {
// spriteobject->set_size(SPRITEWIDTH, TILEHEIGHT);
// spriteobject->set_offset(0, -(FLOORHEIGHT));
// spriteobject->set_tile_layout(RAMPTOPTILE);
// spriteobject->set_defaultsheet(IMGRampSheet);
// spriteobject->draw_world(x, y, z, this, (chopThisBlock && this->z == ownerSegment->z + ownerSegment->sizez -2));
// spriteobject->set_offset(0, 0);
//}
spriteobject->set_tile_layout(BLOCKTILE);
}
}
Expand All @@ -225,7 +237,7 @@ void Block::Assemble()
if( tileShapeBasic==tiletype_shape_basic::Floor ||
tileShapeBasic==tiletype_shape_basic::Wall ||
tileShapeBasic==tiletype_shape_basic::Ramp ||
tileShapeBasic==tiletype_shape_basic::Stair ) {
tileShapeBasic==tiletype_shape_basic::Stair) {

//If tile has no floor, look for a Filler Floor from it's wall
if (tileShapeBasic==tiletype_shape_basic::Floor) {
Expand All @@ -238,21 +250,6 @@ void Block::Assemble()
spriteobject = GetFloorSpriteMap(tileType, this->material, consForm);
}
if(spriteobject->get_sheetindex() != INVALID_INDEX) {
////if floor is muddy, override regular floor
//if( mudlevel && water.index == 0)
//{
// sprite.sheetIndex = SPRITEFLOOR_WATERFLOOR;
// sprite.fileIndex = INVALID_INDEX;
//}
////if floor is snowed down, override regular floor
//if( snowlevel )
//{
// sprite.sheetIndex = SPRITEFLOOR_SNOW;
// sprite.fileIndex = INVALID_INDEX;
// spriteOffset = 0;
// al_set_separate_blender(op, src, dst, alpha_op, alpha_src, alpha_dst, color);
//}

if (spriteobject->get_sheetindex() == UNCONFIGURED_INDEX) {
spriteobject->set_sheetindex(SPRITEOBJECT_FLOOR_NA);
spriteobject->set_fileindex(INVALID_INDEX);
Expand Down Expand Up @@ -301,7 +298,7 @@ void Block::Assemble()
if (spriteobject->get_sheetindex() != INVALID_INDEX) {
spriteobject->set_size(SPRITEWIDTH, SPRITEHEIGHT);
spriteobject->set_tile_layout(RAMPBOTTOMTILE);
spriteobject->draw_world(x, y, z, this, (chopThisBlock && this->z == ownerSegment->z + ownerSegment->sizez -2));
spriteobject->draw_world_offset(x, y, z, 0, this, (chopThisBlock && this->z == ownerSegment->z + ownerSegment->sizez -2));
}
spriteobject->set_tile_layout(BLOCKTILE);
}
Expand Down Expand Up @@ -377,7 +374,7 @@ void Block::Assemble()
spriteobject = GetFloorSpriteMap(tileType, material, consForm);
if(spriteobject->get_sheetindex() != INVALID_INDEX && spriteobject->get_sheetindex() != UNCONFIGURED_INDEX) {
if (mirrored) {
spriteobject->draw_world_offset(x, y, z, this, 1);
spriteobject->draw_world_offset(x, y, z, 1, this);
} else {
spriteobject->draw_world(x, y, z, this);
}
Expand All @@ -387,7 +384,7 @@ void Block::Assemble()
spriteobject = GetBlockSpriteMap(tileType, material, consForm);
if(spriteobject->get_sheetindex() != INVALID_INDEX && spriteobject->get_sheetindex() != UNCONFIGURED_INDEX) {
if (mirrored) {
spriteobject->draw_world_offset(x, y, z, this, 1);
spriteobject->draw_world_offset(x, y, z, 1, this);
} else {
spriteobject->draw_world(x, y, z, this);
}
Expand Down
35 changes: 19 additions & 16 deletions SpriteObjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,13 +624,16 @@ void c_sprite::set_by_xml(TiXmlElement *elemSprite)
// }
//}

void c_sprite::draw_world(int x, int y, int z, Block * b, bool chop)
inline void c_sprite::draw_world(int x, int y, int z, Block * b, bool chop)
{
draw_world_offset(x, y, z, b, 0, chop);
draw_world_offset_src(x, y, z, 0, b, b, chop);
}

inline void c_sprite::draw_world_offset(int x, int y, int z, int tileoffset, Block * b, bool chop){
draw_world_offset_src(x, y, z, tileoffset, b, b, chop);
}

void c_sprite::draw_world_offset(int x, int y, int z, Block * b, int tileoffset, bool chop)
void c_sprite::draw_world_offset_src(int x, int y, int z, int tileoffset, Block * b, Block* src, bool chop)
{
if(defaultsheet == 0) {
defaultsheet = IMGObjectSheet;
Expand Down Expand Up @@ -688,33 +691,33 @@ void c_sprite::draw_world_offset(int x, int y, int z, Block * b, int tileoffset,
goto draw_subsprite;
}
int foo = 0;
if(!(snowmin <= b->snowlevel && (snowmax == -1 || snowmax >= b->snowlevel))) {
if(!(snowmin <= src->snowlevel && (snowmax == -1 || snowmax >= src->snowlevel))) {
goto draw_subsprite;
}
if (!(bloodmin <= b->bloodlevel && (bloodmax == -1 || bloodmax >= b->bloodlevel))) {
if (!(bloodmin <= src->bloodlevel && (bloodmax == -1 || bloodmax >= src->bloodlevel))) {
goto draw_subsprite;
}
if(!(mudmin <= b->mudlevel && (mudmax == -1 || mudmax >= b->mudlevel))) {
if(!(mudmin <= src->mudlevel && (mudmax == -1 || mudmax >= src->mudlevel))) {
goto draw_subsprite;
}
if(!(grassmin <= b->grasslevel && (grassmax == -1 || grassmax >= b->grasslevel))) {
if(!(grassmin <= src->grasslevel && (grassmax == -1 || grassmax >= src->grasslevel))) {
goto draw_subsprite;
}
//only bother with this tile if it's in the light, or not.
if(!((light==LIGHTANY) || ((light==LIGHTYES) && b->designation.bits.outside) || ((light==LIGHTNO) && !(b->designation.bits.outside)))) {
goto draw_subsprite;
}
if(!((grasstype == -1) || (grasstype == b->grassmat))) {
if(!((grasstype == -1) || (grasstype == src->grassmat))) {
goto draw_subsprite;
}
if(!((grass_growth == GRASS_GROWTH_ANY) ||
((grass_growth == GRASS_GROWTH_NORMAL) &&
((b->tileMaterial == tiletype_material::GRASS_DARK) ||
(b->tileMaterial == tiletype_material::GRASS_LIGHT))) ||
((src->tileMaterial == tiletype_material::GRASS_DARK) ||
(src->tileMaterial == tiletype_material::GRASS_LIGHT))) ||
((grass_growth == GRASS_GROWTH_DRY) &&
(b->tileMaterial == tiletype_material::GRASS_DRY)) ||
(src->tileMaterial == tiletype_material::GRASS_DRY)) ||
((grass_growth == GRASS_GROWTH_DEAD) &&
(b->tileMaterial == tiletype_material::GRASS_DEAD)))) {
(src->tileMaterial == tiletype_material::GRASS_DEAD)))) {
goto draw_subsprite;
}

Expand Down Expand Up @@ -764,16 +767,16 @@ void c_sprite::draw_world_offset(int x, int y, int z, Block * b, int tileoffset,
sheetx = ((sheetindex+tileoffset+randoffset) % SHEET_OBJECTSWIDE) * spritewidth;
sheety = ((sheetindex+tileoffset+randoffset) / SHEET_OBJECTSWIDE) * spriteheight;
} else if(tilelayout == RAMPBOTTOMTILE) {
sheetx = SPRITEWIDTH * b->ramp.index;
sheetx = SPRITEWIDTH * src->ramp.index;
sheety = ((TILEHEIGHT + FLOORHEIGHT + SPRITEHEIGHT) * (sheetindex+tileoffset+randoffset))+(TILEHEIGHT + FLOORHEIGHT);
} else if(tilelayout == RAMPTOPTILE) {
sheetx = SPRITEWIDTH * b->ramp.index;
sheetx = SPRITEWIDTH * src->ramp.index;
sheety = (TILEHEIGHT + FLOORHEIGHT + SPRITEHEIGHT) * (sheetindex+tileoffset+randoffset);
} else {
sheetx = ((sheetindex+tileoffset+randoffset) % SHEET_OBJECTSWIDE) * spritewidth;
sheety = ((sheetindex+tileoffset+randoffset) / SHEET_OBJECTSWIDE) * spriteheight;
}
ALLEGRO_COLOR shade_color = shadeAdventureMode(get_color(b), b->fog_of_war, b->designation.bits.outside);
ALLEGRO_COLOR shade_color = shadeAdventureMode(get_color(src), b->fog_of_war, b->designation.bits.outside);
if(chop && ( halftile == HALFTILECHOP)) {
if(fileindex < 0) {
if(shade_color.a > 0.001f)
Expand Down Expand Up @@ -895,7 +898,7 @@ void c_sprite::draw_world_offset(int x, int y, int z, Block * b, int tileoffset,
draw_subsprite:
if(!subsprites.empty()) {
for(int i = 0; i < subsprites.size(); i++) {
subsprites.at(i).draw_world_offset(x, y, z, b, tileoffset, chop);
subsprites.at(i).draw_world_offset_src(x, y, z, tileoffset, b, src, chop);
}
}
}
Expand Down
Loading

0 comments on commit 9cf7464

Please sign in to comment.