Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //! The physical save station.
- //! D0 : Each station needs a unique ID, ranging from 1 to 10.
- //! The script is set up to allow up to a total of ten save stations using the menus.
- ffc script Save_Point{
- void run(int station_number, int message){
- bool pressed;
- int choice;
- while ( true ) {
- while ( !pressed && !Tango_MenuIsActive() ) {
- if (LinkCollision(this)){
- Screen->FastCombo(4,Link->X,Link->Y-16,THINK_COMBO,10,128);
- if (Link->PressA) {
- pressed = true;
- Link->PressA = false;
- Link->InputA = false;
- }
- }
- Waitframe();
- }
- if ( pressed ) {
- pressed = false;
- //Set coordinates for this station:
- choice = SavePointMenu(station_number, message);
- }
- Waitframe(); //Main while loop.
- }
- }
- }
- //Tango Menu Init
- void SetUpWindow(int slot, int style, int x, int y, int size)
- {
- SetStyleSize(style, size);
- Tango_ClearSlot(slot);
- Tango_SetSlotStyle(slot, style);
- Tango_SetSlotPosition(slot, x, y);
- }
- //Quick way to drop a string into a Tango dialogue box.
- void ShowString(int string, int slot, int style, int x, int y)
- {
- SetUpWindow(slot, style, x, y, STYLE_HEART);
- Tango_LoadString(slot, string);
- Tango_ActivateSlot(slot);
- while(Tango_SlotIsActive(slot))
- Waitframe();
- }
- //Menu called by the save station ffc.
- int SavePointMenu(int station_id, int message) {
- int lineBreak[]="@26";
- int line1[]="@choice(1)Save@26";
- int line2[]="@choice(2)Save and Quit@26";
- int line3[]="@choice(3)Cancel";
- int initmenu[]="@domenu(1)@suspend()";
- if ( station_id ) {
- ShowMessage(message, TANGO_SLOT_NORMAL,WINDOW_STYLE_1, STYLE_HEART, 16, 16);
- Waitframe();
- SetUpWindow(WINDOW_SLOT_1,WINDOW_STYLE_1,48,48,STYLE_PLAIN);
- Tango_LoadString(WINDOW_SLOT_1, line1);
- Tango_AppendString(WINDOW_SLOT_1, line2);
- Tango_AppendString(WINDOW_SLOT_1, line3);
- Tango_AppendString(WINDOW_SLOT_1, initmenu);
- Tango_ActivateSlot(WINDOW_SLOT_1);
- }
- while(!Tango_MenuIsActive()){
- Waitframe();
- }
- // Save the state again...
- int slotState[533];
- int menuState[960];
- int cursorPos;
- Tango_SaveSlotState(WINDOW_SLOT_1, slotState);
- Tango_SaveMenuState(menuState);
- int done = 0;
- int choice;
- while(true){
- while( Tango_MenuIsActive() ) {
- cursorPos=Tango_GetMenuCursorPosition();
- Waitframe();
- }
- choice = Tango_GetLastMenuChoice();
- if ( choice == 1) { // Save the game
- SaveGame(station_id);
- Game->PlaySound(SFX_SAVE_SUCCESS);
- int text[]="Game Saved";
- Tango_ClearSlot(TANGO_SLOT_NORMAL);
- Tango_ClearSlot(WINDOW_SLOT_1);
- ShowString(text, WINDOW_SLOT_1, WINDOW_STYLE_1, 48, 48);
- done = -9999;
- }
- else if ( choice == 2 ) { //Save and quit
- Game->PlaySound(SFX_SAVE_SUCCESS);
- SaveGameAndQuit(station_id);
- done = choice;
- }
- else if ( choice == 3){//Cancel
- Tango_ClearSlot(TANGO_SLOT_NORMAL);
- done = -9999;
- }
- if ( done )
- break;
- // return choice;
- else {
- Tango_RestoreSlotState(WINDOW_SLOT_1, slotState);
- Tango_RestoreMenuState(menuState);
- Tango_SetMenuCursorPosition(cursorPos);
- }
- }
- Tango_ClearSlot(WINDOW_SLOT_1);
- return done;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement