//Caneof Somaria const int CMB_SOMARIA_PLATFORM_INACTIVE = 100; //the '?' combo const int LWEAPON_MISC_ID = 8; //l->Misc[] holds the ID of the weapon. const int LWT_SOMARIA = 100; //Attribute for somaria objects. const int STORE_FFC_DATA = 0; const int STORE_FFC_SCRIPT = 1; const int STORE_FFC_CSET = 2; const int STORE_FFC_DELAY = 3; const int STORE_FFC_X = 4; const int STORE_FFC_Y = 5; const int STORE_FFC_VX = 6; const int STORE_FFC_VY = 7; const int STORE_FFC_AX = 8; const int STORE_FFC_AY = 9; const int STORE_FFC_TILEWIDTH = 10; const int STORE_FFC_TILEHEIGHT = 11; const int STORE_FFC_EFFECTWIDTH = 12; const int STORE_FFC_EFFECTHEIGHT = 13; const int STORE_FFC_LINK = 14; const int STORE_FFC_FLAGS_MIN = 15; const int STORE_FFC_FLAGS_MAX = 24; const int STORE_FFC_FLAGS_0 = 15; const int STORE_FFC_FLAGS_1 = 16; const int STORE_FFC_FLAGS_2 = 17; const int STORE_FFC_FLAGS_3 = 18; const int STORE_FFC_FLAGS_4 = 19; const int STORE_FFC_FLAGS_5 = 20; const int STORE_FFC_FLAGS_6 = 21; const int STORE_FFC_FLAGS_7 = 22; const int STORE_FFC_FLAGS_8 = 23; const int STORE_FFC_FLAGS_9 = 24; const int STORE_FFC_MISC_MIN = 25; const int STORE_FFC_MISC_MAX = 39; const int STORE_FFC_MISC_0 = 25; const int STORE_FFC_MISC_1 = 26; const int STORE_FFC_MISC_2 = 27; const int STORE_FFC_MISC_3 = 28; const int STORE_FFC_MISC_4 = 29; const int STORE_FFC_MISC_5 = 30; const int STORE_FFC_MISC_6 = 31; const int STORE_FFC_MISC_7 = 32; const int STORE_FFC_MISC_8 = 33; const int STORE_FFC_MISC_9 = 34; const int STORE_FFC_MISC_10 = 35; const int STORE_FFC_MISC_11 = 36; const int STORE_FFC_MISC_12 = 37; const int STORE_FFC_MISC_13 = 38; const int STORE_FFC_MISC_14 = 39; void StoreSomariaPlatform(ffc this, int arr){ int q; arr[STORE_FFC_DATA] = this->Data; arr[STORE_FFC_SCRIPT] = this->Script; arr[STORE_FFC_CSET] = this->CSet; arr[STORE_FFC_DELAY] = this->Delay; arr[STORE_FFC_X] = this->X; arr[STORE_FFC_Y] = this->Y; arr[STORE_FFC_VX] = this->Vx; arr[STORE_FFC_VY] = this->Vy; arr[STORE_FFC_AX] = this->Ax; arr[STORE_FFC_AY] = this->Ay; for ( q = 0; q < 10; q++ ) arr[STORE_FFC_FLAGS_MIN] + q = this->Flags[q]; arr[STORE_FFC_TILEWIDTH] = this->TileWidth; arr[STORE_FFC_TILEHEIGHT] = this->TileWidth; arr[STORE_FFC_EFFECTWIDTH] = this->EffectWidth; arr[STORE_FFC_EFFECTHEIGHT] = this->EffectHeight; arr[STORE_FFC_LINK] = this->Link; for ( q = 0; q < 15; q++ ) arr[STORE_FFC_MISC_MIN] + q = this->Misc[q]; } void RestoreSomariaPlatform(ffc this, int arr){ int q; this->Data = arr[STORE_FFC_DATA]; this->Script = arr[STORE_FFC_SCRIPT]; this->CSet = arr[STORE_FFC_CSET]; this->Delay = arr[STORE_FFC_DELAY]; this->X = arr[STORE_FFC_X]; this->Y = arr[STORE_FFC_Y]; this->Vx = arr[STORE_FFC_VX]; this->Vy = arr[STORE_FFC_VY]; this->Ax = arr[STORE_FFC_AX]; this->Ay = arr[STORE_FFC_AY]; for ( q = 0; q < 10; q++ ) this->Flags[q] = arr[STORE_FFC_FLAGS_MIN] + q; this->TileWidth = arr[STORE_FFC_TILEWIDTH]; this->TileWidth = arr[STORE_FFC_TILEHEIGHT]; this->EffectWidth = arr[STORE_FFC_EFFECTWIDTH]; this->EffectHeight = arr[STORE_FFC_EFFECTHEIGHT]; this->Link = arr[STORE_FFC_LINK]; for ( q = 0; q < 15; q++ ) this->Misc[q] = arr[STORE_FFC_MISC_MIN] + q; } const int SOMARIA_PLATFORM_MOVE_COMBO_LAYER = 4; const int SOMARIA_PLATFORM_MOVE_COMBO_LEFT = 1000; const int SOMARIA_PLATFORM_MOVE_COMBO_RIGHT = 1001; const int SOMARIA_PLATFORM_MOVE_COMBO_UP = 1002; const int SOMARIA_PLATFORM_MOVE_COMBO_DOWN = 1003; const int SOMARIA_PLATFORM_MOVE_COMBO_STOP = 1004; //Run on screen init. ffc script SomariaPlaform{ void run(){ bool inactive = true; int a[255]; lweapon l; ffc f; //f holds platform settings. int platform[40]; //we need void BackupFFC(ffc f, int arr) and RestoreFFC(int arr, ffc f) StoreSomariaPlatform(this, a); while(true){ while(inactive) { this->Vx = 0; this->Vy = 0; this->Ax = 0; this->Ay = 0; this->Data = CMB_SOMARIA_PLATFORM_INACTIVE; this->EffectWidth = 16; this->EffectHeight = 16; this->TileWidth = 1; this->TileHeight = 1; this->Effect for ( a[254] = 1; a[254] <= Screen->NumLWeapons(); a[254]++ ) { l = Screen->LoadLWeapon(a[254]); if ( l->Misc[LWEAPON_MISC_ID] == LWT_SOMARIA ) { if ( Collision(l,this) ) inactive = false; } } Waitframe(); } RestoreSomariaPlatform(this,a); //Restore the movement params, and the graphics, and size. for ( q[254] = 0; q[254] < 176; q[254]++ ) { //Check collisions with combos on layer N for movement changes. if ( GetLayerComboD(SOMARIA_PLATFORM_MOVE_COMBO_LAYER, q[254]) == SOMARIA_PLATFORM_MOVE_COMBO_LEFT ) { if ( Collision(this, cmb) { //This Collision() may be too sensitive. //Change movement to leftward. } } if ( GetLayerComboD(SOMARIA_PLATFORM_MOVE_COMBO_LAYER, q[254]) == SOMARIA_PLATFORM_MOVE_COMBO_RIGHT ) { if ( Collision(this, cmb) { //This Collision() may be too sensitive. //Change movement to rightward. } } if ( GetLayerComboD(SOMARIA_PLATFORM_MOVE_COMBO_LAYER, q[254]) == SOMARIA_PLATFORM_MOVE_COMBO_UP ) { if ( Collision(this, cmb) { //This Collision() may be too sensitive. //Change movement to upwward. } } if ( GetLayerComboD(SOMARIA_PLATFORM_MOVE_COMBO_LAYER, q[254]) == SOMARIA_PLATFORM_MOVE_COMBO_DOWN ) { if ( Collision(this, cmb) { //This Collision() may be too sensitive. //Change movement to downward. } } if ( GetLayerComboD(SOMARIA_PLATFORM_MOVE_COMBO_LAYER, q[254]) == SOMARIA_PLATFORM_MOVE_COMBO_STOP ) { if ( Collision(this, cmb) { //This Collision() may be too sensitive. //Halt all movement this->Vx = 0; this->Vy = 0; this->Ax = 0; this->Ay = 0; } } } //If Link is on the playform if ( Collision(this) ) { //Move Link with the platform if ( !Link->Misc[ON_PLATFORM] ) Link->Misc[ON_PLATFORM = 1]; Link->Z = 1; //...and keep his Z at 1 to pass over pits, unharmed. //Store that Link is on a platform in Link->Misc[] //...we'll use that to ensure that we make a new platform under him, after screen transitions / during scrolling } //If Link walks off the platform onto a pit...he shouldn;t keep falling in mid-air. //We need to prevent that. //Stop reporting being on a platform, if Link isn't riding. if ( !Collision(this) && Link->Misc[ON_PLATFORM] ) Link->Misc[ON_PLATFORM] = 0; Waitframe(); } } } const int PITS_GRACE_WHEN_INJURED = 1; //If Link is hurt, he won;t fall down a pit. Good for bomb jumping, bad for other things. const int PITS_ALLOW_BOMB_JUMPING = 1; //More precise for bomb jumping. ffc script Pit{ void run(int respawn_screen_init){ int a[256]; bool falling; bool pit; bool onpitedge; Waitframes(5); //Store where Link was on screen init: a[50] = Link->X; a[51] = Link->Y; while(true){ if ( !falling && !onpitedge && !Link->Misc[ON_PLATFORM] ) { a[10] = Link->X; a[11] = Link->Y; } if ( falling ) { a[12] = a[10]; a[13] = a[11]; } //Store Link's X/Y in the array, so that we have a respawn location. //Find combos with a type of HOOKSHOT_ONLY and an Inherent Flag of CI_PIT. for ( a[0] = 0; a[0] < 176; a[0]++ ) { if ( ComboT[a[0]] == CT_HOOKSHOT || ComboT[a[0]] == CT_LADDER || ComboT[a[0]] == CT_LADDERHOOKSHOT || ComboI[a[0]] == CT_PIT ) { if ( DistX(a[0],14) && DistY(a[0],14) && !DistY(a[0],9) && !DistX(a[0],9) ) onpitedge = true; else onpitedge = false; if ( DistX(a[0],8) && DistY(a[0],8) { if ( !NumLWeaponsOf(LW_HOOKSHOT) ) { if ( Link->Z <= 0 && !Link->Jump ) { falling = true; } } } } } if ( falling ) { NoAction(); Link->X = ComboX(a[0]); Link->Y = ComboY(a[0]); a[4] = ComboX(a[0]); a[5] = ComboY(a[0]); a[8] = 16; //Scale //Waitframe(); //Not needed if we're going it after Waitdraw() a[20] = Link->Tile; //Set before hs becomes invisible and this value turns to shyte. // We need to avoid storing this if the new location is a platform. This is important, primarily //because he can walk off the edge of a platform manually, and he'd fall in an endless loop. //This might mean that either the platform ffc needs higher priority than this, so that the Link->Misc //value is set, or that we need to check if he is on a platform in the pits ffc, too. if ( !effects ) { effects = true; Game->PlaySound(SFX_FALL_PIT); Link->HP -= PIT_DAMAGE; } for ( a[1] = 0; a[1] < PIT_FALLING_ANIM_DUR; a[1]++ ) { Screen_>DrawTile(2, a[4]; a[5]; a[20]; ... scale=a[8], ... true, OP_OPAQUE); if ( a[1] % 10 == 0 && a[8] > 0 ) a[8]--; //Trim the scale. Waitframe(); } Waitframes(5); //Spawn Link Again for ( a[1] = 0; a[1] < PIT_RESPAWN_LINK_DUR; a[1]++ ) { if ( !respawn_screen_init ) Link->X = a[12]; Link->Y = a[13]; if ( respawn_screen_init ) //If d0 is set, we read a[50] and a[51] for the values to use when respawning him. Link->X = a[50]; Link->Y = a[51]; if ( a[1] % 4 != 0 ) Link->Invisible = true; else Link->Invisible = false; Waitframe(); } falling = false; effects = false; //Freeze Link //Store his x/y //Center the x/y over the combo //Make Link invisible, //Draw his tile in a loop, growing smaller //Play falling sound //hurt him //Wait a few frames //Spawn him //make him flicker by using a for loop, in which at % == 0 he is visible, and ! % == 0 he is invisible //for 30 frames, during which his collision is off. } Waitframe(); } } }