summaryrefslogtreecommitdiff
path: root/src/simulation/elements/LCRY.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/simulation/elements/LCRY.cpp')
-rw-r--r--src/simulation/elements/LCRY.cpp96
1 files changed, 47 insertions, 49 deletions
diff --git a/src/simulation/elements/LCRY.cpp b/src/simulation/elements/LCRY.cpp
index 7cd4def..2ca5c28 100644
--- a/src/simulation/elements/LCRY.cpp
+++ b/src/simulation/elements/LCRY.cpp
@@ -50,61 +50,59 @@ Element_LCRY::Element_LCRY()
int Element_LCRY::update(UPDATE_FUNC_ARGS)
{
- int r, rx, ry;
- if(parts[i].tmp==1 || parts[i].tmp==0)
+ int r, rx, ry, check, setto;
+ switch (parts[i].tmp)
{
- if(parts[i].tmp==1)
+ case 0:
+ check=3;
+ setto=1;
+ break;
+ case 1:
+ check=3;
+ setto=1;
+ if(parts[i].life<=0)
+ parts[i].tmp = 0;
+ else
{
- if(parts[i].life<=0)
- parts[i].tmp = 0;
- else
- {
- parts[i].life-=2;
- if(parts[i].life < 0)
- parts[i].life = 0;
- parts[i].tmp2 = parts[i].life;
- }
+ parts[i].life-=2;
+ if(parts[i].life < 0)
+ parts[i].life = 0;
+ parts[i].tmp2 = parts[i].life;
}
- 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 && (rx || ry))
- {
- r = pmap[y+ry][x+rx];
- if (!r)
- continue;
- if ((r&0xFF)==PT_LCRY && parts[r>>8].tmp == 3)
- {
- parts[r>>8].tmp = 1;
- }
- }
- }
- else if(parts[i].tmp==2 || parts[i].tmp==3)
- {
- if(parts[i].tmp==2)
+ break;
+ case 3:
+ check=0;
+ setto=2;
+ break;
+ case 2:
+ check=0;
+ setto=2;
+ if(parts[i].life>=10)
+ parts[i].tmp = 3;
+ else
{
- if(parts[i].life>=10)
- parts[i].tmp = 3;
- else
- {
- parts[i].life+=2;
- if(parts[i].life > 10)
- parts[i].life = 10;
- parts[i].tmp2 = parts[i].life;
- }
+ parts[i].life+=2;
+ if(parts[i].life > 10)
+ parts[i].life = 10;
+ parts[i].tmp2 = parts[i].life;
}
- 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 && (rx || ry))
+ break;
+
+ default:
+ return 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 && (rx || ry))
+ {
+ r = pmap[y+ry][x+rx];
+ if (!r)
+ continue;
+ if ((r&0xFF)==PT_LCRY && parts[r>>8].tmp == check)
{
- r = pmap[y+ry][x+rx];
- if (!r)
- continue;
- if ((r&0xFF)==PT_LCRY && parts[r>>8].tmp == 0)
- {
- parts[r>>8].tmp = 2;
- }
+ parts[r>>8].tmp = setto;
}
- }
+ }
return 0;
}
@@ -151,4 +149,4 @@ int Element_LCRY::graphics(GRAPHICS_FUNC_ARGS)
}
-Element_LCRY::~Element_LCRY() {} \ No newline at end of file
+Element_LCRY::~Element_LCRY() {}