//Better Method: // When we enter a screen for which we haven't saved the doors, since the last load, we will read //Screen->Doors, and place invisible combos with no solidity, on layer 1, or 2, at a position by each door, to indicate its type. //Thereafter, every frame, until Link changes screens, we will check if the types that we place match Screen->Doors, //and if not, we update them to the correct types. //We flag Screen->D that we stored them, and we save them to the primary doors array. //We will backup from this array, and restore to it, as an entry point/reference. //We store the last screen that Link visited, and the dmap, in Link->Misc. //If this changes, we know that the screen changed. //When the screen changes, we remove the flag that we set on the last screen. const int LINK_LAST_SCREEN = 10; //Index of Link->Misc[] to use to store screen and DMap. void StoreDMapScreen(){ int a[2]; a[0] = Game->GetCurScreen() / 10000; a[1] = Game->GetCurDMap(); Link->Misc[LINK_LAST_SCREEN] = a[0] + a[1]; } int GetLastScreen(){ return ( Link->Misc[LINK_LAST_SCREEN] - ( Link->Misc[LINK_LAST_SCREEN] << 0 )) *10000; } int GetLastDMap() { return Link->Misc[LINK_LAST_SCREEN] << 0; } bool ScreenChanged() { return ( Game->GetCurScreen() != GetLastScreen() ); } bool DMapChanged() { return ( Game->GetCurDMap() != GetLastDMap() ); } //Just a silly reminder to do this at the start of every game. void SetInitialScreenDMap() { StoreDMapScreen(); } //Update if the screen changes. We will want to do some other things at this time, so we might want to package them all together. void UpdateScreenDMap() { if ( ScreenChanged() || DMapChanged() ) StoreDMapScreen(); } //----------------- //Door types. Use with Screen->Door[] const int D_WALL = 0; const int D_OPEN = 1; const int D_LOCKED = 2; const int D_UNLOCKED = 3; // A locked door that has been opened const int D_SHUTTER = 4; // Defeat enemies to unlock this door const int D_BOMB = 6; // A door that changes when bombed const int D_BOMBED = 7; // A door that has been bombed const int D_WALKTHRU = 8; // Push against the wall to pass through const int D_BOSSLOCKED = 10; const int D_BOSSUNLOCKED = 11; // A boss door that has been opened const int D_OPENSHUTTER = 12; // A shutter that has been opened const int D_1WAYSHUTTER = 14; // A shutter that locks behind you and never opens //Backup Doors int StoredDoors[]; //We should do two combos per door. DO we want to use comboD or COmboFI? const int CMB_D_WALL //Unique combos for doors and walls? This would be better with flags, so let's do it that way. const int CMB_D_WALL = 0; const int CMB_D_OPEN = 1; const int CMB_D_LOCKED = 2; const int CMB_D_UNLOCKED = 3; // A locked door that has been opened const int CMB_D_SHUTTER = 4; // Defeat enemies to unlock this door const int CMB_D_BOMB = 6; // A door that changes when bombed const int CMB_D_BOMBED = 7; // A door that has been bombed const int CMB_D_WALKTHRU = 8; // Push against the wall to pass through const int CMB_D_BOSSLOCKED = 10; const int CMB_D_BOSSUNLOCKED = 11; // A boss door that has been opened const int CMB_D_OPENSHUTTER = 12; // A shutter that has been opened const int CMB_D_1WAYSHUTTER = 14; // A shutter that locks behind you and never opens //We need a combo type for 'normal' states, and a flag for opened states. const int CT_D_WALL = CT_SRCIPT1; const int CF_WALL_WALKTHROUGH = CF_SCRIPT2; //This fla if we can walk through it. //ActuallyI'm not sure if we need that, as that's just a wall that ZC does funny things with. //We could just ignore storeing walkthrough walls. const int CT_D_DOOR = CT_SCRIPT2; //Open, or locked door. const int CT_DOOR = CF_SCRIPT1; //Combo CT_D_WALL + FLAG const int CF_LOCKDOOR = CF_SCRIPT1; //If it's a locked door combo, it'll be CT_DOOR ad CF_LOCKDDOOR //const int FLAG_D_UNLOCKED = 3; A locked door becomes door combo, but without the locked fla //CF_SCRIPT1 is an open state //DOn't locked doors have their own combo type? const int FLAG_D_LOCKED = 2; const int CT_SHUTTER = CT_SCRIPT2; //ANy shutter const int CF_SHUTTER_OPEN = CF_SCRIPT1 const int CF_SHUTTER_CLOSED = CF_SCRIPT2 const int CF_SHUTTER_1WAY = CF_SCRIPT3 const int CT_BOMBWALL = ? //Bomb walls should be a bomb flag, bomb next? const int CF_BOMBED = CF_SCRIPT1; //it's unlocked, so flag it. const int CT_BOSSDOOR = CT_SCRIPT5; //Likewise, boss doors are their own combo type, so we should need to do this. const int CF_BOSSOPEN = CF_SCRIPT1; //it is open, so flag it. // A locked door that has been opened const int FLAG_D_SHUTTER = 4; // Defeat enemies to unlock this door const int FLAG_D_BOMB = 6; // A door that changes when bombed const int FLAG_D_BOMBED = 7; // A door that has been bombed //const int FLAG_D_WALKTHRU = 8; // Push against the wall to pass through const int FLAG_D_BOSSLOCKED = 10; const int FLAG_D_BOSSUNLOCKED = 11; // A boss door that has been opened //const int FLAG_D_OPENSHUTTER = 12; // A shutter that has been opened //const int FLAG_D_1WAYSHUTTER = 14; // A shutter that locks behind you and never opens Wall Sets wall open locked unlocked shutter-closed shutter_open 1-way bomb bombed walkthrouh bosslock bosslock_opem void CheckDoors(){ } //Check doors by combo locations, and combo types/flags, then store them for this screen int he array if they differ from what's stored. //We do this only when we enter a screen. I'm not sure if 1-way shutters could break. Who wantsx to waer that they will? void RestoreDoors() { } //if the Screen->Doors array differs from what is on the screen, update it. //If we are using classic, and only one set of door combos for all dungeons, we can do it by ComboD void StoreDoors[] {} //Use ComboD from the screens, but wait, we need to copy those combos to layer 1! //it may be easier to use combos and flags on layer 1 for this, period. //When Link enters a screen, we read Screen->Doors, and place invisible combos on layer 1. These will persist as long as the game is not quit. //WIll that suffice?We need to know what to do if we quit the game. //At least this will give us a way to READ the doors on any screen. //In this case, we can ignore flags, and just use pure comboD, as we can define some invisible combos for this. void SetRoomDoors(){ //Read the invisible combos on the screen, and set Screen->Doors based on them, before Waitdraw, when we enter any screen. } void CheckClassicDoors() { int doors[8]; //We only check if the screen changes, if a temp flag is not set. //We the screen changes, and we check, we set a temp flag. We'll remove that somehow when we leave the screen. //Link->Misc seems a good place to store it. //We'll compare the present state of doors[] when doing this, and only store if the doors[4] differs from our combos. //! Actually, it would be safer to check if the doors[4] differ every frame, so that any changes are saved. //Do we also need a flag in Link->Misc tht we've restored? } void RestoreClassicDoors() { } const int DOORS_ARE_ALL_NES_STYLE = 0; //Set to 1, to use ChassicDoors instead of ordinary doors when choosing which functions to call.