mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 05:31:00 +00:00
- used static constant arrays to shorten some code.
This commit is contained in:
parent
5951a9449c
commit
159f09105e
2 changed files with 8 additions and 22 deletions
|
@ -282,21 +282,11 @@ class Actor : Thinker native
|
|||
|
||||
void SpawnDirt (double radius)
|
||||
{
|
||||
class<Actor> dtype;
|
||||
switch (random[Dirt](0, 5))
|
||||
{
|
||||
case 0: dtype = "Dirt1"; break;
|
||||
case 1: dtype = "Dirt2"; break;
|
||||
case 2: dtype = "Dirt3"; break;
|
||||
case 3: dtype = "Dirt4"; break;
|
||||
case 4: dtype = "Dirt5"; break;
|
||||
default: dtype = "Dirt6"; break;
|
||||
}
|
||||
|
||||
static const class<Actor> chunks[] = { "Dirt1", "Dirt2", "Dirt3", "Dirt4", "Dirt5", "Dirt6" };
|
||||
double zo = random[Dirt]() / 128. + 1;
|
||||
Vector3 pos = Vec3Angle(radius, random[Dirt]() * (360./256), zo);
|
||||
|
||||
Actor mo = Spawn (dtype, pos, ALLOW_REPLACE);
|
||||
Actor mo = Spawn (chunks[random[Dirt](0, 5)], pos, ALLOW_REPLACE);
|
||||
if (mo)
|
||||
{
|
||||
mo.Vel.Z = random[Dirt]() / 64.;
|
||||
|
|
|
@ -58,11 +58,9 @@ class Demon1 : Actor
|
|||
DEMN H 6;
|
||||
DEMN I 6
|
||||
{
|
||||
A_SpawnItemEx("Demon1Chunk1", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle+90), frandom[DemonChunks](1,4.984375)*sin(Angle+90), 8, 90, ChunkFlags);
|
||||
A_SpawnItemEx("Demon1Chunk2", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags);
|
||||
A_SpawnItemEx("Demon1Chunk3", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags);
|
||||
A_SpawnItemEx("Demon1Chunk4", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags);
|
||||
A_SpawnItemEx("Demon1Chunk5", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags);
|
||||
static const class<Actor> chunks[] = { "Demon1Chunk1", "Demon1Chunk2", "Demon1Chunk3", "Demon1Chunk4", "Demon1Chunk5" };
|
||||
for(int i = 0; i < 5; i++)
|
||||
A_SpawnItemEx(chunks[i], 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle+90), frandom[DemonChunks](1,4.984375)*sin(Angle+90), 8, 90, ChunkFlags);
|
||||
}
|
||||
Goto Death+2;
|
||||
Ice:
|
||||
|
@ -266,11 +264,9 @@ class Demon2 : Demon1
|
|||
DEM2 H 6;
|
||||
DEM2 I 6
|
||||
{
|
||||
A_SpawnItemEx("Demon2Chunk1", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle+90), frandom[DemonChunks](1,4.984375)*sin(Angle+90), 8, 90, ChunkFlags);
|
||||
A_SpawnItemEx("Demon2Chunk2", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags);
|
||||
A_SpawnItemEx("Demon2Chunk3", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags);
|
||||
A_SpawnItemEx("Demon2Chunk4", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags);
|
||||
A_SpawnItemEx("Demon2Chunk5", 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle-90), frandom[DemonChunks](1,4.984375)*sin(Angle-90), 8, 270, ChunkFlags);
|
||||
static const class<Actor> chunks[] = { "Demon2Chunk1", "Demon2Chunk2", "Demon2Chunk3", "Demon2Chunk4", "Demon2Chunk5" };
|
||||
for(int i = 0; i < 5; i++)
|
||||
A_SpawnItemEx(chunks[i], 0,0,45, frandom[DemonChunks](1,4.984375)*cos(Angle+90), frandom[DemonChunks](1,4.984375)*sin(Angle+90), 8, 90, ChunkFlags);
|
||||
}
|
||||
Goto Death+2;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue