//#TPT-Directive ElementHeader Element_CONV static int update(UPDATE_FUNC_ARGS) int Element_CONV::update(UPDATE_FUNC_ARGS) { int r, rx, ry; int ctype = TYP(parts[i].ctype), ctypeExtra = ID(parts[i].ctype); if (ctype<=0 || ctype>=PT_NUM || !sim->elements[ctype].Enabled || ctype==PT_CONV || (ctype==PT_LIFE && (ctypeExtra<0 || ctypeExtra>=NGOL))) { for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) if (BOUNDS_CHECK) { r = sim->photons[y+ry][x+rx]; if (!r) r = pmap[y+ry][x+rx]; if (!r) continue; int rt = TYP(r); if (rt != PT_CLNE && rt != PT_PCLN && rt != PT_BCLN && rt != PT_STKM && rt != PT_PBCN && rt != PT_STKM2 && rt != PT_CONV && rt < PT_NUM) { parts[i].ctype = rt; if (rt == PT_LIFE) parts[i].ctype |= PMAPID(parts[ID(r)].ctype); } } } else { int restrictElement = sim->IsValidElement(parts[i].tmp) ? parts[i].tmp : 0; for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES) { r = sim->photons[y+ry][x+rx]; if (!r || (restrictElement && TYP(r) != restrictElement)) r = pmap[y+ry][x+rx]; if (!r || (restrictElement && TYP(r) != restrictElement)) continue; if (TYP(r) != PT_CONV && TYP(r) != PT_DMND && TYP(r) != ctype) { sim->create_part(ID(r), x+rx, y+ry, TYP(parts[i].ctype), ID(parts[i].ctype)); } } } return 0; }
void Element_TESC_Tool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) { int radiusInfo = brush->GetRadius().X*4+brush->GetRadius().Y*4+7; sim->FloodParts(position.X, position.Y, toolID | PMAPID(radiusInfo), -1); }
void Element_TESC_Tool::DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { int radiusInfo = brush->GetRadius().X*4+brush->GetRadius().Y*4+7; sim->CreateBox(position1.X, position1.Y, position2.X, position2.Y, toolID | PMAPID(radiusInfo)); }