const int CT_ALARM_CAMERA_SHUTTER = 142;//Combo type to change to next, when alarm triggers. const int SFX_ALARM_CAMERA_TRIGGER = 0;//Sound to play, when alarm triggers. const int CSET_ALARM_CAMERA_TRIGGER = 8;//CSet to change FFC, when alarm triggers. const int SFX_ALARM_CAMERA_DESTROYED = 3;//Sound to play, when alarm trigger is destroyed. const int SPR_ALARM_CAMERA_DESTROYED = 12;//Sprite to display, when alarm is destroyed. const int I_ALARM_CAMERA_INFRA_RED_GOOGLES = 0;//This passive item renders all invisible camera sight ranges, ala infra-red googles in Metal Gear. //Stealth-like focused alarm camera. //An alarm camera, which, if stepped in it`s unobstructed field of view, plays alaem sound, changes all CT_ALARM_CAMERA_SHUTTER combos to next in table and drops enemies from ceiling. //If spawned enemies are defeated, secrets open. Can be Killed with specific lweapon - hit center spot of FFC to destroy it // //Requires ghost.zh //Place FFC the camera should start. Move it with FFC settings and changers. //D0 - camera direction //D1 - ID of spawned enemies //D2 - number of spawned enemies //D3 - add together: +1 - secrets unlocked, when spawned enemies are killed, or alarm trigger is destroyed., +2 - render laser-like camera sight hitbox without need to use Lens of Truth or I_ALARM_CAMERA_INFRA_RED_GOOGLES. //D4 - Killer Lweapon ID //D5 - Minimum damage of killer lweapon //D6 - >0 - remove killer weapon on destruction ffc script AlarmCamera{ void run(int dir, int enemy, int count, int flags, int lwID, int minLWDamage, int remove){ if (Screen->State[ST_SECRET]){ this->Vx=0; this->Vy=0; this->Ax=0; this->Ay=0; this->Data=0; Quit(); } bool spotted=false; int spotx1 = CenterX(this)-1; int spoty1 = CenterY(this)-1; int spotx2 = CenterX(this)+1; int spoty2 = CenterY(this)+1; lweapon l; while(!RectCollision(Link->X+7, Link->Y+7, Link->X+12, Link->Y+12, spotx1, spoty1, spotx2, spoty2)){ spotx1 = CenterX(this)-1; spoty1 = CenterY(this)-1; spotx2 = CenterX(this)+1; spoty2 = CenterY(this)+1; if (dir==DIR_UP){ while(!Screen->isSolid(CenterX(this),spoty1)) spoty1--; } if (dir==DIR_DOWN){ while(!Screen->isSolid(CenterX(this),spoty2)) spoty2++; } if (dir==DIR_LEFT){ while(!Screen->isSolid(spotx1,CenterY(this))) spotx1--; } if (dir==DIR_RIGHT){ while(!Screen->isSolid(spotx2,CenterY(this))) spotx2++; } if ((flags&2)>0 || UsingItem(I_LENS)|| Link->Item[I_ALARM_CAMERA_INFRA_RED_GOOGLES])Screen->Rectangle(1, spotx1, spoty1, spotx2, spoty2,1, 1, 0, 0, 0,true, OP_OPAQUE); if (this->InitD[7]>0){ this->Data = FFCS_INVISIBLE_COMBO; Quit(); } if (lwID>0){ for (int i=1;i<=Screen->NumLWeapons();i++){ l = Screen->LoadLWeapon(i); if (l->ID!=lwID)continue; if (l->Damage<minLWDamage)continue; if (!RectCollision(l->X+l->HitXOffset, l->Y+l->HitYOffset,l->X+l->HitXOffset+l->HitWidth-1, l->Y+l->HitYOffset+l->HitHeight-1,CenterX(this)-8,CenterY(this)-8,CenterX(this)+8,CenterY(this)+8)) continue; Game->PlaySound(SFX_ALARM_CAMERA_DESTROYED); if (remove>0)Remove(l); l=Screen->CreateLWeapon(LW_SPARKLE); l->X=CenterX(this)-8; l->Y=CenterY(this)-8; l->UseSprite(SPR_ALARM_CAMERA_DESTROYED); l->CollDetection=false; if ((flags&1)>0){ Game->PlaySound(SFX_SECRET); Screen->TriggerSecrets(); Screen->State[ST_SECRET]=true; } this->Vx=0; this->Vy=0; this->Ax=0; this->Ay=0; this->Data=0; Quit(); } } Waitframe(); } for (int i=1;i<=32;i++){ ffc f = Screen->LoadFFC(i); if (f->Script!=this->Script)continue; if (f==this) continue; f->InitD[7]=1; } Game->PlaySound(SFX_ALARM_CAMERA_TRIGGER); this->Vx=0; this->Vy=0; this->CSet = CSET_ALARM_CAMERA_TRIGGER; Waitframes(30); for (int i=0;i<176;i++){ if (Screen->ComboT[i]==CT_ALARM_CAMERA_SHUTTER)Screen->ComboD[i]++; } for (int i=1;i<=count*16;i++){ if ((i%16)==0){ Game->PlaySound(SFX_FALL); npc n= SpawnNPC(enemy); n->Z=128; } Waitframe(); } this->Data = FFCS_INVISIBLE_COMBO; if ((flags&1)==0)Quit(); while(EnemiesAlive())Waitframe(); Game->PlaySound(SFX_SECRET); Screen->TriggerSecrets(); Screen->State[ST_SECRET]=true; } }