void EffectNode::Process(unsigned int bufsize) { if (bufsize>(unsigned int)m_Output.GetLength()) { m_Output.Allocate(bufsize); } ProcessChildren(bufsize); if (ChildExists(0) && !GetChild(0)->IsTerminal() && ChildExists(1)) { if (m_Type==CLIP) { m_Output=GetInput(0); if (GetChild(1)->IsTerminal()) { HardClip(m_Output, GetChild(1)->GetCVValue()); } else { MovingHardClip(m_Output, GetInput(1)); } } else if (m_Type==DISTORT) { m_Output=GetInput(0); if (GetChild(1)->IsTerminal()) { Distort(m_Output, GetChild(1)->GetCVValue()); } else { MovingDistort(m_Output, GetInput(1)); } } else if (ChildExists(2)) { switch (m_Type) { case CRUSH : m_Output=GetInput(0); Crush(m_Output, GetChild(1)->GetCVValue(), GetChild(2)->GetCVValue()); break; case DELAY : { m_Delay.SetDelay(GetChild(1)->GetCVValue()); m_Delay.SetFeedback(GetChild(2)->GetCVValue()); m_Delay.Process(bufsize, GetInput(0), m_Output); break; } default : assert(0); break; } } } }
void UpdateMonster(Entity *self) { int *frames; if(self->state == MS_Deadbody) { return; } if(self->state == MS_Dead) { /*run death animation*/ if((self->frame < deadframes[0])||(self->frame > deadframes[1])) { self->frame = deadframes[0] - 1; } self->frame++; if(self->frame != deadframes[1])return; if(GetObjKey(self->data,"persists",NULL)) { SetPlayerProgress(level.name,self->name, self->objindex,"dead"); } /*spawndeadbody, unless nocorpse*/ self->state = MS_Deadbody; self->update = NULL; self->think = NULL; self->solid = 0; self->FloorDraw = 1; self->activate = NULL; return; } if(self->attacking) { /*this is going to become a lot more robust*/ self->attackframe++; switch(self->attacktype) { case AT_Slash: frames = slashframes; if(self->attackframe >=4) { if((self->attackframe > (8 * self->attackspeed))||(Slash(self,self->p,self->targetpoint,self->attackrange,35,-35,2, self->attackframe/8.0, 1, 1, self->damagetype))) { self->attacking = 0; AddDelays(self,8); self->Rcd = 8 + (8 * self->attackspeed); self->Acd = 4 + (4 * self->attackspeed); } } break; case AT_Crush: frames = crushframes; if(self->attackframe >=4) { if((self->attackframe > (8 * self->attackspeed))||(Crush(self,self->p,self->targetpoint,self->attackrange,35,-35,2, self->attackframe/8.0, 1, 1, self->damagetype))) { self->attacking = 0; AddDelays(self,8); self->Rcd = 8 + (8 * self->attackspeed); self->Acd = 4 + (4 * self->attackspeed); } } break; case AT_Stab: frames = stabframes; if(self->attackframe >=4) { if((self->attackframe > (8 * self->attackspeed))||(Stab(self,self->p,self->targetpoint,self->attackrange,2, self->attackframe/8.0, 1, 1, self->damagetype))) { self->attacking = 0; AddDelays(self,8); self->Rcd = 8 + (8 * self->attackspeed); self->Acd = 4 + (4 * self->attackspeed); } } break; case AT_Shoot: frames = shootframes; if((int)self->attackframe == 6) { ShootArrow(self); } if(self->attackframe > 8) { self->attacking = 0; AddDelays(self,8); self->Rcd = 8 + (8 * self->attackspeed); self->Acd = 4 + (4 * self->attackspeed); } break; } self->frame = frames[0] + ((frames[1] - frames[0])*(self->attackframe/(8 * self->attackspeed))); } else if(self->guard) { /*using the shield, Set left arm sprite to guard*/ self->frame = 1; } else { /*when idle*/ if(self->frame < idleframes[0])self->frame = idleframes[0]; else if (self->frame > idleframes[1])self->frame = idleframes[0]; else { self->frame = self->frame + 0.2; } } if(RelativeSize(self->v.x, self->v.y) > 0) { UpdateEntityPosition(self,NULL); } CoolDowns(self); }