Skip to content
Draft
Show file tree
Hide file tree
Changes from 8 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
5 changes: 3 additions & 2 deletions gframe/client_card.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ class ClientCard {
irr::core::vector3df curRot;
irr::core::vector3df dPos;
irr::core::vector3df dRot;
irr::u32 curAlpha{ 255 };
irr::u32 dAlpha{ 0 };
float curAlpha{ 255.0f };
float dAlpha{ 0.0f };
int targetAlpha{ 255 };
irr::u32 aniFrame{ 0 };
bool is_moving{ false };
bool is_fading{ false };
Expand Down
19 changes: 16 additions & 3 deletions gframe/client_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,18 @@ void ClientField::GetCardLocation(ClientCard* pcard, irr::core::vector3df* t, ir
pcard->mTransform.setRotationRadians(*r);
}
}
void ClientField::MoveCard(ClientCard * pcard, int frame) {
// Set the movement of a card over a specified number of frames.
void ClientField::SetCardMovement(ClientCard* pcard, int frame60, irr::core::vector3df dPos, irr::core::vector3df dRot) {
int frame = mainGame->ScaleFrame(frame60);
float frameScale = static_cast<float>(frame60) / frame;
pcard->dPos = dPos * frameScale;
pcard->dRot = dRot * frameScale;
pcard->is_moving = true;
pcard->aniFrame = frame;
}
// Move (reset) a card to its current location over a specified number of frames.
void ClientField::MoveCard(ClientCard * pcard, int frame60) {
int frame = mainGame->ScaleFrame(frame60);
irr::core::vector3df trans = pcard->curPos;
irr::core::vector3df rot = pcard->curRot;
GetCardLocation(pcard, &trans, &rot);
Expand Down Expand Up @@ -1104,8 +1115,10 @@ void ClientField::MoveCard(ClientCard * pcard, int frame) {
pcard->is_moving = true;
pcard->aniFrame = frame;
}
void ClientField::FadeCard(ClientCard * pcard, int alpha, int frame) {
pcard->dAlpha = (alpha - pcard->curAlpha) / frame;
void ClientField::FadeCard(ClientCard * pcard, int alpha, int frame60) {
int frame = mainGame->ScaleFrame(frame60);
pcard->targetAlpha = alpha;
pcard->dAlpha = (pcard->targetAlpha - pcard->curAlpha) / frame;
pcard->is_fading = true;
pcard->aniFrame = frame;
}
Expand Down
5 changes: 3 additions & 2 deletions gframe/client_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ class ClientField: public irr::IEventReceiver {

void GetChainLocation(int controler, int location, int sequence, irr::core::vector3df* t);
void GetCardLocation(ClientCard* pcard, irr::core::vector3df* t, irr::core::vector3df* r, bool setTrans = false);
void MoveCard(ClientCard* pcard, int frame);
void FadeCard(ClientCard* pcard, int alpha, int frame);
void SetCardMovement(ClientCard* pcard, int frame60, irr::core::vector3df dPos, irr::core::vector3df dRot = irr::core::vector3df(0, 0, 0));
void MoveCard(ClientCard* pcard, int frame60);
void FadeCard(ClientCard* pcard, int alpha, int frame60);
bool ShowSelectSum(bool panelmode); // caller must hold gMutex
bool CheckSelectSum();
bool CheckSelectTribute();
Expand Down
Loading
Loading