Skip to content

Commit

Permalink
Script API: turn ViewFrame.Flipped to eFlipDirection
Browse files Browse the repository at this point in the history
This is backwards compatible, because old boolean value matches "No Flip" and "Horizontal Flip".
  • Loading branch information
ivan-mogilko committed Dec 14, 2024
1 parent ec3c87f commit c4007b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Editor/AGS.Editor/Resources/agsdefns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ enum eVoiceMode {
};
enum eFlipDirection {
eFlipNone = 0,
eFlipLeftToRight = 1,
eFlipUpsideDown = 2,
eFlipBoth = 3
Expand Down Expand Up @@ -725,7 +726,7 @@ builtin managed struct AudioClip;
builtin managed struct ViewFrame {
/// Gets whether this frame is flipped.
readonly import attribute bool Flipped;
readonly import attribute eFlipDirection Flipped;
/// Gets the frame number of this frame.
readonly import attribute int Frame;
/// Gets/sets the sprite that is displayed by this frame.
Expand Down
6 changes: 2 additions & 4 deletions Engine/ac/viewframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ extern CCAudioClip ccDynamicAudioClip;


int ViewFrame_GetFlipped(ScriptViewFrame *svf) {
// TODO: can return GraphicFlip here, because old boolean value matches horizontal flip
if ((views[svf->view].loops[svf->loop].frames[svf->frame].flags & kSprTf_FlipX) != 0)
return 1;
return 0;
// We can return GraphicFlip here, because old boolean value matches horizontal flip
return GfxDef::GetFlipFromFlags(views[svf->view].loops[svf->loop].frames[svf->frame].flags);
}

int ViewFrame_GetGraphic(ScriptViewFrame *svf) {
Expand Down

0 comments on commit c4007b4

Please sign in to comment.