Flip support on cutscene sprites

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 83d4c55848
commit 3e6810bc0f
  1. 19
      SeasonsOfLoneliness.cpp

@ -121,6 +121,7 @@ class Object{
Animation*anim; Animation*anim;
vi2d spos; vi2d spos;
vi2d size; vi2d size;
bool flipped;
bool hascut=false; bool hascut=false;
bool tempObj; bool tempObj;
Object(){}; Object(){};
@ -286,6 +287,7 @@ public:
cutscene::CUTSCENE CURRENT_CUTSCENE=cutscene::NONE; cutscene::CUTSCENE CURRENT_CUTSCENE=cutscene::NONE;
int CUTSCENE_TIMER=0; int CUTSCENE_TIMER=0;
bool CUTSCENE_FLAGS[8]; bool CUTSCENE_FLAGS[8];
Object*CUTSCENE_OBJS[8];
bool messageBoxVisible=false; bool messageBoxVisible=false;
int messageBoxCursor; int messageBoxCursor;
std::string messageBoxSpeaker; std::string messageBoxSpeaker;
@ -736,6 +738,7 @@ public:
} }
for (int i=0;i<8;i++) { for (int i=0;i<8;i++) {
CUTSCENE_FLAGS[i]=false; CUTSCENE_FLAGS[i]=false;
CUTSCENE_OBJS[i]=NULL;
} }
CUTSCENE_TIMER=0; CUTSCENE_TIMER=0;
} }
@ -1072,7 +1075,7 @@ public:
case cutscene::CUTSCENE_4:{ case cutscene::CUTSCENE_4:{
if (!messageBoxVisible) { if (!messageBoxVisible) {
if (!CUTSCENE_FLAGS[0]) { if (!CUTSCENE_FLAGS[0]) {
CreateObject(GetMapFileCoords(8,17),PLAYER_DECAL,{64,0},{32,32}); CUTSCENE_OBJS[0]=CreateObject(GetMapFileCoords(8,17),PLAYER_DECAL,{64,0},{32,32},true);
CUTSCENE_FLAGS[0]=true; CUTSCENE_FLAGS[0]=true;
DisplayMessageBox(0); DisplayMessageBox(0);
} else } else
@ -1085,6 +1088,16 @@ public:
} }
} }
}break; }break;
case cutscene::PAN_OVER_TO_CROPS:{
if (CUTSCENE_OBJS[0]->y>4) {
CUTSCENE_OBJS[0]->y-=MOVE_SPD;
} else
if (CUTSCENE_OBJS[0]->x>13) {
CUTSCENE_OBJS[0]->spos={32,0};
CUTSCENE_OBJS[0]->flipped=true;
CUTSCENE_OBJS[0]->x-=MOVE_SPD;
}
}break;
} }
switch (GAME_STATE) { switch (GAME_STATE) {
@ -1325,10 +1338,10 @@ public:
DrawPartialDecal({(obj->x-PLAYER_COORDS[0])*32+WIDTH/2-16*(float)sin(frameCount*2/60.0)+16,(obj->y-PLAYER_COORDS[1])*32+HEIGHT/2},obj->anim->spr,{obj->anim->getCurrentFrame().x,obj->anim->getCurrentFrame().y},{obj->anim->width,obj->anim->height},{(float)sin(frameCount*2/60.0),1},Pixel((float)sin(frameCount*4/60.0)*55+200,(float)sin(frameCount*4/60.0)*55+200,(float)sin(frameCount*4/60.0+M_PI)+65*125,255)); DrawPartialDecal({(obj->x-PLAYER_COORDS[0])*32+WIDTH/2-16*(float)sin(frameCount*2/60.0)+16,(obj->y-PLAYER_COORDS[1])*32+HEIGHT/2},obj->anim->spr,{obj->anim->getCurrentFrame().x,obj->anim->getCurrentFrame().y},{obj->anim->width,obj->anim->height},{(float)sin(frameCount*2/60.0),1},Pixel((float)sin(frameCount*4/60.0)*55+200,(float)sin(frameCount*4/60.0)*55+200,(float)sin(frameCount*4/60.0+M_PI)+65*125,255));
} else } else
if (obj->hasAnim) { if (obj->hasAnim) {
DrawPartialDecal({(obj->x-PLAYER_COORDS[0])*32+WIDTH/2+(obj->anim->flipped?32:0),(obj->y-PLAYER_COORDS[1])*32+HEIGHT/2},obj->anim->spr,{obj->anim->getCurrentFrame().x,obj->anim->getCurrentFrame().y},{obj->anim->width,obj->anim->height},{obj->anim->flipped?-1:1,1}); DrawPartialDecal({(obj->x-PLAYER_COORDS[0])*32+WIDTH/2+(obj->anim->flipped?obj->anim->width:0),(obj->y-PLAYER_COORDS[1])*32+HEIGHT/2},obj->anim->spr,{obj->anim->getCurrentFrame().x,obj->anim->getCurrentFrame().y},{obj->anim->width,obj->anim->height},{obj->anim->flipped?-1:1,1});
} else } else
if (obj->hascut) { if (obj->hascut) {
DrawPartialDecal({(obj->x-PLAYER_COORDS[0])*32+WIDTH/2,(obj->y-PLAYER_COORDS[1])*32+HEIGHT/2},obj->spr,obj->spos,obj->size); DrawPartialDecal({(obj->x-PLAYER_COORDS[0])*32+WIDTH/2+(obj->flipped?obj->size.x:0),(obj->y-PLAYER_COORDS[1])*32+HEIGHT/2},obj->spr,obj->spos,obj->size,{obj->flipped?-1:1,1});
} else { } else {
DrawDecal({(obj->x-PLAYER_COORDS[0])*32+WIDTH/2,(obj->y-PLAYER_COORDS[1])*32+HEIGHT/2},obj->spr); DrawDecal({(obj->x-PLAYER_COORDS[0])*32+WIDTH/2,(obj->y-PLAYER_COORDS[1])*32+HEIGHT/2},obj->spr);
} }

Loading…
Cancel
Save