diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2011-10-10 22:55:42 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-10-10 22:55:42 (GMT) |
| commit | a87407f0dfda733441d74c2edb25852ec7b3ef4c (patch) | |
| tree | 1c2cf42fabe30b1c62b9471cf112a330c7672544 /src | |
| parent | bf8258ee306a9649e0cfbf5344f8a533907175d8 (diff) | |
| download | powder-a87407f0dfda733441d74c2edb25852ec7b3ef4c.zip powder-a87407f0dfda733441d74c2edb25852ec7b3ef4c.tar.gz | |
More functionality for LIGH, better english on element descriptions
Diffstat (limited to 'src')
| -rw-r--r-- | src/elements/ligh.c | 1 | ||||
| -rw-r--r-- | src/powder.c | 49 |
2 files changed, 50 insertions, 0 deletions
diff --git a/src/elements/ligh.c b/src/elements/ligh.c index 7ce780a..8f9c80e 100644 --- a/src/elements/ligh.c +++ b/src/elements/ligh.c @@ -140,6 +140,7 @@ int update_LIGH(UPDATE_FUNC_ARGS) if (parts[i].tmp2==-1) { kill_part(i); + update_PYRO(UPDATE_FUNC_SUBCALL_ARGS); return 0; } if (parts[i].tmp2<=0 || parts[i].life<=1) diff --git a/src/powder.c b/src/powder.c index 100ea96..dad1f6e 100644 --- a/src/powder.c +++ b/src/powder.c @@ -9,6 +9,8 @@ int gravwl_timeout = 0; int wire_placed = 0; +int lighting_recreate = 0; + float player[28]; //[0] is a command cell, [3]-[18] are legs positions, [19]-[26] are accelerations, [27] shows if player was spawned float player2[28]; @@ -842,6 +844,12 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a parts[i].tmp = 0; parts[i].tmp2 = 0; } + if (t==PT_LIGH) + { + parts[i].tmp=270; + if (p=-2) + parts[i].tmp2=4; + } if (t==PT_SOAP) { parts[i].tmp = -1; @@ -1329,10 +1337,33 @@ void update_particles_i(pixel *vid, int start, int inc) int starti = (start*-1); int surround[8]; int surround_hconduct[8]; + int lighting_ok=1; float pGravX, pGravY, pGravD; + if (sys_pause&&lighting_recreate>0) + { + for (i=0; i<=parts_lastActiveIndex; i++) + { + if (parts[i].type==PT_LIGH && parts[i].tmp2>0) + { + lighting_ok=0; + break; + } + } + } + + if (lighting_ok) + lighting_recreate--; + + if (lighting_recreate<0) + lighting_recreate=1; + + if (lighting_recreate>21) + lighting_recreate=21; + if (sys_pause&&!framerender)//do nothing if paused return; + if (ISGRAV==1)//crappy grav color handling, i will change this someday { ISGRAV = 0; @@ -2807,6 +2838,24 @@ int create_parts(int x, int y, int rx, int ry, int c, int flags) { gravwl_timeout = 60; } + + if (c==PT_LIGH) + { + if (lighting_recreate>0 && rx+ry>0) + return 0; + int p=create_part(-2, x, y, c); + if (p!=-1) + { + parts[p].life=rx+ry; + if (parts[p].life>55) + parts[p].life=55; + parts[p].temp=parts[p].life*150; // temperatute of the lighting shows the power of the lighting + lighting_recreate+=parts[p].life/2+1; + return 1; + } + else return 0; + } + if (dw==1) { ry = ry/CELL; |
