Beispiel #1
0
void Splash(int32_t tx, int32_t ty, int32_t amt, C4Object *pByObj) {
  // Splash only if there is free space above
  if (GBackSemiSolid(tx, ty - 15))
    return;
  // get back mat
  int32_t iMat = GBackMat(tx, ty);
  // check liquid
  if (MatValid(iMat))
    if (DensityLiquid(Game.Material.Map[iMat].Density) &&
        Game.Material.Map[iMat].Instable) {
      int32_t sy = ty;
      while (GBackLiquid(tx, sy) && sy > ty - 20 && sy >= 0)
        sy--;
      // Splash bubbles and liquid
      for (int32_t cnt = 0; cnt < amt; cnt++) {
        BubbleOut(tx + Random(16) - 8, ty + Random(16) - 6);
        if (GBackLiquid(tx, ty) && !GBackSemiSolid(tx, sy))
          Game.PXS.Create(Game.Landscape.ExtractMaterial(tx, ty), itofix(tx),
                          itofix(sy), FIXED100(Random(151) - 75),
                          FIXED100(-Random(200)));
      }
    }
  // Splash sound
  if (amt >= 20)
    StartSoundEffect("Splash2", false, 100, pByObj);
  else if (amt > 1)
    StartSoundEffect("Splash1", false, 100, pByObj);
}
Beispiel #2
0
global func BlueExplosionEffect(int level, int x, int y)
{
	var glimmer =
	{
		Prototype = Particles_Glimmer(),
		R = PV_Random(100, 150),
		G = PV_Random(100, 150),
		B = PV_Random(200, 255)
	};
	var fire =
	{
		Prototype = Particles_Fire(),
		R = PV_Random(100, 150),
		G = PV_Random(100, 150),
		B = PV_Random(200, 255),
		Size = PV_Random(level/2, level/3)
	};
	var smoke =
	{
		Prototype = Particles_SmokeTrail(),
		R = PV_Linear(PV_Random(100, 150), 0),
		G = PV_Linear(PV_Random(100, 150), 0),
		B = PV_Linear(PV_Random(200, 255), 0),
		Size = PV_Random(level - 5, level + 5)
	};
	// Blast particle.
	CreateParticle("SmokeDirty", x, y, PV_Random(-2, 2), PV_Random(-2, 2), PV_Random(20, 40), smoke, 10);
	CreateParticle("MagicFire", x, y, PV_Random(-20, 20), PV_Random(-20, 20), PV_Random(5, 10), fire, 20);
	if(!GBackLiquid(x,y)) CreateParticle("SphereSpark", x, y, PV_Random(-100, 100), PV_Random(-100, 100), PV_Random(5, 36 * 3), glimmer, level);

	if(GBackLiquid(x,y)) CastObjects(Fx_Bubble, level * 4 / 10, level, x, y);
	return;
}
Beispiel #3
0
void Splash(int32_t tx, int32_t ty, int32_t amt, C4Object *pByObj)
{
	// Splash only if there is free space above
	if (GBackSemiSolid(tx, ty - 15)) return;
	// get back mat
	int32_t iMat = GBackMat(tx, ty);
	// check liquid
	if (MatValid(iMat))
		if (DensityLiquid(::MaterialMap.Map[iMat].Density) && ::MaterialMap.Map[iMat].Instable)
		{
			int32_t sy = ty;
			while (GBackLiquid(tx, sy) && sy > ty - 20 && sy >= 0) sy--;
			// Splash bubbles and liquid
			for (int32_t cnt=0; cnt<amt; cnt++)
			{
				int32_t bubble_x = tx+Random(16)-8;
				int32_t bubble_y = ty+Random(16)-6;
				BubbleOut(bubble_x,bubble_y);
				if (GBackLiquid(tx,ty) && !GBackSemiSolid(tx, sy))
				{
					C4Real xdir = C4REAL100(Random(151)-75);
					C4Real ydir = C4REAL100(-Random(200));
					::PXS.Create(::Landscape.ExtractMaterial(tx,ty,false),
					             itofix(tx),itofix(sy),
					             xdir,
					             ydir);
				}
			}
		}
	// Splash sound
	if (amt>=20)
		StartSoundEffect("Splash2",false,100,pByObj);
	else if (amt>1) StartSoundEffect("Splash1",false,100,pByObj);
}
Beispiel #4
0
bool SimFlightHitsLiquid(C4Real fcx, C4Real fcy, C4Real xdir, C4Real ydir)
{
	// Start in water?
	int temp;
	if (DensityLiquid(GBackDensity(fixtoi(fcx), fixtoi(fcy))))
		if (!SimFlight(fcx, fcy, xdir, ydir, 0, C4M_Liquid - 1, temp=10))
			return false;
	// Hits liquid?
	if (!SimFlight(fcx, fcy, xdir, ydir, C4M_Liquid, 100, temp=-1))
		return false;
	// liquid & deep enough?
	return GBackLiquid(fixtoi(fcx), fixtoi(fcy)) && GBackLiquid(fixtoi(fcx), fixtoi(fcy) + 9);
}
Beispiel #5
0
private func Hit()
{
	Sound("DullMetalHit?");
	if (iVolume >= 1)
	{
		if (GBackLiquid(0, 7) && GetMaterial(0, 7) != szLiquid)
			return 0;
		EmptyBarrel(GetR());
		Sound("Splash1");
	}
}
Beispiel #6
0
func Hit()
  {
  if(!GBackLiquid())
    {
    for(var i=15; i>0; i--)
      {
      var iX=Sin(GetR(), RandomX(4,8)), iY=-Cos(GetR(), RandomX(4,8)), iXDir=GetWind()*30/100, iYDir=-Cos(GetR()+RandomX(-2,2), Random(7));
      InsertMaterial(Material("Water"), iX, iY, iXDir, iYDir);
      }
    SetEmpty();
    }
  }
