Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- #include <element.h>
- int update_NPLM(UPDATE_FUNC_ARGS)
- {
- int r, rx, ry;
- float dx, dy;
- char nplm;
- int absorbChanceDenom;
- if (parts[i].tmp>100) parts[i].tmp = 100;
- if (parts[i].tmp<0) parts[i].tmp = 0;
- absorbChanceDenom = parts[i].tmp*10 + 500;
- for (rx=-2; rx<3; rx++)
- for (ry=-2; ry<3; ry++)
- if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
- {
- r = pmap[y+ry][x+rx];
- if (!r)
- continue;
- nplm = 0;
- //Stickness
- if ((dx*dx + dy*dy)>1.5 && (nplm || !ptypes[r&0xFF].falldown || (fabs(rx)<2 && fabs(ry)<2)))
- {
- float per, nd;
- nd = dx*dx + dy*dy - 0.5;
- per = 5*(1 - parts[i].tmp/100)*(nd/(dx*dx + dy*dy + nd) - 0.5);
- if (ptypes[r&0xFF].state==ST_LIQUID)
- per *= 0.1;
- dx *= per; dy *= per;
- parts[i].vx += dx;
- parts[i].vy += dy;
- if (ptypes[r&0xFF].properties&TYPE_PART || (r&0xFF)==PT_GOO)
- {
- parts[r>>8].vx -= dx;
- parts[r>>8].vy -= dy;
- }
- }
- }
- if ((r&0xFF)==PT_SPRK)
- {
- part_change_type(i,x,y,PT_FIRE);
- }
- //create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement