//Settings const int MET_WARP_EFFECT_DURATION = 90; int MetroidWarps[214747]; //!Indices 0-5 are not used to store coordinates const int MET_SAVE_NUMBER_OF_SAVEPOINTS = 10; const int MET_SAVE_BASE = 6; //Five indices per set. const int MET_SAVE_ID = 0; //Holds the ID of the point in game. const int MET_SAVE_DMAP = 1; //The DMAP for a given warp. const int MET_SAVE_SCREEN = 2; //The screen of a given warp. const int MET_SAVE_X = 3; //The X position to warp to. const int MET_SAVE_Y = 4; //The Y position to warp to. const int MET_SAVE_STATION_ACTIVE = 5; //The Y position to warp to. const itn MET_SAVE_LAST_SAVESTATION = 0; //ID of last save station used. arr[0] const int SFX_SAVE_ERROR = 88; // const int SFX_SAVE_SUCCESS = 93; // const int WARP_WAVE = 30; const int SFX_TELEPORT = 67; //Sound effect for teleportation matrix effect. const int TELEPORT_CIRCLE_COLOUR = 181; //Colour for teleport circle. const int SFX_SET_TELEPORT = 98; //Menu Sound for Setting Teleport Destination const int TELEPORT_WAVE = 60; //Duration of Teleport Wave Effect const int SFX_WARP_ERROR = 80; const int FLASH_LAYER = 6; const int TELEPORT_OVERLAY = 5; const int TELEPORT_SAFETY = 10; const int WARP_DURATION = 80; const int SFX_TELEPORT_TRANSITION = 100; //Drawing Colours const int WARP_GREEN = 45; const int WARP_BLUE = 11; const int WARP_YELLOW = 126; const int WARP_TEAL = 88; const int WARP_LTBLUE = 93; //or 88 const int WARP_LTGREEN = 44; const int WARP_BRIGHTGREEN = 47; const int WARP_PERIDOT = 97; const int WARP_SMOKE = 73; bool warpAllowed = true; //Shift this into game vars arrays and update functions. bool isWarping = false; //Shift this into game vars arrays and update functions. bool flashingGreen = false; bool teleporting = false; bool arriving = false; //! Working on these void WarpSamus(int station_id){ //Run the warp effects ffc. } bool SamusCanTeleport(){ return ( !jumping && !onLadder && ( SamusAction == SAMUS_ACTION_NONE || SamusAction == SAMUS_ACTION_CROUCH ) && !isShineSpark && OnGround() && !isSpeedBoosting && !SamusHasDied ); } //! end temp //We do this when we activate the station. void SetWarpPoint(int warp_id, ffc f){ MetroidWarps[MET_SAVE_ID + ( warp_id * MET_SAVE_BASE ) ] = warp_id; MetroidWarps[MET_SAVE_DMAP + ( warp_id * MET_SAVE_BASE ) ] = Game->GetCurDMap(); MetroidWarps[MET_SAVE_SCREEN + ( warp_id * MET_SAVE_BASE ) ] = Game->GetCurScreen(); MetroidWarps[MET_SAVE_X + ( warp_id * MET_SAVE_BASE ) ] = f->X; MetroidWarps[MET_SAVE_Y + ( warp_id * MET_SAVE_BASE ) ] = f->Y; } void SetWarpPoint(int warp_id){ MetroidWarps[MET_SAVE_ID + ( warp_id * MET_SAVE_BASE ) ] = warp_id; MetroidWarps[MET_SAVE_DMAP + ( warp_id * MET_SAVE_BASE ) ] = Game->GetCurDMap(); MetroidWarps[MET_SAVE_SCREEN + ( warp_id * MET_SAVE_BASE ) ] = Game->GetCurScreen(); MetroidWarps[MET_SAVE_X + ( warp_id * MET_SAVE_BASE ) ] = Link->X; MetroidWarps[MET_SAVE_Y + ( warp_id * MET_SAVE_BASE ) ] = Link->Y; } int WarpPointActive(int station_id) { return MetroidWarps[MET_SAVE_STATION_ACTIVE + ( station_id * MET_SAVE_BASE ) } void WarpPointActive(int station_id, bool setting) { if ( setting ) MetroidWarps[MET_SAVE_STATION_ACTIVE + ( station_id * MET_SAVE_BASE ) = 1; else MetroidWarps[MET_SAVE_STATION_ACTIVE + ( station_id * MET_SAVE_BASE ) = 0; } void SaveGame(int station_id){ SetWarpPoint(station_id); /// Game->Save(); } void SaveGameAndQuit(){ SetWarpPoint(station_id); Game->Save(); Game->End(); } void SetGameRestoreStation(int station_id){ MetroidWarps[MET_SAVE_LAST_SAVESTATION] = station_id; } int GetGameRestoreStation(){ return MetroidWarps[MET_SAVE_LAST_SAVESTATION]; } //Call during onContinue script. void RestoreGame(){ //if the game has been saved, then we have a restore station set if ( GetGameRestoreStation() ) { WarpSamus( GetGameRestoreStation(), MET_WARP_EFFECT_DURATION ); } } ffc script WarpSamus{ void run(tint station_id){ bool running; //This may not work via an ffc. Didn't we go down this road before? } } //Special suit upgrade to warp anytime int MetroidZSuit(int button1, int button2){ if ( button1 == button2 ) { int err[]="Report: MetroidXSuit buttons are both boubd to the same input!"; TraceNL(); TraceS(err); TraceNL(); return 0; } int pressed[3]; //button 1, button2, button 3 if ( button1 == BUTTON_A && ( Link->PressA || Link->InputA ) ) pressed[0] = 1; if ( button1 == BUTTON_B && ( Link->PressB || Link->InputB ) ) pressed[0] = 1; if ( button1 == BUTTON_L && ( Link->PressL || Link->InputL ) ) pressed[0] = 1; if ( button1 == BUTTON_R && ( Link->PressR || Link->InputR ) ) pressed[0] = 1; if ( button1 == BUTTON_EX1 && ( Link->PressEx1 || Link->InputEx1 ) ) pressed[0] = 1; if ( button1 == BUTTON_EX2 && ( Link->PressEx2 || Link->InputEx2 ) ) pressed[0] = 1; if ( button1 == BUTTON_EX3 && ( Link->PressEx3 || Link->InputEx3 ) ) pressed[0] = 1; if ( button1 == BUTTON_EX4 && ( Link->PressEx4 || Link->InputEx4 ) ) pressed[0] = 1; if ( button2 == BUTTON_A && ( Link->PressA || Link->InputA ) ) pressed[1] = 1; if ( button2 == BUTTON_B && ( Link->PressB || Link->InputB ) ) pressed[1] = 1; if ( button2 == BUTTON_L && ( Link->PressL || Link->InputL ) ) pressed[1] = 1; if ( button2 == BUTTON_R && ( Link->PressR || Link->InputR ) ) pressed[1] = 1; if ( button2 == BUTTON_EX1 && ( Link->PressEx1 || Link->InputEx1 ) ) pressed[1] = 1; if ( button2 == BUTTON_EX2 && ( Link->PressEx2 || Link->InputEx2 ) ) pressed[1] = 1; if ( button2 == BUTTON_EX3 && ( Link->PressEx3 || Link->InputEx3 ) ) pressed[1] = 1; if ( button2 == BUTTON_EX4 && ( Link->PressEx4 || Link->InputEx4 ) ) pressed[1] = 1; if ( pressed[0] && pressed[1] && SamusCanTeleport() ) { pressed[2] = 1; //Do warp return 1; } } const int MET_SAVE_STATION_REG = 9; //Screen->D[reg] const int MET_SAVE_STATION_DRAW_ID_FONT = 0; const int MET_SAVE_STATION_DRAW_ID_FONT_BACKGROUND_CLOUR = 0x0F; //Black const int MET_SAVE_STATION_DRAW_ID_FONT_FOREGROUND_COLOUR = 0x01; //White const int MET_SAVE_STATION_DRAW_ID_FONT_FOREGROUND_Y_scale = -1; //DrawString(0 scale factor const int MET_SAVE_STATION_DRAW_ID_FONT_BACKGROUND_X_OFFSET = 8; //Offset from f->X const int MET_SAVE_STATION_DRAW_ID_FONT_FOREGROUND_X_OFFSET = 9; //Offset from f->X const int MET_SAVE_STATION_DRAW_ID_FONT_BACKGROUND_Y_OFFSET = 8; //Offset from f->Y const int MET_SAVE_STATION_DRAW_ID_FONT_FOREGROUND_Y_OFFSET = 9; //Offset from f->Y const int MET_SAVE_STATION_ const int MET_SAVE_STATION_ const int MET_SAVE_STATION_ const int MET_SAVE_STATION_ ffc script MetroidSaveStation{ void run(int station_number){ bool pressed; int choice; while ( true ) { while ( ( !pressed && !TangoMenuIsActive() ) || ( !TangoMenuIsActive() && !SamusCanTeleport() ) ) { if ( MET_SAVE_USE_BUTTON_R && Link->PressR ) { pressed = true; Link->PressR = false; Link->InputR = false; } if ( MET_SAVE_USE_BUTTON_L && Link->PressL ) { pressed = true; Link->PressL = false; Link->InputL = false; } if ( MET_SAVE_USE_BUTTON_A && Link->PressA ) { pressed = true; Link->PressA = false; Link->InputA = false; } if ( MET_SAVE_USE_BUTTON_B && Link->PressB ) { pressed = true; Link->PressB = false; Link->InputB = false; } if ( MET_SAVE_USE_BUTTON_EX1 && Link->PressEx1 ) { pressed = true; Link->PressEx1 = false; Link->InputEx1 = false; } if ( MET_SAVE_USE_BUTTON_EX2 && Link->PressEx2 ) { pressed = true; Link->PressEx2 = false; Link->InputEx2 = false; } if ( MET_SAVE_USE_BUTTON_EX2 && Link->PressEx3 ) { pressed = true; Link->PressEx3 = false; Link->InputEx3 = false; } if ( MET_SAVE_USE_BUTTON_EX2 && Link->PressEx4 ) { pressed = true; Link->PressEx4 = false; Link->InputEx4 = false; } //If this station is active... //Draw station ID. if ( WarpPointActive(station_id) ) //Draw Waitframe(); if ( pressed ) { pressed = false; //Activate this station if it is inactive if ( !WarpPointActive(station_id) ) { WarpPointActive(station_id,true); //If this station is active... //Draw station ID. if ( WarpPointActive(station_id) ) //Draw //Do menu choice = MetroidSaveStationMenu(station_number); //Do save, activate, or warp when menu returns } Waitframe(); //Main while loop. } } } int MetroidSaveStationMenu(int station_id) { int lineBreak[]="@26"; int line1[]="@choice(1)Item Info@26"; int line2[]="@choice(2)Buy@26@choice(3)Cancel@domenu(1)@suspend()"; int free[]="@choice(2)Take@26@choice(3)Cancel@domenu(1)@suspend()"; SetUpWindow(WINDOW_SLOT_1, WINDOW_STYLE_3, 32, 32, SIZE_LARGE); Tango_LoadString(WINDOW_SLOT_1, line1); if ( price == 0 ) Tango_AppendString(WINDOW_SLOT_1, free); else Tango_AppendString(WINDOW_SLOT_1, line2); Tango_ActivateSlot(WINDOW_SLOT_1); while(!Tango_MenuIsActive()){ Waitframe(); } // Save the state again... int slotState[278]; 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 ) { // Item Info int text[256]; Game->GetMessage(msg,text); //Load msg into the buffer. ShowString(text, WINDOW_SLOT_2, WINDOW_STYLE_3, 48, 48); } else if ( choice == 2 ) { //Buy done = choice; menuArg = choice; } else if ( choice == 3 ) { //Cancel done = choice; } else if ( Link->PressEx1 ) { done = 1; } else done = 3; 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; } bool SaveMenu(){ int lineBreak[]="@26"; int menuEnd[]="@domenu(1)@suspend()"; int line1[]="@choice(1)Quick Save@26"; int line2[]="@choice(2)Full Save@26"; int line3[]="@choice(3)Save and Quit@26"; int line4[]="@choice(4)Cancel@26"; int line5[]="@26@choice(5)CLEAR SAVE"; SetUpWindow(WINDOW_SLOT_3, WINDOW_STYLE_3, 32, 32, SIZE_LARGE); Tango_LoadString(WINDOW_SLOT_3, line1); Tango_AppendString(WINDOW_SLOT_3, line2); Tango_AppendString(WINDOW_SLOT_3, line3); Tango_AppendString(WINDOW_SLOT_3, line4); Tango_AppendString(WINDOW_SLOT_3, line5); Tango_AppendString(WINDOW_SLOT_3, menuEnd); Tango_ActivateSlot(WINDOW_SLOT_3); while(!Tango_MenuIsActive()){ Waitframe(); } // Save the state again... int slotState[278]; int menuState[960]; int cursorPos; Tango_SaveSlotState(WINDOW_SLOT_3, slotState); Tango_SaveMenuState(menuState); int done=0; int choice; while(true) { while(Tango_MenuIsActive()) { cursorPos=Tango_GetMenuCursorPosition(); Waitframe(); } choice=Tango_GetLastMenuChoice(); if(choice==0) // Canceled done=2; else if(choice == 1) { done = 1; SaveGame(); Game->PlaySound(SFX_SAVE_SUCCESS); int text[]="Game State Saved"; Tango_ClearSlot(3); ShowString(text, WINDOW_SLOT_5, WINDOW_STYLE_2, 48, 48); menuArg=choice; } else if(choice == 2) { done = 1; SaveGame(true); Game->PlaySound(SFX_SAVE_SUCCESS); int text[]="Game Fully Saved"; Tango_ClearSlot(3); ShowString(text, WINDOW_SLOT_5, WINDOW_STYLE_2, 48, 48); menuArg=choice; } else if(choice == 3) { done = 1; SaveGameAndQuit(); menuArg = choice; } else if(choice == 4) { done = 1; menuArg = choice; } else if(choice == 5) { done = 1; ClearSave(); int text[]="Save Cleared"; Tango_ClearSlot(3); ShowString(text, WINDOW_SLOT_5, WINDOW_STYLE_2, 48, 48); menuArg = choice; } else if (Link->PressEx1){ done = 2; } else done=2; if(done>0){ break; } else { Tango_RestoreSlotState(WINDOW_SLOT_3, slotState); Tango_RestoreMenuState(menuState); Tango_SetMenuCursorPosition(cursorPos); } } Tango_ClearSlot(WINDOW_SLOT_3); if(done==1) return true; // Tell parent menu to close else return false; // Tell parent not to close }