Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //import "std.zh"
- // More Sensitive Step Combos
- // v0.6
- // 19th July, 2018
- // By: ZoriaRPG, requested by DarkMatt
- const int CT_MISC_STEP_SRC = 250; //This type cannot be assigned in the EDITOR, but can be defined by script.
- //In 2.54+, this type *can be* set in the editor.
- const int CT_MISC_STEP_DONE = 251;
- const int STEP_SENS_DEFAULT = 8; //pixels
- global script test
- {
- void run()
- {
- while(1)
- {
- steps.checks(STEP_SENS_DEFAULT);
- Waitdraw();
- Waitframe();
- }
- }
- }
- ffc script steps
- {
- void run(int sens)
- {
- sens = Cond(sens > 0, sens, STEP_SENS_DEFAULT);
- int pos; int type; int w;
- while(1)
- {
- for ( pos = 0; pos < 176; ++pos )
- {
- type = istype(pos);
- if ( type ) //assign is intentional
- // Sadly, i forgot that assign during a statement isn't yet supported.
- //if ( ( type = istype(pos,type) ) ) //assign is intentional
- {
- if ( coll(pos,sens) )
- {
- if ( type == CT_STEP )
- {
- ++Screen->ComboD[pos];
- for ( w = 0; w < 176; ++w )
- {
- if ( w == pos ) continue;
- if (istype(w) == CT_STEPCOPY )
- ++Screen->ComboD[pos];
- }
- }
- if ( type == CT_STEPALL )
- {
- //find all identical combos
- for ( w = 0; w < 176; ++w )
- {
- //if ( w == pos ) continue;
- if (istype(w) == type )
- ++Screen->ComboD[pos];
- }
- }
- if ( type == CT_STEPALL )
- {
- int dat = Screen->ComboD[pos];
- //find all identical combos
- for ( w = 0; w < 176; ++w )
- {
- //if ( w == pos ) continue;
- if (Screen->ComboD[w] == dat )
- ++Screen->ComboD[pos];
- }
- }
- if ( type == CT_STRIGFLAG )
- {
- Screen->ComboT[pos] = CT_MISC_STEP_DONE;
- Screen->TriggerSecrets();
- Screen->State[ST_SECRET] = true;
- Game->PlaySound(SFX_SECRET);
- }
- if ( type == CT_TRIGFLAG )
- {
- Screen->ComboT[pos] = CT_MISC_STEP_DONE;
- Screen->TriggerSecrets();
- Screen->State[ST_SECRET] = true;
- Game->PlaySound(SFX_SECRET);
- }
- if ( type == CT_TRIGNOFLAG )
- {
- Screen->ComboT[pos] = CT_MISC_STEP_DONE;
- Screen->TriggerSecrets();
- Game->PlaySound(SFX_SECRET);
- }
- if ( type == CT_STRIGNOFLAG )
- {
- Screen->ComboT[pos] = CT_MISC_STEP_DONE;
- Screen->TriggerSecrets();
- Game->PlaySound(SFX_SECRET);
- }
- }
- }
- }
- Waitframe();
- }
- }
- //Typecheck a combo type given as 'pos' (screen index 0->175) against a
- //series of valid types.
- //Returns the same type on success, otherwise 0.
- int istype(int pos)
- {
- int t = Screen->ComboT[pos];
- if ( t == CT_STEP ) return t;
- if ( t == CT_STEPALL ) return t;
- if ( t == CT_STEPSAME ) return t;
- if ( t == CT_STEPCOPY ) return t;
- if ( t == CT_STRIGFLAG ) return t; //Step (Secrets, Sensitive, Permanent)
- if ( t == CT_STRIGNOFLAG ) return t; //Step (Secrets, Sensitive, Temporary)
- if ( t == CT_TRIGFLAG ) return t; //Step (Secrets, Permanent)
- if ( t == CT_TRIGNOFLAG ) return t; //Step (Secrets, Temporary)
- return 0;
- }
- //Marks a given combo position as a step source.
- //Used for base step types that transfer their properties to other combos.
- void mark(int pos)
- {
- Screen->ComboT[pos] = CT_MISC_STEP_SRC;
- }
- //Returns true is Link is stepping on a combo at position 'pos' within
- //the given sensitivty 'sens' in pixels.
- bool coll(int pos, int sens)
- {
- if ( Abs(Link->X - ComboX(pos)) <= sens )
- {
- if ( Abs(Link->Y - ComboX(pos)) <= sens )
- {
- return true;
- }
- }
- return false;
- }
- //Runs the checks for the supported step cmbo types.
- void checks(int sens)
- {
- sens = Cond(sens > 0, sens, STEP_SENS_DEFAULT); //assign the default if no other value is provided.
- int pos; int type; int w;
- //scan the 176 positions of the combo grid
- for ( pos = 0; pos < 176; ++pos )
- {
- type = istype(pos);
- //check if the current iteration position is a matching type
- if ( type ) //assign is intentional
- {
- //and if there is collision...
- if ( coll(pos,sens) )
- {
- ///based on the type, perform the requisite actions
- //to replicate engine behaviour
- if ( type == CT_STEP )
- {
- ++Screen->ComboD[pos]; //advance to the next combo
- //find copy and similar combo types that would be affected
- //at the same time, and apply the changes to those, too
- for ( w = 0; w < 176; ++w )
- {
- if ( w == pos ) continue; //ignore src combo
- if (istype(w) == CT_STEPCOPY )
- ++Screen->ComboD[pos];
- }
- }
- if ( type == CT_STEPALL )
- {
- //find all identical combos and apply to them
- for ( w = 0; w < 176; ++w )
- {
- //if ( w == pos ) continue; //probably not here
- if (istype(w) == type )
- ++Screen->ComboD[pos];
- }
- }
- if ( type == CT_STEPSAME )
- {
- int dat = Screen->ComboD[pos];
- //find all identical combos
- for ( w = 0; w < 176; ++w )
- {
- //if ( w == pos ) continue; probably not here, either
- if (Screen->ComboD[w] == dat )
- ++Screen->ComboD[pos];
- }
- }
- //secret triggrs
- if ( type == CT_STRIGFLAG )
- {
- Screen->ComboT[pos] = CT_MISC_STEP_DONE;
- Screen->TriggerSecrets(); //triggers ALL secrets
- Screen->State[ST_SECRET] = true; //make them permanent
- Game->PlaySound(SFX_SECRET);
- }
- if ( type == CT_TRIGFLAG )
- {
- Screen->ComboT[pos] = CT_MISC_STEP_DONE;
- Screen->TriggerSecrets();
- Screen->State[ST_SECRET] = true;
- Game->PlaySound(SFX_SECRET);
- }
- //these two are temporary, so ST_SECRET is not set
- if ( type == CT_TRIGNOFLAG )
- {
- Screen->ComboT[pos] = CT_MISC_STEP_DONE;
- Screen->TriggerSecrets();
- Game->PlaySound(SFX_SECRET);
- }
- if ( type == CT_STRIGNOFLAG )
- {
- Screen->ComboT[pos] = CT_MISC_STEP_DONE;
- Screen->TriggerSecrets();
- Game->PlaySound(SFX_SECRET);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement