|
|
|
@ -58,6 +58,7 @@ class Object{ |
|
|
|
|
virtual Object* CreateType(int id,std::string name,vd2d pos,Animation*spr,vd2d scale={1,1},Pixel color=WHITE,int animationSpd=1,bool temp=false)=0; |
|
|
|
|
//When the player tries to interact with this object.
|
|
|
|
|
virtual Interaction Interact()=0; |
|
|
|
|
virtual void ChoiceMade(int choice)=0; |
|
|
|
|
void SetScale(vd2d scale) { |
|
|
|
|
this->scale=scale; |
|
|
|
|
if (spr!=nullptr) { |
|
|
|
@ -171,6 +172,7 @@ class Object{ |
|
|
|
|
class Standard_Obj : public Object{ |
|
|
|
|
DynamicObject(Standard_Obj) |
|
|
|
|
Interaction Interact()override{return {};} |
|
|
|
|
void ChoiceMade(int choice)override{} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
class TrashCan_Obj : public Object{ |
|
|
|
@ -178,6 +180,7 @@ class TrashCan_Obj : public Object{ |
|
|
|
|
Interaction Interact()override{ |
|
|
|
|
frameIndex=1; |
|
|
|
|
return {{"You dig around the trash can.","Nope! Just looks like plain ol' trash."}};} |
|
|
|
|
void ChoiceMade(int choice)override{} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
extern int MESSAGE_BOX_DIALOG_ANSWER; |
|
|
|
@ -191,15 +194,25 @@ class Shopkeeper_Obj : public Object{ |
|
|
|
|
>1:What would you like to sell?\
|
|
|
|
|
>2:Are you okay?<"; |
|
|
|
|
Interaction Interact()override{ |
|
|
|
|
if (GAME_FLAGS[(int)Flag::SHOPKEER_BRANCH1]&&MESSAGE_BOX_DIALOG_ANSWER==2) { |
|
|
|
|
MESSAGE_BOX_DIALOG_ANSWER=0; |
|
|
|
|
if (GAME_FLAGS[(int)Flag::SHOPKEER_BRANCH1]) { |
|
|
|
|
GAME_FLAGS[(int)Flag::SHOPKEER_BRANCH1]=false; |
|
|
|
|
return {{"No! Stay away! [Okay,Ignore]\
|
|
|
|
|
>0:Yeah I thought so.\
|
|
|
|
|
>1:...<"}}; |
|
|
|
|
switch (MESSAGE_BOX_DIALOG_ANSWER) { |
|
|
|
|
case 2:{ |
|
|
|
|
return {{"No! Stay away! [Okay,Ignore]\
|
|
|
|
|
>0:Yeah I thought so.\
|
|
|
|
|
>1:...<"}}; |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
return {{welcomeMessage},flag:Flag::SHOPKEER_BRANCH1}; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
void ChoiceMade(int choice)override{ |
|
|
|
|
if (GAME_FLAGS[(int)Flag::SHOPKEER_BRANCH1]) { |
|
|
|
|
if (choice!=2) { |
|
|
|
|
GAME_FLAGS[(int)Flag::SHOPKEER_BRANCH1]=false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
#endif |