Beispiel #7
0
func GrowBerry() {
	// Picked berries last forever
	if (collected) return(0);
	
	growth++;
	
	// Spoil quicker in dropped & in water
	if (GBackLiquid() && GetCategory() == 16) {
		growth += 2;
	}
	
	SetGrowthStage();
}
Beispiel #8
0
private func Activity() {
  var pBait;
  // Ein Köder in der Nähe?
  if (pBait=FindObject(0,-1000,-1250,2000,1500, OCF_InLiquid(), "Bait" ) )
    // Schwarze Fische sind nicht wählerisch
    SetCommand(this(),"Follow",pBait);

  // Schwimmverhalten
  if (!GBackLiquid (0, -8)) return (SetComDir (COMD_Down ()));
  if (Random(2)) return(1);
  if (SEqual(GetAction(),"Walk")) WalkDir();
  if (Not( SEqual(GetAction(),"Swim") )) return(1);
  if (Random(2)) return(TurnRight(),SetComDir(COMD_Right()));
  return(TurnLeft(),SetComDir(COMD_Left()));
}
Beispiel #9
0
public func Intro_Init(int difficulty)
{
	// Set wind to the left, so that less lava is on the starting place.
	SetWind(-50 - Random(50));
	
	// Determine crater lava height.
	var lava_y = 0;
	while (!GBackLiquid(LandscapeWidth() / 2, lava_y) && lava_y < LandscapeHeight())
		lava_y++;
	
	// Create an airplane with pilot and fly it towards the peak.
	this.airplane = CreateObjectAbove(Airplane, LandscapeWidth() / 2 - 564, lava_y - 176);
	this.pilot = CreateObjectAbove(Clonk, LandscapeWidth() / 2 - 564, lava_y - 176);
	this.pilot->SetName("$PilotName$");
	this.pilot->SetSkin(2);
	this.pilot->Enter(this.airplane);
	this.pilot->SetAction("Walk");
	this.pilot->SetDir(DIR_Right);
	this.pilot->SetColor(0xff0000aa);
	this.airplane->PlaneMount(this.pilot);
	this.airplane->FaceRight();
	this.airplane->StartInstantFlight(90, 15);
	this.airplane->SetXDir(12);
	this.airplane->SetYDir(-1);
	this.airplane->MakeInvincible();
	this.airplane.intro_seq = this;
	// Fill the airplane with some materials.
	this.difficulty = difficulty;
	if (difficulty <= 2)
	{
		this.airplane->CreateContents(Loam, 5);
		this.airplane->CreateContents(Bread, 5);
		this.airplane->CreateContents(Wood, 8);
		this.airplane->CreateContents(Rock, 4);
		this.airplane->CreateContents(Metal, 4);
		if (difficulty <= 1)
		{
			this.airplane->CreateContents(Pickaxe, 2);
			for (var i = 0; i < 5; i++)
				this.airplane->CreateContents(Barrel)->PutLiquid("Water", 300);
		}	
	}
	return;
}
Beispiel #10
0
func findSpawnPoint(miny) {
	var x,y;
	
	while (true) {
		x = 20 + Random(LandscapeWidth() - 40);
		y = miny;
		
		while (GBackSolid(x, y) && y < LandscapeHeight()) {
			y++;
		}
		y = GetYSolid(x, y);
		
		if (LandscapeHeight() - y < 10) continue;
		if (FindObject2(Find_InRect(x-30, y - 80, 60, 160), Find_Category (C4D_Structure))) continue;
		if (GBackLiquid(x, y-3)) continue;
		
		return [x,y];
	}
	return [];
}
Beispiel #11
0
func SwimAround()
{
	if (!GBackLiquid() || !Random(100)) return RemoveObject();
	SetSpeed(0, 0);
}