Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- item script Bullet
- {
- void run()
- {
- lweapon l = Screen->CreateLWeapon(Cond((this->Attributes[1] > 0), this->Attributes[1], LW_ARROW));
- //Attributes[1] is the weapon type. Defaults to arrow.
- int canrunffc = 0;
- switch(Link->Dir)
- {
- case DIR_UP:
- { l->X = Link->X -1; l->Y = Link->Y+8; break; }
- case DIR_DOWN:
- { l->X = Link->X +16; l->Y = Link->Y+8; break; }
- case DIR_LEFT:
- { l->X = Link->X +8; l->Y = Link->Y-1; break; }
- case DIR_RIGHT:
- { l->X = Link->X +8; l->Y = Link->Y+16; break; }
- default:
- {
- l->X = Link->X; l->Y = Link->Y; TraceNL();
- TraceS("Invalid Link->Dir for item script Bullet");
- TraceNL(); break;
- }
- }
- l->Dir = Link->Dir;
- l->UseSprite(this->Sprites[0]);
- Game->PlaySound(this->UseSound);
- l->Step = this->Attributes[0];
- l->Damage = this->Level; //Upgrade canon by level.
- ffc f;
- for ( int q = 1; q < 33; ++q )
- {
- f = Screen->LoadFFC(q);
- if ( f->Flags&FFCF_ETHEREAL ) continue; //ethereal cannot run scripts.
- if ( f->Data == 0 ) break; //find one with no running script.
- }
- if ( f->ID > 31 )
- {
- if ( f->Data > 0 ) { f->InitD[1] = f->Data; }
- if ( f->Script > 0 )
- {
- TraceNL(); TraceS("Item script Bullet could not grab a free ffc.."); TraceNL();
- }
- else canrunffc = 1;
- }
- else canrunffc = 1;
- if ( canrunffc )
- {
- if ( f->Data <= 0 ) { f->Data = CMB_INVIS; }
- f->Script = Game->GetFFCScript("Autofire_Bullets");
- }
- if ( GetEquipmentA() == this->ID ) { f->InitD[0] = CB_A; }
- else if ( GetEquipmentB() == this->ID ) { f->InitD[0] = CB_B; }
- else { f->InitD[0] =-1; } //error finding button match ?!
- } //end run()
- } // end item script
- ffc script Autofire_Bullets
- {
- void run(int controller_button, int olddata)
- //olddata is used if this ffc already had a combo set, but no script.
- {
- Input->Held[controller_button] = false;
- if ( olddata <= 0 ) { this->Data = 0; }
- Quit();
- /* We run out of scope here anyway,
- but it's safer, and clearer, to call Quit().
- */
- } //end run()
- } //end script
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement