Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //%MGSO% DECLARATION Tango?
- //%MGSO% DECLARATION g
- //%MGSO% DECLARATION glob march
- //%MGSO% DECLARATION mapglobal
- //%MGSO% DECLARATION seeds
- //%MGSO% DECLARATION ddd
- //%MGSO% DECLARATION spalsh
- //%MGSO% DECLARATION old
- //%MGSO% DECLARATION power bracelet
- //%MGSO% DECLARATION moosh glob
- //%MGSO% DECLARATION autoghost
- //%MGSO% DECLARATION OG global
- //%MGSO% DECLARATION GB SHIELD
- //%MGSO% DECLARATION gasha enemy
- //%MGSO% DECLARATION link collide
- //%MGSO% DECLARATION mooshmap
- //%MGSO% DECLARATION platform
- //%MGSO% DECLARATION yargcheat
- //%MGSO% DECLARATION floor spinner global
- //%MGSO% DECLARATION globalcont
- //%MGSO% DECLARATION spinneronexit
- //%MGSO% HEADER_START Tango?
- //%MGSO% HEADER_END Tango?
- //%MGSO% HEADER_START g
- //%MGSO% HEADER_START glob march
- //%MGSO% HEADER_START seeds
- //%MGSO% HEADER_END seeds
- //%MGSO% HEADER_START mapglobal
- //FlounderMAJ Custom Map Global and FFC Scripts
- //---See the Manual and Quest Example for complete setup instructions---
- //Import this into the ZQuest buffer along with MapHeader.zh and std.zh
- //---Global---
- //This is the main global script for displaying maps. It sets up all the variables and calls the functions needed.
- //Add other code for your global script where indicated.
- //---FFCs---
- //The following FFC Scripts are used to create or remove marks on the maps. Place SetMarks on a screen Where you want up to 6 marks to be set.
- //Place UnsetMarks on a screen you will enter after obtaining an item that will unset the mark, such as a Triforce fragment.
- //Place BossNoReturn on a boss screen if the boss you are using doesn't set the "Enemy No Return" state for some reason.
- //Place this on the screen where you want the marks to be set on the map. The Script uses the D0 screen register of the screen where the mark
- //will be set. Up to 6 marks can be set at one time.
- //Script Variables
- //D0: The Dmap where the screens to be marked reside.
- //D1-D6: The screens to be marked. If unused, set to -1.
- //D7: This is the iteration of this script. If more than 6 marks are needed, or more marks are to be set later, increment this. This prevents an
- //iteration of this script from running more than once. Must be at least 1.
- ffc script SetMarks
- {
- void run (int dmap, int s0, int s1, int s2, int s3, int s4, int s5, int setmarks)
- {
- int Sarray[6]={s0,s1,s2,s3,s4,s5};
- int i;
- while (setmarksbeenrun<setmarks-1)
- {
- Waitframe();
- }
- if (setmarksbeenrun==setmarks-1)
- {
- for (i=0; i<6; i++)
- {
- if (Sarray[i]>-1) Game->SetDMapScreenD(dmap, Sarray[i], 0, 1);
- Waitframe();
- }
- setmarksbeenrun++;
- Quit();
- }
- else Quit();
- }
- }
- //Place this on a screen where you want a single mark to be unset, such as the screen you warp to after finishing a dungeon.
- //Marks can be unset by obtaining a certain item, like a sword, or by obtaining a certain level's specific item.
- //Script Variables
- //D0: The item that unsets the mark. If unused, set to -1.
- //D1: The DMap of the marked screen.
- //D2: The screen to be unmarked.
- //D3: The Level for which the level item specified must be obtained to unset the mark. If unused, set to -1.
- //If using Triforce and anything other than the 8 normal triforce pieces, this may work strangely.
- //D4: The Level item that must be obtained. Check the LI_ constants in 'std.zh' for values. If unused, set to 0.
- ffc script UnsetMarks
- {
- void run (int item0, int dmap0, int screen0, int level0, int LevelItem0)
- {
- while(Game->GetDMapScreenD(dmap0, screen0, 0)==1)
- {
- if (item0>=0&&Link->Item[item0]) {Game->SetDMapScreenD(dmap0, screen0, 0, 0); setmarksbeenrun++;}
- else if (level0>=0&&GetLevelItem(level0, LevelItem0)) {Game->SetDMapScreenD(dmap0, screen0, 0, 0); setmarksbeenrun++;}
- else Quit();
- Waitframe();
- }
- Quit();
- }
- }
- //---See the Manual and Quest Example for complete setup instructions---
- //%MGSO% HEADER_END mapglobal
- //%MGSO% HEADER_START ddd
- //%MGSO% HEADER_START spalsh
- //%MGSO% HEADER_END spalsh
- //%MGSO% HEADER_START old
- //%MGSO% HEADER_START power bracelet
- // global constants
- const int CF_PICK = 101; // SCRIPT1, bracelet
- const int SCRIPT_POWERBRACELET = 9; // set this to the ffc script slot assigned to PowerBracelet script when compiling
- const int LTM_CATCHING = 135; // LTM for Link catching a block with the Power Bracelet
- const int LTM_PULLING = 136; // LTM for Link pulling a block with the Power Bracelet
- const int LTM_HOLDING = 133; // LTM for Link holding a block with the Power Bracelet
- const int BLOCK_VH=4; //thrown block/bush horizontal initial velocity
- const int BLOCK_VV=0; //thrown block/bush vertical initial velocity
- const int BLOCK_DMG=8; //damage dealt to enemies by thrown block/bush
- const int LW_BLOCK = 31; //id of a lweapon to be used as thrown block
- const float BLOCK_FALL = 0.5; //gravity acceleration for block in sideview screens
- const int PB_PULL_TIME=15; // num of frames to wait for pickup with PB
- const int PB_UNDERCOMBO=0; // combo to set after picking up a block; set a negative value to have a shift of the original combo
- const int SFX_PICKUP_BLOCK = 99; // sfx played when link picks up the block
- const int SFX_THROW_BLOCK = 100; // sfx played when the block is thrown
- const int SFX_CRASH_BLOCK = 101; // sfx of a block crashing
- const int INV_COMBO_ID = 41; // id af an invisible combo
- const int INV_TILE_ID = 11661; // id af an invisible tile
- const int CRASH_SPR = 98; // sprite for a block crashing at ground
- const int BUSH_SPR = 52; // sprite for a bush crashing at ground
- const int LAYER_OVER = 3; // an overhead layer
- const int NPC_ITEMSET = 193; // id of a dummy enemy with type different from "none"
- // ------------------------------------------
- // global variables
- bool throw_disabled;
- int holding_block;
- bool holding_bush;
- int link_catching;
- void PowerBracelet(){
- if(Link->Item[LTM_HOLDING]){
- if(CountFFCsRunning(SCRIPT_POWERBRACELET)==0 && holding_block>0){
- holding_block = 0;
- Link->Item[LTM_HOLDING] = false;
- Link->Item[LTM_CATCHING] = false;
- Link->Item[LTM_PULLING] = false;
- }
- }
- }
- //%MGSO% HEADER_END power bracelet
- //%MGSO% HEADER_START moosh glob
- //%MGSO% HEADER_START autoghost
- //%MGSO% HEADER_END autoghost
- //%MGSO% HEADER_START OG global
- //%MGSO% HEADER_START link collide
- const int HEROPUSHLTM = 145; //Item that has the LTM setting for pushing.
- const int REALCLIMBLTM = 146; //Item that has the LTM setting for climing (all directions should be facing up).
- const int REALCLIMBCOMBOT = CT_SCRIPT2; //Combo type for ladders.
- const int HERODEFAULTSTEP = 150; //Normal step speed (150 is default ZC).
- int HEROEXTRASTATE = 0;
- const int HX_NONE = 0;
- const int HX_PUSHING = 1;
- const int HX_CLIMBING = 2;
- //const int HX_SLEEPING = 3;
- int HEROEXTRAPREV = 0;
- //int HEROSLEEPTIMER;
- //int HEROSLEEPCURRTILE;
- bool DISABLEPUSH = false;
- void heroExtraStateInit() {
- Hero->Step = HERODEFAULTSTEP;
- DISABLEPUSH = false;
- }
- void heroExtraState() {
- //Handle sleep on its own - commented out
- /*
- if (HEROEXTRASTATE == HX_SLEEPING) {
- if (HEROSLEEPTIMER == 119) {
- HEROEXTRAPREV = HX_SLEEPING;
- }
- if (HEROEXTRAPREV != HX_SLEEPING) {
- HEROSLEEPTIMER = 120;
- HEROSLEEPCURRTILE = SLEEPTILE;
- }
- Hero->ScriptTile = HEROSLEEPCURRTILE;
- NoInput();
- if (HEROSLEEPTIMER%8 == 0) {
- HEROSLEEPCURRTILE++;
- if (HEROSLEEPCURRTILE == SLEEPTILE+8) {
- HEROSLEEPCURRTILE = SLEEPTILE;
- }
- }
- HEROSLEEPTIMER--;
- if ((HEROSLEEPTIMER == 0) or (Hero->Action == LA_GOTHURTLAND)) {
- Hero->ScriptTile = -1;
- HEROEXTRASTATE = HX_NONE;
- HEROEXTRAPREV = HX_NONE;
- }
- }*/
- //Check for the extra state conditions
- if ((Screen->ComboT[ComboAt(CenterLinkX(),CenterLinkY())] == REALCLIMBCOMBOT) and (Hero->Z==0)) {
- HEROEXTRAPREV = HEROEXTRASTATE;
- HEROEXTRASTATE = HX_CLIMBING;
- }
- else if ((Hero->Pushing)
- and (Hero->Action == LA_WALKING)
- and (Hero->Z==0)
- and (Screen->MovingBlockX == -1)
- and (!DISABLEPUSH)) {
- //Extra if check for z4bomb / power bracelet compatibility - commented out
- //if ((!Hero->Item[Z4BOMBPICKLTM]) and (!Hero->Item[Z4BOMBHOLDLTM]) and (!Hero->Item[PBRACE_LTM_HOLDING])) {
- HEROEXTRAPREV = HEROEXTRASTATE;
- HEROEXTRASTATE = HX_PUSHING;
- //}
- }
- else {
- HEROEXTRAPREV = HEROEXTRASTATE;
- HEROEXTRASTATE = HX_NONE;
- }
- //Handle exiting push
- if ((HEROEXTRAPREV == HX_PUSHING) and (HEROEXTRASTATE != HX_PUSHING)) {
- Hero->Item[HEROPUSHLTM] = false;
- Hero->DrawXOffset = 0;
- Hero->DrawYOffset = 0;
- }
- //Handle exiting climb
- else if ((HEROEXTRAPREV == HX_CLIMBING) and (HEROEXTRASTATE != HX_CLIMBING)) {
- Hero->Item[REALCLIMBLTM] = false;
- Hero->Step = HERODEFAULTSTEP;
- }
- //Handle push
- if (HEROEXTRASTATE == HX_PUSHING) {
- Hero->Item[HEROPUSHLTM] = true;
- switch (Hero->Dir) {
- case DIR_RIGHT: { Hero->DrawXOffset = 3; Hero->DrawYOffset = 0; break;}
- case DIR_LEFT: { Hero->DrawXOffset = -3; Hero->DrawYOffset = 0; break;}
- case DIR_DOWN: { Hero->DrawXOffset = 0; Hero->DrawYOffset = 2; break;}
- }
- }
- //Handle climb
- else if (HEROEXTRASTATE == HX_CLIMBING) {
- if (Hero->Action == LA_CHARGING) {
- Hero->Action = LA_WALKING;
- }
- Input->Button[CB_A] = false;
- Input->Button[CB_B] = false;
- Input->Button[CB_EX1] = false;
- Input->Button[CB_EX2] = false;
- Hero->Item[REALCLIMBLTM] = true;
- Hero->Step = HERODEFAULTSTEP / 2;
- }
- }
- //%MGSO% HEADER_END link collide
- //%MGSO% HEADER_START GB SHIELD
- const int SFX_GBSHIELD = 98; //Shield active SFX
- int shieldItem; //Shield item to give (set by item script, reset each frame)
- bool shieldButton; //False = B, True = A
- //%MGSO% HEADER_END GB SHIELD
- //%MGSO% HEADER_START gasha enemy
- void GB_Gasha_EnemyDying(){
- for(int i = 1; i <= Screen->NumNPCs(); i ++){
- npc nme = Screen->LoadNPC(i); //Loads the NPC
- if(GB_Gasha_IsDying(nme)){ //Check to see if the NPC is dying.
- if(nme->Misc[GASHA_DYINGTIMER] == 14){
- for(int i = 0; i < 98; i++){
- if(GB_GASHA[i] > -1) GB_GASHA[i] ++;
- if(Link->Item[GASHA_Ring_ID] && GASHA_Ring_ID != 0 && GB_GASHA[i] > -1) GB_GASHA[i] ++;
- }
- }
- nme->Misc[GASHA_DYINGTIMER] ++; //Increment the NPC's dying timer
- }
- }
- }
- //%MGSO% HEADER_END gasha enemy
- //%MGSO% HEADER_START mooshmap
- //+=======================================+
- //| MooshMap Global Script |
- //+=======================================+
- //Combine this with any other global scripts you may be using.
- //Function to freeze the screen
- void MooshMap_ScreenFreeze(){
- ffc f1 = Screen->LoadFFC(FFC_SCREENFREEZEA);
- f1->Data = CMB_SCREENFREEZEA;
- ffc f2 = Screen->LoadFFC(FFC_SCREENFREEZEB);
- f2->Data = CMB_SCREENFREEZEB;
- }
- //Function to unfreeze the screen
- void MooshMap_ScreenUnfreeze(){
- ffc f1 = Screen->LoadFFC(FFC_SCREENFREEZEA);
- f1->Data = 0;
- ffc f2 = Screen->LoadFFC(FFC_SCREENFREEZEB);
- f2->Data = 0;
- }
- //Run in the first frame of the global
- void MooshMap_Init(){
- MooshMap_ScreenUnfreeze(); //If the screen is somehow frozen when starting, unfreeze
- MooshMap[MM_ISOPEN] = 0; //In case of F6
- MooshMap[MM_LASTDMAP] = Game->GetCurDMap();
- MooshMap[MM_LASTSCREEN] = Game->GetCurScreen();
- MooshMap[MM_LASTSCREENSTATES] = MooshMap_GetAllScreenStates();
- }
- //Run every frame in the global to run the map script
- void MooshMap_Update(){
- if(MOOSHMAP_VISITED_CARRYOVER){
- MooshMap_UpdateCarryover();
- }
- if(Game->DMapFlags[Game->GetCurDMap()]&(1<<DMF_ALLOWMAP)){
- if(MooshMap[MM_ISOPEN]){ //If the map is open
- if(MooshMap[MM_OPENFRAMES]>0){ //Opening animation
- if(MooshMap[MM_OPENFRAMES]>9){
- Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
- }
- else if(MooshMap[MM_OPENFRAMES]>6){
- Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
- Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
- }
- else if(MooshMap[MM_OPENFRAMES]>3){
- MooshMap_DrawAll(MooshMap[MM_SELECTEDFLOOR]);
- Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
- Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
- }
- else{
- MooshMap_DrawAll(MooshMap[MM_SELECTEDFLOOR]);
- Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
- }
- MooshMap[MM_OPENFRAMES]--;
- }
- else{
- MooshMap_DrawAll(MooshMap[MM_SELECTEDFLOOR]);
- if(MooshMap[MM_NUMFLOORS]>1){
- if(Link->InputUp||Link->InputDown){
- if(Link->InputUp&&!Link->InputDown){
- if(MooshMap[MM_FLOORSWITCHFRAMES]>0)
- MooshMap[MM_FLOORSWITCHFRAMES]--;
- }
- else if(Link->InputDown&&!Link->InputUp){
- if(MooshMap[MM_FLOORSWITCHFRAMES]>0)
- MooshMap[MM_FLOORSWITCHFRAMES]--;
- }
- else
- MooshMap[MM_FLOORSWITCHFRAMES] = 16;
- }
- if(Link->PressUp||(Link->InputUp&&MooshMap[MM_FLOORSWITCHFRAMES]<=0)){
- MooshMap[MM_FLOORSWITCHFRAMES] = 16;
- Game->PlaySound(SFX_MAPSUBSCREEN_FLOORCHANGE);
- MooshMap[MM_SELECTEDFLOOR]++;
- //Wrap selection
- if(MooshMap[MM_SELECTEDFLOOR]>MooshMap[MM_NUMFLOORS]-1)
- MooshMap[MM_SELECTEDFLOOR] = 0;
- MooshMap_UpdateBitmap(MooshMap[MM_SELECTEDFLOOR]); //The floor has changed, so we must update the bitmaps
- }
- else if(Link->PressDown||(Link->InputDown&&MooshMap[MM_FLOORSWITCHFRAMES]<=0)){
- MooshMap[MM_FLOORSWITCHFRAMES] = 16;
- Game->PlaySound(SFX_MAPSUBSCREEN_FLOORCHANGE);
- MooshMap[MM_SELECTEDFLOOR]--;
- //Wrap selection
- if(MooshMap[MM_SELECTEDFLOOR]<0)
- MooshMap[MM_SELECTEDFLOOR] = MooshMap[MM_NUMFLOORS]-1;
- MooshMap_UpdateBitmap(MooshMap[MM_SELECTEDFLOOR]); //The floor has changed, so we must update the bitmaps
- }
- }
- if(Link->PressMap){
- Game->PlaySound(SFX_MAPSUBSCREEN_CLOSE);
- MooshMap[MM_ISOPEN] = 0; //The map is closed now
- MooshMap[MM_OPENFRAMES] = 12; //It takes 12 frames to play the full closing animation
- }
- Link->InputStart = false;
- Link->PressStart = false;
- NoAction();
- }
- }
- else{ //Otherwise, check if Link is trying to open it
- if(MooshMap[MM_OPENFRAMES]>0){ //Closing animation
- if(MooshMap[MM_OPENFRAMES]>9){
- MooshMap_DrawAll(MooshMap[MM_SELECTEDFLOOR]);
- Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
- }
- else if(MooshMap[MM_OPENFRAMES]>6){
- MooshMap_DrawAll(MooshMap[MM_SELECTEDFLOOR]);
- Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
- Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
- }
- else if(MooshMap[MM_OPENFRAMES]>3){
- Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
- Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
- }
- else{
- Screen->Rectangle(7, 0, 0, 255, 175, C_BLACK, 1, 0, 0, 0, true, 64);
- }
- MooshMap[MM_OPENFRAMES]--;
- if(MooshMap[MM_OPENFRAMES]<=0) //Unfreeze once the closing animation ends
- MooshMap_ScreenUnfreeze();
- }
- else if(Link->PressMap){
- if(MooshMap_LoadLevelMapData()){ //Only continue if we can get the floor data successfully
- MooshMap_ScreenFreeze();
- MooshMap_UpdateBitmap(MooshMap[MM_SELECTEDFLOOR]); //Update the non animated parts of the map before loading (screens, markers)
- Game->PlaySound(SFX_MAPSUBSCREEN_OPEN);
- MooshMap[MM_ISOPEN] = 1; //The map is open now
- MooshMap[MM_OPENFRAMES] = 12; //It takes 12 frames to play the full opening animation
- }
- }
- }
- Link->InputMap = false;
- Link->PressMap = false;
- }
- }
- //Get a decimal number from a combo on a screen.
- //If it's not a decimal marker combo, return -1.
- int MooshMap_GetCMBDec(int map, int scrn, int pos){
- int cd = Game->GetComboData(map, scrn, pos);
- if(cd>=CMB_DEC&&cd<=CMB_DEC+MAX_DEC)
- return cd-CMB_DEC;
- return -1;
- }
- //Get a hexadecimal number from a combo on a screen.
- //If it's not a hex marker combo, return -1.
- int MooshMap_GetCMBHex(int map, int scrn, int pos){
- int cd = Game->GetComboData(map, scrn, pos);
- if(cd>=CMB_HEX&&cd<=CMB_HEX+MAX_HEX)
- return cd-CMB_HEX;
- return -1;
- }
- //Get map data from a screen based on the current Level
- bool MooshMap_LoadLevelMapData(){
- if(Game->GetCurScreen()>=0x80)
- return false;
- int num;
- int level = Game->GetCurLevel();
- num = MooshMap_GetCMBDec(MAP_MOOSHMAP_DATA, level, 3);
- MooshMap[MM_BGMAP] = MAP_MOOSHMAP_BG;
- MooshMap[MM_BGSCREEN] = SCREEN_MOOSHMAP_BG;
- if(num>-1){ //If there's a custom background map set, store that
- MooshMap[MM_BGMAP] = num;
- num = MooshMap_GetCMBHex(MAP_MOOSHMAP_DATA, level, 4);
- if(num>-1) //Same for background screen
- MooshMap[MM_BGSCREEN] = num;
- }
- MooshMap[MM_NUMFLOORS] = 0;
- MooshMap[MM_SELECTEDFLOOR] = 0;
- MooshMap[MM_LINKFLOOR] = -1;
- for(int i=0; i<13; i++){ //Cycle through all valid floor slots
- num = MooshMap_GetCMBDec(MAP_MOOSHMAP_DATA, level, 51+i);
- if(num==-1) //If there's no valid ref map at this position
- break; //Break the loop
- else{ //Otherwise, assume this is a valid floor
- MooshMap[MM_NUMFLOORS]++;
- //Combo, CSet
- MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_FLOORCMB] = Game->GetComboData(MAP_MOOSHMAP_DATA, level, 35+i);
- MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_FLOORCS] = Game->GetComboCSet(MAP_MOOSHMAP_DATA, level, 35+i);
- //Ref Map (Also used earlier to check if it's a valid floor)
- MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_REFMAP] = num;
- //Ref Screen
- num = MooshMap_GetCMBHex(MAP_MOOSHMAP_DATA, level, 67+i);
- if(num==-1) //Error
- return false;
- MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_REFSCREEN] = num;
- //Marker Screen
- num = MooshMap_GetCMBHex(MAP_MOOSHMAP_DATA, level, 83+i);
- if(num==-1) //Error
- return false;
- MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_MARKERSCREEN] = num;
- //Marker Screen 2
- num = MooshMap_GetCMBHex(MAP_MOOSHMAP_DATA, level, 99+i);
- MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_MARKERSCREEN2] = num;
- //Floor DMap 1
- num = MooshMap_GetCMBDec(MAP_MOOSHMAP_DATA, level, 115+i);
- if(num==-1) //Error
- return false;
- if(Game->GetCurDMap()==num){ //If Link is on the current DMap, set Link's floor and the current floor
- MooshMap[MM_LINKFLOOR] = i;
- MooshMap[MM_SELECTEDFLOOR] = i;
- }
- MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_FLOORDMAPS] = num;
- //Floor DMap 2 (Optional)
- num = MooshMap_GetCMBDec(MAP_MOOSHMAP_DATA, level, 131+i);
- if(Game->GetCurDMap()==num){ //If Link is on the current DMap, set Link's floor and the current floor
- MooshMap[MM_LINKFLOOR] = i;
- MooshMap[MM_SELECTEDFLOOR] = i;
- }
- MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_FLOORDMAPS+1] = num;
- //Floor DMap 3 (Optional)
- num = MooshMap_GetCMBDec(MAP_MOOSHMAP_DATA, level, 147+i);
- if(Game->GetCurDMap()==num){ //If Link is on the current DMap, set Link's floor and the current floor
- MooshMap[MM_LINKFLOOR] = i;
- MooshMap[MM_SELECTEDFLOOR] = i;
- }
- MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_FLOORDMAPS+2] = num;
- //Floor DMap 4 (Optional)
- num = MooshMap_GetCMBDec(MAP_MOOSHMAP_DATA, level, 163+i);
- if(Game->GetCurDMap()==num){ //If Link is on the current DMap, set Link's floor and the current floor
- MooshMap[MM_LINKFLOOR] = i;
- MooshMap[MM_SELECTEDFLOOR] = i;
- }
- MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_FLOORDMAPS+3] = num;
- }
- }
- if(MooshMap[MM_NUMFLOORS]==0) //Can't have a map with 0 floors
- return false;
- return true; //Heyyy, we've loaded everything with no issue
- }
- //Draw the map and markers to various parts of the bitmap
- void MooshMap_UpdateBitmap(int floor){
- int cmb; int cs; int flag;
- int cmbMarker; int csMarker; int ctMarker;
- int pos;
- int i; int j; int k;
- bool test1; bool test2;
- Screen->SetRenderTarget(RT_MOOSHMAP);
- Screen->Rectangle(6, 0, 0, 511, 511, 0x00, 1, 0, 0, 0, true, 128); //Clear the bitmap
- int refMap = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*floor+MM_F_REFMAP];
- int refScreen = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*floor+MM_F_REFSCREEN];
- int markerScreen = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*floor+MM_F_MARKERSCREEN];
- //Find the first DMap associated with the current floor
- int dmap = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*floor+MM_F_FLOORDMAPS];
- if(MooshMap[MM_LINKFLOOR]==floor)
- dmap = Game->GetCurDMap();
- int srcMap = Game->DMapMap[dmap];
- int offset = Game->DMapOffset[dmap];
- bool visited[64];
- //Cycle through all screens once to find which have been visited
- for(i=0; i<64; i++){
- pos = i%8+Floor(i/8)*16;
- if(Game->GetScreenState(srcMap, pos+offset, ST_VISITED)){
- flag = Game->GetComboFlag(refMap, refScreen, pos);
- if(flag>0&&!visited[i]){ //If a combo has a flag, it's part of a screen group
- for(j=0; j<64; j++){ //Cycle through every screen again to
- pos = j%8+Floor(j/8)*16;
- if(Game->GetComboFlag(refMap, refScreen, pos)==flag) //All screens that share the flag should be marked as visited
- visited[j] = true;
- }
- }
- visited[i] = true;
- }
- }
- //Cycle through all the screens again and draw them this time
- for(i=0; i<64; i++){
- pos = i%8+Floor(i/8)*16;
- cmb = Game->GetComboData(refMap, refScreen, pos);
- cs = Game->GetComboCSet(refMap, refScreen, pos);
- if(Game->LItems[Game->GetCurLevel()]&LI_MAP) //If Link has the map, draw unvisited screens
- Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8), MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8), cmb, cs, 128);
- if(visited[i]) //If Link has been to the screen, or one grouped with it, draw it
- Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+256, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8), cmb+1, cs, 128);
- if(Game->LItems[Game->GetCurLevel()]&LI_COMPASS){ //If Link has the compass, show markers
- for(k=0; k<2; k++){ //Repeat twice if MarkerScreen2 is set
- int markerLayerOffset = 256*k;
- markerScreen = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*floor+MM_F_MARKERSCREEN];
- if(MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*floor+MM_F_MARKERSCREEN2]<0) //jesus christ, man, why are you doing it this way
- k = 2; //seriously dude, no!
- else if(k==1)
- markerScreen = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*floor+MM_F_MARKERSCREEN2];
- ctMarker = Game->GetComboType(refMap, markerScreen, pos);
- if(ctMarker==CT_CHEST){ //Marker for Screen Item or Special Item (2 states: 0 = Item present, 1 = Item taken)
- cmbMarker = Game->GetComboData(refMap, markerScreen, pos);
- csMarker = Game->GetComboCSet(refMap, markerScreen, pos);
- test1 = Game->GetScreenState(srcMap, pos+offset, ST_ITEM) || Game->GetScreenState(srcMap, pos+offset, ST_SPECIALITEM);
- if(test1)
- Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker+1, csMarker, 128);
- else
- Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker, csMarker, 128);
- }
- else if(ctMarker==CT_BOSSCHEST){ //Marker for Screen Item and Special Item (4 states: 0 = Both items present, 1 = Screen item present, 2 = Special item present, 3 = Both items taken);
- cmbMarker = Game->GetComboData(refMap, markerScreen, pos);
- csMarker = Game->GetComboCSet(refMap, markerScreen, pos);
- test1 = Game->GetScreenState(srcMap, pos+offset, ST_ITEM);
- test2 = Game->GetScreenState(srcMap, pos+offset, ST_SPECIALITEM);
- if(test1&&test2)
- Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker+3, csMarker, 128);
- else if(test1)
- Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker+2, csMarker, 128);
- else if(test2)
- Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker+1, csMarker, 128);
- else
- Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker, csMarker, 128);
- }
- else if(ctMarker==CT_DAMAGE1){ //Marker for bosses. Removed based on the level's boss flag. (2 states: 0 = Boss alive, 1 = Boss dead)
- cmbMarker = Game->GetComboData(refMap, markerScreen, pos);
- csMarker = Game->GetComboCSet(refMap, markerScreen, pos);
- if(Game->LItems[Game->GetCurLevel()]&LI_BOSS)
- Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker+1, csMarker, 128);
- else
- Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker, csMarker, 128);
- }
- else if(ctMarker==CT_STEP){ //Marker for screen secrets. (2 states: 0 = Secret not triggered, 1 = Secret triggered)
- cmbMarker = Game->GetComboData(refMap, markerScreen, pos);
- csMarker = Game->GetComboCSet(refMap, markerScreen, pos);
- test1 = Game->GetScreenState(srcMap, pos+offset, ST_SECRET);
- if(test1)
- Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker+1, csMarker, 128);
- else
- Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker, csMarker, 128);
- }
- else if(ctMarker==CT_LOCKBLOCK){ //Marker for lock blocks. (2 states: 0 = Locked, 1 = Unlocked)
- cmbMarker = Game->GetComboData(refMap, markerScreen, pos);
- csMarker = Game->GetComboCSet(refMap, markerScreen, pos);
- test1 = Game->GetScreenState(srcMap, pos+offset, ST_LOCKBLOCK);
- if(test1)
- Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker+1, csMarker, 128);
- else
- Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker, csMarker, 128);
- }
- else if(ctMarker==CT_BOSSLOCKBLOCK){ //Marker for boss lock blocks. (2 states: 0 = Locked, 1 = Unlocked)
- cmbMarker = Game->GetComboData(refMap, markerScreen, pos);
- csMarker = Game->GetComboCSet(refMap, markerScreen, pos);
- test1 = Game->GetScreenState(srcMap, pos+offset, ST_BOSSLOCKBLOCK);
- if(test1)
- Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker+1, csMarker, 128);
- else
- Screen->FastCombo(6, MOOSHMAP_MAP_SQUARE_SCALE*(i%8)+markerLayerOffset, MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8)+176, cmbMarker, csMarker, 128);
- }
- }
- }
- }
- Screen->SetRenderTarget(RT_SCREEN);
- }
- //Draw the entire map
- void MooshMap_DrawAll(int floor){
- Screen->DrawScreen(7, MooshMap[MM_BGMAP], MooshMap[MM_BGSCREEN], 0, 0, 0);
- MooshMap_DrawMap(floor, MOOSHMAP_MAP_X, MOOSHMAP_MAP_Y);
- MooshMap_DrawFloors(floor);
- if(MOOSHMAP_SHOW_LITEMS)
- MooshMap_DrawDungeonItems();
- if(MOOSHMAP_SHOW_TITLE)
- MooshMap_DrawTitle();
- }
- //Draw just the map block
- void MooshMap_DrawMap(int floor, int x, int y){
- int refMap = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*floor+MM_F_REFMAP];
- int refScreen = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*floor+MM_F_REFSCREEN];
- int cmb; int cs; int flag;
- int pos;
- int i;
- int maxScale = MOOSHMAP_MAP_SQUARE_SCALE*8+1;
- //Draw unvisited layer
- Screen->DrawBitmap(7, RT_MOOSHMAP, 0, 0, maxScale, maxScale, x, y, maxScale, maxScale, 0, true);
- //Draw visited layer
- Screen->DrawBitmap(7, RT_MOOSHMAP, 256, 0, maxScale, maxScale, x, y, maxScale, maxScale, 0, true);
- //Draw current screen layer
- if(floor==MooshMap[MM_LINKFLOOR]&&MOOSHMAP_HIGHLIGHTCURRENTROOM){
- pos = Game->GetCurDMapScreen();
- flag = Game->GetComboFlag(refMap, refScreen, pos);
- if(flag>0){ //Link is in a grouped screen
- for(i=0; i<64; i++){
- pos = i%8+Floor(i/8)*16;
- if(Game->GetComboFlag(refMap, refScreen, pos)==flag){
- cmb = Game->GetComboData(refMap, refScreen, pos);
- cs = Game->GetComboCSet(refMap, refScreen, pos);
- Screen->FastCombo(7, x+MOOSHMAP_MAP_SQUARE_SCALE*(i%8), y+MOOSHMAP_MAP_SQUARE_SCALE*Floor(i/8), cmb+2, cs, 128);
- }
- }
- }
- else{
- cmb = Game->GetComboData(refMap, refScreen, pos);
- cs = Game->GetComboCSet(refMap, refScreen, pos);
- Screen->FastCombo(7, x+MOOSHMAP_MAP_SQUARE_SCALE*(pos%16), y+MOOSHMAP_MAP_SQUARE_SCALE*Floor(pos/16), cmb+2, cs, 128);
- }
- }
- //Draw marker layer
- Screen->DrawBitmap(7, RT_MOOSHMAP, 0, 176, maxScale, maxScale, x, y, maxScale, maxScale, 0, true);
- //Draw second marker layer
- Screen->DrawBitmap(7, RT_MOOSHMAP, 256, 176, maxScale, maxScale, x, y, maxScale, maxScale, 0, true);
- //If set to draw Link's position, do so
- if(MOOSHMAP_DRAWLINKPOSITION&&floor==MooshMap[MM_LINKFLOOR]){
- pos = Game->GetCurDMapScreen();
- int linkx = x+(pos%16)*MOOSHMAP_MAP_SQUARE_SCALE;
- int linky = y+Floor(pos/16)*MOOSHMAP_MAP_SQUARE_SCALE;
- if(MOOSHMAP_PRECISELINKPOSITION){
- linkx += MOOSHMAP_PRECISELINKPOSITIONBORDER+(Link->X/240)*(MOOSHMAP_MAP_SQUARE_SCALE-MOOSHMAP_PRECISELINKPOSITIONBORDER*2)-8;
- linky += MOOSHMAP_PRECISELINKPOSITIONBORDER+(Link->Y/160)*(MOOSHMAP_MAP_SQUARE_SCALE-MOOSHMAP_PRECISELINKPOSITIONBORDER*2)-8;
- }
- else{
- linkx += MOOSHMAP_MAP_SQUARE_SCALE/2-8;
- linky += MOOSHMAP_MAP_SQUARE_SCALE/2-8;
- }
- Screen->FastCombo(7, linkx, linky, CMB_MOOSHMAP_LINKPOSITIONMARKER, CS_MOOSHMAP_LINKPOSITIONMARKER, 128);
- }
- }
- //Draw floor numbers next to the map
- void MooshMap_DrawFloors(int floor){
- int x; int y;
- int cmb; int cs;
- for(int i=0; i<MooshMap[MM_NUMFLOORS]; i++){
- cmb = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_FLOORCMB];
- cs = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_FLOORCS];
- x = MOOSHMAP_FLOOR_X;
- y = MOOSHMAP_FLOOR_Y+(MOOSHMAP_FLOOR_SPACING*(MooshMap[MM_NUMFLOORS]-1))/2-MOOSHMAP_FLOOR_SPACING*i;
- if(i==MooshMap[MM_SELECTEDFLOOR])
- Screen->DrawCombo(7, x, y, cmb+1, MOOSHMAP_FLOOR_WIDTH, MOOSHMAP_FLOOR_HEIGHT, cs, -1, -1, 0, 0, 0, -1, 0, true, 128);
- else
- Screen->DrawCombo(7, x, y, cmb, MOOSHMAP_FLOOR_WIDTH, MOOSHMAP_FLOOR_HEIGHT, cs, -1, -1, 0, 0, 0, -1, 0, true, 128);
- if(i==MooshMap[MM_LINKFLOOR])
- Screen->FastCombo(7, x-16, y+((MOOSHMAP_FLOOR_HEIGHT-1)*8), CMB_MOOSHMAP_LINKFLOORMARKER, CS_MOOSHMAP_LINKFLOORMARKER, 128);
- }
- }
- void MooshMap_DrawTitle(){
- int str[21];
- Game->GetDMapTitle(Game->GetCurDMap(), str);
- for(int i=19; i>=0; i--){
- if(str[i]==' ')
- str[i] = 0;
- else
- break;
- }
- Screen->DrawString(7, MOOSHMAP_TITLE_X, MOOSHMAP_TITLE_Y-1, MOOSHMAP_TITLE_FONT, C_BLACK, -1, TF_CENTERED, str, 128);
- Screen->DrawString(7, MOOSHMAP_TITLE_X, MOOSHMAP_TITLE_Y+1, MOOSHMAP_TITLE_FONT, C_BLACK, -1, TF_CENTERED, str, 128);
- Screen->DrawString(7, MOOSHMAP_TITLE_X-1, MOOSHMAP_TITLE_Y, MOOSHMAP_TITLE_FONT, C_BLACK, -1, TF_CENTERED, str, 128);
- Screen->DrawString(7, MOOSHMAP_TITLE_X+1, MOOSHMAP_TITLE_Y, MOOSHMAP_TITLE_FONT, C_BLACK, -1, TF_CENTERED, str, 128);
- Screen->DrawString(7, MOOSHMAP_TITLE_X, MOOSHMAP_TITLE_Y, MOOSHMAP_TITLE_FONT, C_WHITE, -1, TF_CENTERED, str, 128);
- }
- void MooshMap_DrawDungeonItems(){
- int level = Game->GetCurLevel();
- if(Game->LItems[level]&LI_MAP)
- Screen->FastCombo(7, MOOSHMAP_MAPICON_X, MOOSHMAP_MAPICON_Y, CMB_MOOSHMAP_MAP, CS_MOOSHMAP_MAP, 128);
- if(Game->LItems[level]&LI_COMPASS)
- Screen->FastCombo(7, MOOSHMAP_COMPASSICON_X, MOOSHMAP_COMPASSICON_Y, CMB_MOOSHMAP_COMPASS, CS_MOOSHMAP_COMPASS, 128);
- if(Game->LItems[level]&LI_BOSSKEY)
- Screen->FastCombo(7, MOOSHMAP_BOSSKEYICON_X, MOOSHMAP_BOSSKEYICON_Y, CMB_MOOSHMAP_BOSSKEY, CS_MOOSHMAP_BOSSKEY, 128);
- }
- int MooshMap_GetAllScreenStates(){
- int states;
- for(int i=0; i<14; i++){
- if(Screen->State[i])
- states |= 1<<i;
- }
- return states;
- }
- void MooshMap_UpdateCarryover(){
- if(Link->Action!=LA_SCROLLING){
- int allStates = MooshMap_GetAllScreenStates();
- if(MooshMap[MM_LASTDMAP]!=Game->GetCurDMap()||MooshMap[MM_LASTSCREEN]!=Game->GetCurScreen()||MooshMap[MM_LASTSCREENSTATES]!=allStates){
- if(MooshMap[MM_LASTDMAP]!=Game->GetCurDMap()){
- MooshMap_LoadLevelMapData(); //If what changed was the DMap, make sure the correct level is loaded
- }
- MooshMap[MM_LASTDMAP] = Game->GetCurDMap();
- MooshMap[MM_LASTSCREEN] = Game->GetCurScreen();
- MooshMap[MM_LASTSCREENSTATES] = allStates;
- if(Game->DMapFlags[Game->GetCurDMap()]&(1<<DMF_ALLOWMAP)){ //Only bother running carryovers if the allow map flag is set
- int i; int j; int k;
- int currentFloor = -1;
- for(i=0; i<13; i++){ //Cycle through all floors until we find which one Link is on
- for(j=0; j<4; j++){
- k = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*i+MM_F_FLOORDMAPS+j];
- if(Game->GetCurDMap()==k){
- currentFloor = i;
- break;
- }
- }
- }
- if(currentFloor>0){
- int map; int offset;
- for(i=0; i<4; i++){ //Cycle through all DMaps on the current floor and set their states
- k = MooshMap[MM_STARTFLOORINDEX+MM_NUMFLOORINDEX*currentFloor+MM_F_FLOORDMAPS+i];
- if(k>-1&&k!=Game->GetCurDMap()){ //Don't bother for the current DMap or invalid ones
- map = Game->DMapMap[k];
- offset = Game->DMapOffset[k];
- //Start with carrying over the visited state
- Game->SetScreenState(map, Game->GetCurDMapScreen()+offset, ST_VISITED, true);
- //If set to do so, carry over the other 13
- if(MOOSHMAP_ALL_CARRYOVER){
- for(j=0; j<14; j++){
- Game->SetScreenState(map, Game->GetCurDMapScreen()+offset, j, Screen->State[j]);
- }
- }
- //Carry over Screen->D if set
- if(MOOSHMAP_D_CARRYOVER){
- for(j=0; j<8; j++){
- Game->SetDMapScreenD(k, Game->GetCurDMapScreen(), j, Screen->D[j]);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- //%MGSO% HEADER_END mooshmap
- //%MGSO% HEADER_START platform
- ///Constants and Variables used by platform script;
- const int DIAGONAL_MOVEMENT = 1; //Enable the option and change this to 0 for nes movement.
- int onplatform; //Global variable use this to check if Link is on a platform for other scripts.
- void NesMovementFix()
- {
- if(DIAGONAL_MOVEMENT==0 && (Link->InputUp || Link->InputDown))
- {
- Link->InputLeft = false;
- Link->InputRight = false;
- }
- }
- void MovingPlatforms()
- {
- onplatform = 0;
- if(Link->Z == 0)
- {
- int buffer[] = "movingplatform";
- for(int i = 1; i <= 32; i++)
- {
- ffc f = Screen->LoadFFC(i);
- if(f->Script != Game->GetFFCScript(buffer)) continue;
- if(Abs(Link->X + 8 - CenterX(f)) >= f->TileWidth*8) continue;
- if(Abs(Link->Y + 12 - CenterY(f)) >= f->TileHeight*8) continue;
- onplatform = FFCNum(f);
- break;
- }
- }
- }
- //%MGSO% HEADER_END platform
- //%MGSO% HEADER_START yargcheat
- //%MGSO% HEADER_END yargcheat
- //%MGSO% HEADER_START floor spinner global
- //Global Variables
- int TimesContinued;//Tracks how many times you've continued.
- //%MGSO% HEADER_END floor spinner global
- //%MGSO% HEADER_START globalcont
- //%MGSO% HEADER_END globalcont
- //%MGSO% HEADER_START spinneronexit
- //Test if one location is between two others.
- //D0- Location to test
- //D1- Lower bound
- //D2- Higher bound
- bool Between(int loc,int greaterthan, int lessthan){
- if(loc>=greaterthan && loc<=lessthan)return true;
- return false;
- }
- //%MGSO% HEADER_END spinneronexit
- global script MGSO_Combined
- {
- void run()
- {
- //%MGSO% INIT_START Tango?
- TangoInit();
- //%MGSO% INIT_END Tango?
- //%MGSO% INIT_START g
- //%MGSO% INIT_START glob march
- //%MGSO% INIT_START seeds
- LinkMovement_Init();
- //%MGSO% INIT_END seeds
- //%MGSO% INIT_START mapglobal
- int CurrentDMap;
- int CurrentLevel;
- int CurrentDMapScreen;
- int CurrentScreen;
- bool LMap;
- bool LCompass;
- bool BKey;
- if(Game->HasPlayed == false)
- //If this is the first time the game is run, the functions below in brackets are called.
- {
- InitializeSList();
- }
- //%MGSO% INIT_END mapglobal
- //%MGSO% INIT_START ddd
- //%MGSO% INIT_START spalsh
- int splashTimer = splashFreq;
- //%MGSO% INIT_END spalsh
- //%MGSO% INIT_START old
- //%MGSO% INIT_START power bracelet
- PowerBracelet();
- //%MGSO% INIT_END power bracelet
- //%MGSO% INIT_START moosh glob
- //%MGSO% INIT_START autoghost
- StartGhostZH();
- //%MGSO% INIT_END autoghost
- //%MGSO% INIT_START OG global
- //%MGSO% INIT_START link collide
- heroExtraStateInit();
- //%MGSO% INIT_END link collide
- //%MGSO% INIT_START GB SHIELD
- //Initializations
- bool shieldOn;
- //%MGSO% INIT_END GB SHIELD
- //%MGSO% INIT_START gasha enemy
- GB_Gasha_EnemyDying();
- //%MGSO% INIT_END gasha enemy
- //%MGSO% INIT_START mooshmap
- MooshMap_Init();
- //%MGSO% INIT_END mooshmap
- //%MGSO% INIT_START platform
- //%MGSO% INIT_END platform
- //%MGSO% INIT_START yargcheat
- int saveName[9];
- int yarg[] = "yarg";
- Game->GetSaveName(saveName);
- UpperToLower(saveName); // Convert to lower-case so it will match the lower-case string
- if(strcmp(saveName, yarg) == 0)
- {
- Game->Cheat = 4;
- }
- //%MGSO% INIT_END yargcheat
- //%MGSO% INIT_START floor spinner global
- //Increases variable when you F6.
- //Used to prevent cheating past spinners.
- TimesContinued++;
- //%MGSO% INIT_END floor spinner global
- //%MGSO% INIT_START globalcont
- //Increases variable when you load the game after saving.
- //Used to prevent cheating past spinners.
- TimesContinued++;
- //%MGSO% INIT_END globalcont
- //%MGSO% INIT_START spinneronexit
- TimesContinued++;
- //%MGSO% INIT_END spinneronexit
- while(true)
- {
- //%MGSO% UPDATE1_START Tango?
- Tango_Update1();
- //%MGSO% UPDATE1_END Tango?
- //%MGSO% UPDATE1_START g
- //%MGSO% UPDATE1_START glob march
- //%MGSO% UPDATE1_START seeds
- LinkMovement_Update1();
- SeedShooter_Update();
- //%MGSO% UPDATE1_END seeds
- //%MGSO% UPDATE1_START mapglobal
- if (Link->PressMap)
- {
- CurrentLevel=Game->GetCurLevel(); //Calculate variables for custom map
- CurrentDMap=Game->GetCurDMap();
- CurrentDMapScreen=Game->GetCurDMapScreen();
- CurrentScreen=Game->GetCurScreen();
- BKey=GetLevelItem(CurrentLevel, LI_BOSSKEY);
- LMap=GetLevelItem(CurrentLevel, LI_MAP);
- LCompass=GetLevelItem(CurrentLevel, LI_COMPASS);
- StateList(CurrentLevel); //Build Lookup Tables
- Map(CurrentLevel, CurrentDMap, CurrentDMapScreen, CurrentScreen, LMap, LCompass, BKey); //Displays custom map
- }
- if(Game->GetCurScreen()<128)
- {
- if(Screen->State[ST_VISITED]==false){ Screen->State[ST_VISITED]=true; //Set visited state and door configuration on every screen entered
- DoorsList(Game->GetCurLevel(), Game->GetCurDMap(), Game->GetCurScreen());}
- }
- //----Add other code here----
- //%MGSO% UPDATE1_END mapglobal
- //%MGSO% UPDATE1_START ddd
- //%MGSO% UPDATE1_START spalsh
- //Shallow water SFX
- if( Screen->ComboT[ComboAt(Link->X+7,Link->Y+15)] == CT_SHALLOWWATER
- && Link->Action==LA_WALKING
- && Link->Z == 0 )
- {
- if( splashTimer >= splashFreq ){
- Game->PlaySound(SFX_SPLASH);
- splashTimer = 0;
- }
- splashTimer++;
- }
- else splashTimer = splashFreq;
- //End water SFX code
- //%MGSO% UPDATE1_END spalsh
- //%MGSO% UPDATE1_START old
- //%MGSO% UPDATE1_START power bracelet
- //%MGSO% UPDATE1_END power bracelet
- //%MGSO% UPDATE1_START moosh glob
- //%MGSO% UPDATE1_START autoghost
- UpdateGhostZH1();
- //%MGSO% UPDATE1_END autoghost
- //%MGSO% UPDATE1_START OG global
- //%MGSO% UPDATE1_START link collide
- heroExtraState();
- //%MGSO% UPDATE1_END link collide
- //%MGSO% UPDATE1_START GB SHIELD
- if( !shieldOn && shieldItem ){ //Enable shield when using dummy
- shieldOn=true; //Set shield state to on
- Link->Item[shieldItem]=true; //Give the shield
- Game->PlaySound(SFX_GBSHIELD); //Play the sound
- }
- else if( ( (shieldButton && !Link->InputA)||(!shieldButton && !Link->InputB)) //When button is released
- && shieldOn){ //And shield is still on
- Link->Item[shieldItem]=false; //Remove shield
- shieldItem = 0; //Reset shield item variable
- shieldOn = false; //Set shield state to off
- }
- //%MGSO% UPDATE1_END GB SHIELD
- //%MGSO% UPDATE1_START gasha enemy
- //%MGSO% UPDATE1_END gasha enemy
- //%MGSO% UPDATE1_START mooshmap
- MooshMap_Update();
- //%MGSO% UPDATE1_END mooshmap
- //%MGSO% UPDATE1_START platform
- NesMovementFix();
- //%MGSO% UPDATE1_END platform
- //%MGSO% UPDATE1_START yargcheat
- //%MGSO% UPDATE1_END yargcheat
- //%MGSO% UPDATE1_START floor spinner global
- //%MGSO% UPDATE1_END floor spinner global
- //%MGSO% UPDATE1_START globalcont
- //%MGSO% UPDATE1_END globalcont
- //%MGSO% UPDATE1_START spinneronexit
- //%MGSO% UPDATE1_END spinneronexit
- Waitdraw();
- //%MGSO% UPDATE2_START Tango?
- Tango_Update2();
- //%MGSO% UPDATE2_END Tango?
- //%MGSO% UPDATE2_START g
- //%MGSO% UPDATE2_START glob march
- //%MGSO% UPDATE2_START seeds
- LinkMovement_Update2();
- //%MGSO% UPDATE2_END seeds
- //%MGSO% UPDATE2_START mapglobal
- //%MGSO% UPDATE2_END mapglobal
- //%MGSO% UPDATE2_START ddd
- //%MGSO% UPDATE2_START spalsh
- //%MGSO% UPDATE2_END spalsh
- //%MGSO% UPDATE2_START old
- //%MGSO% UPDATE2_START power bracelet
- //%MGSO% UPDATE2_END power bracelet
- //%MGSO% UPDATE2_START moosh glob
- //%MGSO% UPDATE2_START autoghost
- UpdateGhostZH2();
- //%MGSO% UPDATE2_END autoghost
- //%MGSO% UPDATE2_START OG global
- //%MGSO% UPDATE2_START link collide
- //%MGSO% UPDATE2_END link collide
- //%MGSO% UPDATE2_START GB SHIELD
- //%MGSO% UPDATE2_END GB SHIELD
- //%MGSO% UPDATE2_START gasha enemy
- //%MGSO% UPDATE2_END gasha enemy
- //%MGSO% UPDATE2_START mooshmap
- //%MGSO% UPDATE2_END mooshmap
- //%MGSO% UPDATE2_START platform
- MovingPlatforms();
- //%MGSO% UPDATE2_END platform
- //%MGSO% UPDATE2_START yargcheat
- //%MGSO% UPDATE2_END yargcheat
- //%MGSO% UPDATE2_START floor spinner global
- //%MGSO% UPDATE2_END floor spinner global
- //%MGSO% UPDATE2_START globalcont
- //%MGSO% UPDATE2_END globalcont
- //%MGSO% UPDATE2_START spinneronexit
- //%MGSO% UPDATE2_END spinneronexit
- Waitframe();
- }
- //%MGSO% FUNCTIONS_START g
- //%MGSO% FUNCTIONS_END g
- //%MGSO% FUNCTIONS_START gasha enemy
- //%MGSO% FUNCTIONS_END gasha enemy
- }
- }
Add Comment
Please, Sign In to add comment