Skip to content

Add bay for Wizard castle #7431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified files/data/resurrection.h2d
Binary file not shown.
9 changes: 9 additions & 0 deletions src/fheroes2/agg/agg_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4006,6 +4006,15 @@ namespace fheroes2

break;
}
case ICN::WIZARD_CASTLE_BAY: {
_icnVsSprite[id].resize( 1 );
_icnVsSprite[id][0] = GetICN( ICN::TWNZDOCK, 0 );

Sprite temp;
h2d::readImage( "wizard_castle_bay.image", temp );
Blit( temp, _icnVsSprite[id][0] );
break;
}
default:
break;
}
Expand Down
2 changes: 2 additions & 0 deletions src/fheroes2/agg/icn.h
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,8 @@ namespace ICN
BARBARIAN_CASTLE_CAPTAIN_QUARTERS_LEFT_SIDE,
SORCERESS_CASTLE_CAPTAIN_QUARTERS_LEFT_SIDE,

WIZARD_CASTLE_BAY,

GOOD_ARMY_BUTTON,
GOOD_MARKET_BUTTON,
EVIL_ARMY_BUTTON,
Expand Down
24 changes: 20 additions & 4 deletions src/fheroes2/castle/castle_building.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,29 +208,45 @@ void CastleRedrawCurrentBuilding( const Castle & castle, const fheroes2::Point &
fheroes2::Blit( sprite0, display, dst_pt.x + sprite0.x(), dst_pt.y + sprite0.y() );
}

if ( Race::WZRD == castle.GetRace() ) {
// Wizard castle has river animation in background.
const int32_t riverIcnId = ICN::TWNZEXT0;
const uint32_t riverExtraIndex = 1 + animationIndex % 5;

fheroes2::drawCastleDialogBuilding( riverIcnId, 0, castle, dst_pt, max );
fheroes2::drawCastleDialogBuilding( riverIcnId, riverExtraIndex, castle, dst_pt, max );
}

// Bay animation
if ( Race::WZRD == castle.GetRace() || ( !castle.isBuild( BUILD_SHIPYARD ) && castle.HaveNearlySea() ) ) {
int bayIcnId = 0;
if ( !castle.isBuild( BUILD_SHIPYARD ) && castle.HaveNearlySea() ) {
int32_t bayIcnId = 0;
int32_t bayAnimationIcnId = 0;
const uint32_t bayExtraIndex = 1 + animationIndex % 5;

switch ( castle.GetRace() ) {
case Race::KNGT:
bayIcnId = ICN::TWNKEXT0;
bayAnimationIcnId = ICN::TWNKEXT0;
break;
case Race::BARB:
bayIcnId = ICN::TWNBEXT0;
bayAnimationIcnId = ICN::TWNBEXT0;
break;
case Race::SORC:
bayIcnId = ICN::TWNSEXT0;
bayAnimationIcnId = ICN::TWNSEXT0;
break;
case Race::NECR:
bayIcnId = ICN::TWNNEXT0;
bayAnimationIcnId = ICN::TWNNEXT0;
break;
case Race::WRLK:
bayIcnId = ICN::TWNWEXT0;
bayAnimationIcnId = ICN::TWNWEXT0;
break;
case Race::WZRD:
bayIcnId = ICN::TWNZEXT0;
bayIcnId = ICN::WIZARD_CASTLE_BAY;
bayAnimationIcnId = ICN::TWNZDOCK;
break;
default:
// Did you add a new race? Add the logic for it!
Expand All @@ -239,7 +255,7 @@ void CastleRedrawCurrentBuilding( const Castle & castle, const fheroes2::Point &
}

fheroes2::drawCastleDialogBuilding( bayIcnId, 0, castle, dst_pt, max );
fheroes2::drawCastleDialogBuilding( bayIcnId, bayExtraIndex, castle, dst_pt, max );
fheroes2::drawCastleDialogBuilding( bayAnimationIcnId, bayExtraIndex, castle, dst_pt, max );
}

// redraw all builds
Expand Down