Add some more cutscene control stuff, fix picking up crops.

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 3e6810bc0f
commit e4432895b4
  1. 56
      SeasonsOfLoneliness.cpp
  2. BIN
      Seasons_of_Loneliness

@ -554,16 +554,18 @@ public:
}
void ActionButtonPress() {
switch (GAME_STATE) {
case GAMEWORLD:{
if (PLAYER_COORDS[0]>=8&&PLAYER_COORDS[0]<12&&
PLAYER_COORDS[1]>=2&&PLAYER_COORDS[1]<6) {
//cout<<"You are standing over plant "<<getPlantId((int)PLAYER_COORDS[0],(int)PLAYER_COORDS[1])<<" in state "<<getPlantStatus((int)PLAYER_COORDS[0],(int)PLAYER_COORDS[1]);
if (getPlantStatus((int)PLAYER_COORDS[0],(int)PLAYER_COORDS[1])==2) {
setPlantStatus((int)PLAYER_COORDS[0],(int)PLAYER_COORDS[1],0);
if (playerCanMove()) {
switch (GAME_STATE) {
case GAMEWORLD:{
if (PLAYER_COORDS[0]>=8&&PLAYER_COORDS[0]<12&&
PLAYER_COORDS[1]>=2&&PLAYER_COORDS[1]<6) {
//cout<<"You are standing over plant "<<getPlantId((int)PLAYER_COORDS[0],(int)PLAYER_COORDS[1])<<" in state "<<getPlantStatus((int)PLAYER_COORDS[0],(int)PLAYER_COORDS[1]);
if (getPlantStatus((int)PLAYER_COORDS[0],(int)PLAYER_COORDS[1])==2) {
setPlantStatus((int)PLAYER_COORDS[0],(int)PLAYER_COORDS[1],0);
}
}
}
}break;
}break;
}
}
switch (BATTLE_STATE) {
case battle::PLAYER_SELECTION:{
@ -738,7 +740,6 @@ public:
}
for (int i=0;i<8;i++) {
CUTSCENE_FLAGS[i]=false;
CUTSCENE_OBJS[i]=NULL;
}
CUTSCENE_TIMER=0;
}
@ -1097,6 +1098,9 @@ public:
CUTSCENE_OBJS[0]->flipped=true;
CUTSCENE_OBJS[0]->x-=MOVE_SPD;
}
if (MoveCameraTowardsPoint(GetMapFileCoords(7,11))) {
//Go to next part of cutscene.
}
}break;
}
@ -1843,6 +1847,38 @@ public:
}
}
}
bool MoveCameraTowardsPoint(vf2d pos,float spd=BATTLE_CAMERA_SCROLL_SPD) {
bool reachedPosition=true;
if (PLAYER_COORDS[0]!=pos.x) {
if (PLAYER_COORDS[0]<pos.x) {
PLAYER_COORDS[0]+=spd;
if (PLAYER_COORDS[0]>pos.x) {
PLAYER_COORDS[0]=pos.x;
}
} else {
PLAYER_COORDS[0]-=spd;
if (PLAYER_COORDS[0]<pos.x) {
PLAYER_COORDS[0]=pos.x;
}
}
reachedPosition=false;
}
if (PLAYER_COORDS[1]!=pos.y) {
if (PLAYER_COORDS[1]<pos.y) {
PLAYER_COORDS[1]+=spd;
if (PLAYER_COORDS[1]>pos.y) {
PLAYER_COORDS[1]=pos.y;
}
} else {
PLAYER_COORDS[1]-=spd;
if (PLAYER_COORDS[1]<pos.y) {
PLAYER_COORDS[1]=pos.y;
}
}
reachedPosition=false;
}
return reachedPosition;
}
};

Binary file not shown.
Loading…
Cancel
Save