Merge branch 'master' into liquid_container

liquid_container
Mark 2016-04-11 21:23:28 +02:00
commit b6b5f5a79f
67 changed files with 647 additions and 247 deletions

View File

@ -2,7 +2,7 @@
Name=$MapType$
Description=$DescMapType$
ID=MapType
Default=0
Default=1
[Options]
@ -20,7 +20,7 @@ Default=0
Name=$Weapons$
Description=$DescWeapons$
ID=Weapons
Default=0
Default=1
[Options]
@ -38,7 +38,7 @@ Default=0
Name=$Rounds$
Description=$DescRounds$
ID=Rounds
Default=1
Default=7
[Options]
@ -61,3 +61,7 @@ Default=1
[Option]
Name=7
Value=7
[Option]
Name=11
Value=11

View File

@ -21,8 +21,8 @@ func Initialize()
func ResetRound()
{
// Retrieve all Clonks.
var clonks = FindObjects(Find_OCF(OCF_CrewMember));
for (var clonk in clonks)
var clonks = [];
for (var clonk in FindObjects(Find_OCF(OCF_CrewMember)))
{
var container = clonk->Contained();
if (container)
@ -30,6 +30,15 @@ func ResetRound()
clonk->Exit();
container->RemoveObject();
}
else
{
// Players not waiting for a relaunch get a new Clonk to prevent
// status effects from carrying over to the next round.
var new_clonk = CreateObject(clonk->GetID(), 0, 0, clonk->GetOwner());
new_clonk->GrabObjectInfo(clonk);
clonk = new_clonk;
}
PushBack(clonks, clonk);
clonk->SetObjectStatus(C4OS_INACTIVE);
}
// Clear and redraw the map.
@ -208,7 +217,7 @@ func OnClonkDeath(object clonk)
// Check for victory after three seconds to allow stalemates.
if (!g_gameover)
g_check_victory_effect.Interval = 36 * 5;
g_check_victory_effect.Interval = g_check_victory_effect.Time + 36 * 3;
}
// Returns a list of colored player names, for example "Sven2, Maikel, Luchs"
@ -252,7 +261,8 @@ global func FxCheckVictoryTimer(_, proplist effect)
// Update the scoreboard.
UpdateScoreboardWins(team);
if (--g_remaining_rounds > 0 || GetLeadingTeam() == nil)
// The leading team has to win the last round.
if (--g_remaining_rounds > 0 || GetLeadingTeam() != team)
{
var msg2 = CurrentRoundStr();
Log(msg2);
@ -277,8 +287,10 @@ global func CurrentRoundStr()
return "$LastRound$";
else if (g_remaining_rounds > 1)
return Format("$RemainingRounds$", g_remaining_rounds);
else
else if (GetLeadingTeam() == nil)
return "$Tiebreak$";
else
return "$BonusRound$";
}
global func UpdateScoreboardWins(int team)

View File

@ -17,3 +17,4 @@ WinningTeam=Gewinner: %s
RemainingRounds=Noch %d Runden.
LastRound=Letzte Runde!
Tiebreak=Entscheidende Runde!
BonusRound=Bonusrunde!

View File

@ -17,3 +17,4 @@ WinningTeam=Winning team: %s
RemainingRounds=%d rounds remaining.
LastRound=Last round!
Tiebreak=Tiebreak!
BonusRound=Bonus round!

View File

@ -8,7 +8,7 @@
public func ControlUse(object pClonk)
{
Sound("Fire::Blast3");
Sound("Fire::Blast3*");
Exit(0,-GetY());
AddEffect("ThunderStrike",nil,100,1,nil,this->GetID(),pClonk->GetOwner(),this->GetX()-5);
RemoveObject();

View File

@ -13,6 +13,7 @@ public func Place(int amount, proplist area, ...)
}
public func IsValuable() { return true; }
public func QueryRebuy() { return true; }
local Name = "$Name$";
local Description = "$Description$";

View File

@ -9,6 +9,7 @@ protected func Hit()
public func IsFoundryProduct() { return true; }
public func GetFuelNeed() { return 100; }
public func IsValuable(){ return true; }
public func QueryRebuy(){ return true; }
local Name = "$Name$";
local Description = "$Description$";

View File

@ -15,6 +15,7 @@ protected func Hit(x, y)
public func IsFoundryIngredient() { return true; }
public func IsValuable(){ return true; }
public func QueryRebuy(){ return true; }
local Collectible = 1;

View File

@ -9,7 +9,7 @@ Vertices=3
VertexX=0,2,-2
VertexY=1,-1,-1
VertexFriction=40,40,40
Value=1
Value=2
Mass=10
Components=Rock=1
Projectile=1

View File

@ -41,6 +41,7 @@ func FxSparkleTimer(target, effect, effect_time)
}
func IsValuable() { return true; }
func QueryRebuy() { return true; }
func OnSale(int to_player, object sale_base)
{

View File

@ -9,7 +9,7 @@ Vertices=3
VertexX=2,2,0
VertexY=0,3,-3
VertexFriction=50,50,50
Value=15
Value=10
Mass=12
Components=Wood=1;Metal=1;
Rotate=1

View File

@ -9,7 +9,7 @@ Vertices=4
VertexX=-3,3,-3,3
VertexY=3,-3,-3,3
VertexFriction=50,50,50,50
Value=10
Value=20
Mass=1
Components=Cloth=2
Float=1

View File

@ -9,7 +9,7 @@ Vertices=4
VertexX=0,0,-4,4
VertexY=3,-6,10,10
VertexFriction=80,60,60
Value=12
Value=20
Mass=20
Components=PowderKeg=1;Firestone=1;Wood=1;
Rotate=1

View File

@ -9,6 +9,6 @@ Vertices=3
VertexX=0,2,-2
VertexY=3,-3,-3
VertexFriction=75,100,100
Value=1
Value=12
Mass=5
Components=Metal=1
Components=Metal=1;Wood=1;

View File

@ -10,7 +10,7 @@ Vertices=3
VertexX=-2,+2,0
VertexY=5,5,-5
VertexFriction=90,90,90
Value=3
Value=6
Mass=8
Rotate=1
Components=Coal=1;Firestone=1

View File

@ -10,7 +10,7 @@ VertexX=3,3,-3,-3
VertexY=-2,2,-2,2
VertexFriction=50,50,50,50
Picture=0,0,64,64
Value=16
Value=20
Mass=30
Components=Wood=1;Coal=2;Firestone=2
Rotate=1

View File

@ -9,7 +9,7 @@ Vertices=4
VertexX=-1,-1,-3,3
VertexY=1,5,-2,-2
VertexFriction=80,80,80,80
Value=3
Value=8
Mass=15
Components=Wood=1;Rock=1;
Rotate=1

View File

@ -9,7 +9,7 @@ Vertices=2
VertexX=0,0
VertexY=3,-3
VertexFriction=75,100
Value=15
Value=20
Mass=4
Rotate=1
Components=Metal=1
Components=Firestone=1;Coal=1;Metal=1;

View File

@ -6,7 +6,7 @@
#include Library_Ladder
local master, index;
local index;
local angle;
public func SetAngle(int new_angle)
@ -17,8 +17,10 @@ public func SetAngle(int new_angle)
// Called from the ladder object to set a master and the segment index.
public func SetMaster(object new_master, int new_index)
{
master = new_master;
index = new_index;
// First perform setting the master in the library function.
_inherited(new_master, new_index, ...);
index = new_index;
return;
}
// Returns whether the ladder can be climbed.

View File

@ -9,7 +9,7 @@ Vertices=3
VertexX=0,-3,3
VertexY=-3,2,2
VertexFriction=40,40,40
Value=20
Value=25
Mass=7
Components=Metal=2;
Rotate=1

View File

@ -10,7 +10,7 @@ VertexX=-5,5,0
VertexY=0,0,0
VertexCNAT=1,2,16
VertexFriction=30,30,30
Value=8
Value=20
Mass=12
Components=Metal=2
Rotate=1

View File

@ -9,7 +9,7 @@ Vertices=4
VertexX=-2,2,-2,2
VertexY=-10,-10,10,10
VertexFriction=100,100,100,100,100
Value=8
Value=12
Mass=10
Components=Wood=3;
Rotate=1

View File

@ -9,7 +9,7 @@ Vertices=2
VertexX=0,0
VertexY=-7,7
VertexFriction=50,50
Value=10
Value=12
Mass=20
Components=Wood=1;Metal=1;
Rotate=1

View File

@ -17,10 +17,10 @@ func Hit()
Sound("Hits::GeneralHit?");
}
local fAiming;
local is_aiming;
public func GetCarryMode(clonk) { if(fAiming >= 0) return CARRY_Musket; }
public func GetCarrySpecial(clonk) { if(fAiming > 0) return "pos_hand2"; }
public func GetCarryMode(clonk) { return CARRY_Musket; }
public func GetCarrySpecial(clonk) { if (is_aiming) return "pos_hand2"; }
public func GetCarryBone() { return "main"; }
public func GetCarryTransform()
{
@ -38,6 +38,7 @@ func Initialize()
MuzzleOffset = -8;
loaded = false;
is_aiming = false;
animation_set = {
AimMode = AIM_Position, // The aiming animation is done by adjusting the animation position to fit the angle
@ -90,8 +91,7 @@ func ControlUseStart(object clonk, int x, int y)
return true;
}
fAiming = 1;
is_aiming = true;
holding = true;
// reload weapon if not loaded yet
@ -159,7 +159,7 @@ protected func ControlUseCancel(object clonk, int x, int y)
public func Reset(clonk)
{
fAiming = 0;
is_aiming = false;
}
private func FireWeapon(object clonk, int angle)

View File

@ -10,6 +10,6 @@ VertexX=0,-3,3
VertexY=0,1,1
VertexFriction=50
Picture=64,0,64,64
Value=10
Value=12
Mass=5
Components=Metal=1;Blackpowder=1;

View File

@ -14,10 +14,10 @@ func Hit()
Sound("Hits::GeneralHit?");
}
local fAiming;
local is_aiming;
public func GetCarryMode(clonk) { if(fAiming >= 0) return CARRY_Musket; }
public func GetCarrySpecial(clonk) { if(fAiming > 0) return "pos_hand2"; }
public func GetCarryMode(clonk) { return CARRY_Musket; }
public func GetCarrySpecial(clonk) { if (is_aiming) return "pos_hand2"; }
public func GetCarryBone() { return "main"; }
public func GetCarryTransform()
{
@ -35,6 +35,7 @@ func Initialize()
MuskOffset = -8;
loaded = false;
is_aiming = false;
animation_set = {
AimMode = AIM_Position, // The aiming animation is done by adjusting the animation position to fit the angle
@ -88,7 +89,7 @@ func ControlUseStart(object clonk, int x, int y)
return true;
}
fAiming = 1;
is_aiming = true;
holding = true;
@ -125,7 +126,7 @@ protected func ControlUseStop(object clonk, ix, iy)
{
holding = false;
clonk->StopAim();
return -1;
return true;
}
// Callback from the clonk, when he actually has stopped aiming
@ -148,7 +149,7 @@ protected func ControlUseCancel(object clonk, int x, int y)
public func Reset(clonk)
{
fAiming = 0;
is_aiming = false;
}
private func FireWeapon(object clonk, int angle)

View File

@ -10,7 +10,7 @@ Vertices=3
VertexX=-2,3,0
VertexY=-3,-3,4
VertexFriction=20,20,20
Value=25
Value=20
Mass=12
Components=Firestone=1;Coal=1;Metal=1;
Rotate=1

View File

@ -9,7 +9,7 @@ Vertices=3
VertexX=0,0
VertexY=-7,7
VertexFriction=50,50
Value=10
Value=15
Mass=20
Components=Wood=1;Metal=1;
Rotate=1

View File

@ -1,20 +1,16 @@
/**
Ladder Climbing
Gives the ability to clonks climb on ladders.
Gives the ability to clonks climb on ladders, to be included by the clonk.
@author Randrian
*/
local jump_startcall;
local no_ladder_counter;
public func GetTurnPhase() { return _inherited(...); }
public func Definition(proplist def)
{
// Only add action if included by clonk.
if (!def.ActMap)
return _inherited(def);
// Add actions for climbing and overload jumping actions to search for ladders.
def.ActMap = {
Prototype = def.ActMap,
Climb = {
@ -30,24 +26,27 @@ public func Definition(proplist def)
Jump = {
Prototype = def.ActMap.Jump,
StartCall = "StartSearchLadder",
// save old phasecall of jump
// Save the old phasecall of the jump.
StartCallLadderOverloaded = def.ActMap.Jump.StartCall
},
WallJump = {
Prototype = def.ActMap.WallJump,
StartCall = "StartSearchLadder",
// save old phasecall of jump
// Save the old phasecall of the wall jump.
StartCallLadderOverloaded = def.ActMap.WallJump.StartCall
}
};
_inherited(def);
return _inherited(def);
}
public func StartScale()
{
// Should be overloaded, and add a climb animation here
return _inherited(...);
}
public func GetTurnPhase() { return _inherited(...); }
public func SetTurnType() { return _inherited(...); }
public func SetHandAction() { return _inherited(...); }
// Should be overloaded, and add a climb animation here
public func StartScale() { return _inherited(...); }
/*-- Ladder Searching --*/
public func StartSearchLadder()
{
@ -56,8 +55,9 @@ public func StartSearchLadder()
Call(this.ActMap.Jump.StartCallLadderOverloaded);
if (GetAction() == "WallJump" && this.ActMap.WallJump.StartCallLadderOverloaded)
Call(this.ActMap.WallJump.StartCallLadderOverloaded);
// Add an effect to search for ladders.
if (!GetEffect("InSearchLadder", this))
AddEffect("IntSearchLadder", this, 1, 5, this);
AddEffect("IntSearchLadder", this, 1, 2, this);
FxIntSearchLadderTimer();
return;
}
@ -76,25 +76,19 @@ public func FxIntSearchLadderTimer(object target, proplist effect, int time)
if (GetAction() != "Jump" && GetAction() != "WallJump")
return FX_Execute_Kill;
// Don't search for ladders if the counter is non-zero.
if (no_ladder_counter > 0)
{
no_ladder_counter--;
return FX_OK;
}
// Find a ladder.
// Find a ladder which can be climbed.
var ladder;
for (ladder in FindObjects(Find_AtRect(-5, -10, 10, 8), Find_Func("IsLadder"), Find_NoContainer(), Find_Layer(GetObjectLayer())))
{
if (!ladder->~CanNotBeClimbed())
{
SetAction("Climb");
ladder->~OnLadderGrab(this);
PlayAnimation(GetLadderScaleAnimation(), CLONK_ANIM_SLOT_Movement, Anim_Y(0, GetAnimationLength(GetLadderScaleAnimation()), 0, 15), Anim_Linear(0, 0, 1000, 5, ANIM_Remove));
AddEffect("IntClimbControl", this, 1, 1, this, nil, ladder);
return FX_Execute_Kill;
}
// Don't climb ladders that are blocked.
if (ladder->~CanNotBeClimbed() || IsBlockedLadder(ladder))
continue;
SetAction("Climb");
ladder->~OnLadderGrab(this);
PlayAnimation(GetLadderScaleAnimation(), CLONK_ANIM_SLOT_Movement, Anim_Y(0, GetAnimationLength(GetLadderScaleAnimation()), 0, 15), Anim_Linear(0, 0, 1000, 5, ANIM_Remove));
AddEffect("IntClimbControl", this, 1, 1, this, nil, ladder);
return FX_Execute_Kill;
}
return FX_OK;
}
@ -103,123 +97,140 @@ public func FxIntSearchLadderStop(object target, proplist effect, reason, tmp)
{
if (tmp)
return FX_OK;
no_ladder_counter = 0;
return FX_OK;
}
public func FxIntClimbControlStart(object target, proplist effect, tmp, object ladder)
/*-- Ladder Block --*/
private func AddLadderBlock(object ladder, int duration)
{
AddEffect("IntBlockLadder", this, 100, duration, this, nil, ladder);
return;
}
private func IsBlockedLadder(object ladder)
{
var index = 0;
var fx;
while (fx = GetEffect("IntBlockLadder", this, index++))
if (fx.ladder->IsSameLadder(ladder))
return true;
return false;
}
public func FxIntBlockLadderStart(object target, effect fx, int tmp, object to_ladder)
{
if (tmp)
return FX_OK;
fx.ladder = to_ladder;
return FX_OK;
}
public func FxIntBlockLadderTimer(object target, effect fx, int time)
{
return FX_Execute_Kill;
}
/*-- Ladder Control --*/
public func FxIntClimbControlStart(object target, effect fx, int tmp, object ladder)
{
if (tmp)
return FX_OK;
effect.ladder = ladder;
fx.ladder = ladder;
SetXDir(0);
SetYDir(0);
SetComDir(COMD_Stop);
effect.odd = 0; // odd or even segment?
// Start on an even segment.
fx.odd = 0;
// Correctly initalize the relative y-position of the clonk to the segment.
var data = fx.ladder->GetLadderData();
var sy = data[1], ey = data[3];
var cy = GetY(1000);
var posy = 0;
if (ey - sy != 0)
posy = 100 * (cy - sy) / (ey - sy);
fx.pos = BoundBy(posy, 0, 100);
// Set some stuff for the clonk.
SetHandAction(1);
SetTurnType(1);
return FX_OK;
}
public func SetTurnType() { return _inherited(...); }
public func SetHandAction() { return _inherited(...); }
public func LadderStep(target, effect, fUp)
public func LadderStep(object target, effect fx, int climb_direction)
{
if (fUp == 1)
if (climb_direction != 1 && climb_direction != -1)
return fx.ladder != nil;
// Store old segment to forward to blocking.
var old_ladder_segment = fx.ladder;
// Increase position depending on direction and move to new segment if needed.
fx.pos += 10 * climb_direction;
if (fx.pos > 100)
{
effect.pos += 10;
if (effect.pos > 100)
fx.pos = 0;
fx.ladder = fx.ladder->GetNextLadder();
fx.odd = !fx.odd;
}
if (fx.pos < 0)
{
fx.pos = 100;
fx.ladder = fx.ladder->GetPreviousLadder();
fx.odd = !fx.odd;
}
// If no ladder has been found scale or jump off.
if (fx.ladder == nil)
{
var contact = GetContact(-1);
if (contact & CNAT_Left || contact & CNAT_Right)
{
effect.pos = 0;
effect.ladder = effect.ladder->GetNextLadder();
effect.odd = !effect.odd;
SetAction("Scale");
old_ladder_segment->~OnLadderReleased(this);
return false;
}
if (effect.ladder == nil)
AddLadderBlock(old_ladder_segment, 10);
SetAction("Jump");
// Increase speed if moving up.
if (climb_direction == 1)
{
var contact = GetContact(-1);
if (contact & CNAT_Left || contact & CNAT_Right)
{
SetAction("Scale");
return false;
}
no_ladder_counter = 5;
SetAction("Jump");
SetXDir(-5+10*GetDir());
SetXDir(-5 + 10 * GetDir());
SetYDir(-5);
return false;
}
old_ladder_segment->~OnLadderReleased(this);
return false;
}
else
{
effect.pos -= 10;
if(effect.pos < 0)
{
effect.pos = 100;
effect.ladder = effect.ladder->GetPreviousLadder();
effect.odd = !effect.odd;
}
if (effect.ladder == nil)
{
var contact = GetContact(-1);
if (contact & CNAT_Left || contact & CNAT_Right)
{
SetAction("Scale");
return false;
}
no_ladder_counter = 5;
SetAction("Jump");
return false;
}
}
if (effect.ladder == nil) return false;
return true;
}
public func FxIntClimbControlTimer(object target, proplist effect, int time)
public func FxIntClimbControlTimer(object target, effect fx, int time)
{
if (GetAction() != "Climb" || Contained())
return FX_Execute_Kill;
if (effect.ladder && effect.ladder->~CanNotBeClimbed(true))
effect.ladder = nil;
if (!effect.ladder)
if (!fx.ladder || fx.ladder->~CanNotBeClimbed(true))
{
no_ladder_counter = 5;
AddLadderBlock(fx.ladder, 5);
SetAction("Jump");
SetXDir(-5 + 10 * GetDir());
SetYDir(-5);
return FX_Execute_Kill;
}
// Progress
var step = 0;
// Progress movement in the controlled direction.
var climb_direction = 0;
if (GetComDir() == COMD_Down)
step = -1;
climb_direction = -1;
if (GetComDir() == COMD_Up)
step = 1;
if (step && !LadderStep(target, effect, step))
{
var contact = GetContact(-1);
if (contact & CNAT_Left || contact & CNAT_Right)
SetAction("Scale");
else
{
no_ladder_counter = 5;
SetAction("Jump");
if (step == 1) // For Up add some speed
{
SetXDir(-5 + 10 * GetDir());
SetYDir(-5);
no_ladder_counter = 10;
}
}
climb_direction = 1;
// LadderStep advances the ladder segment or the ladder position.
if (climb_direction && !LadderStep(target, fx, climb_direction))
return FX_Execute_Kill;
}
var data = effect.ladder->GetLadderData();
// Move the clonk along the ladder according to the new pos/segment.
var data = fx.ladder->GetLadderData();
var startx = data[0], starty = data[1], endx = data[2], endy = data[3], angle = data[4];
var x = startx + (endx-startx) * effect.pos / 100 + 5000 - 100 * GetTurnPhase();
var y = starty + (endy-starty) * effect.pos / 100;
var x = startx + (endx - startx) * fx.pos / 100 + 5000 - 100 * GetTurnPhase();
var y = starty + (endy - starty) * fx.pos / 100;
var lx = LadderToLandscapeCoordinates(x);
var ly = LadderToLandscapeCoordinates(y);
var old_x = GetX(), old_y = GetY();
@ -229,6 +240,8 @@ public func FxIntClimbControlTimer(object target, proplist effect, int time)
SetXDir(0);
SetYDir(0);
SetLadderRotation(-angle, x - GetX() * 1000, y - GetY() * 1000);
// Handle if the clonk gets stuck.
if (Stuck())
{
var dir = -1;
@ -237,40 +250,47 @@ public func FxIntClimbControlTimer(object target, proplist effect, int time)
for (var i = 1; i <= 5; i++)
{
SetPosition(LadderToLandscapeCoordinates(x) + i * dir, LadderToLandscapeCoordinates(y));
if (!Stuck()) break;
if (!Stuck())
break;
}
if (Stuck()) SetPosition(LadderToLandscapeCoordinates(x) + 5 * dir, LadderToLandscapeCoordinates(y));
if (Stuck())
SetPosition(LadderToLandscapeCoordinates(x) + 5 * dir, LadderToLandscapeCoordinates(y));
}
if (Stuck())
{
// Revert Position and step
// Revert Position and step.
SetPosition(old_x, old_y);
if (step)
LadderStep(target, effect, -step);
// if we are to far left or right try to turn
if (climb_direction)
LadderStep(target, fx, -climb_direction);
// If we are too far left or right try to turn.
if (GetDir() == DIR_Left && LadderToLandscapeCoordinates(x) - 2 > GetX())
{
SetComDir(COMD_Right);
SetDir(DIR_Right);
}
else if (GetDir() == DIR_Right && LadderToLandscapeCoordinates(x)+2 < GetX())
else if (GetDir() == DIR_Right && LadderToLandscapeCoordinates(x) + 2 < GetX())
{
SetComDir(COMD_Left);
SetDir(DIR_Left);
}
}
else effect.ladder->~OnLadderClimb(this);
// Make the animation synchron with movement TODO: this only makes the feet synchronous for the arms the animation has to be adapted
else
{
fx.ladder->~OnLadderClimb(this);
}
// Make the animation synchron with movement.
// TODO: this only makes the feet synchronous for the arms the animation has to be adapted.
var animation = GetRootAnimation(5);
if (animation != nil)
{
if (GetAnimationName(animation) != nil)
{
var length = GetAnimationLength(GetAnimationName(animation));
var pos = effect.pos * length / 200 + length / 2 * effect.odd;
var pos = fx.pos * length / 200 + length / 2 * fx.odd;
SetAnimationPosition(animation, Anim_Const(pos));
}
}
// Start walking or hangling if the clonk makes contact with the floor or ceiling.
var contact = GetContact(-1);
if (contact)
{
@ -287,14 +307,15 @@ public func FxIntClimbControlTimer(object target, proplist effect, int time)
SetComDir(COMD_Left);
SetDir(0);
}
return -1;
return FX_Execute_Kill;
}
if (contact & CNAT_Bottom && GetComDir() == COMD_Down)
{
SetAction("Walk");
return -1;
return FX_Execute_Kill;
}
}
return FX_OK;
}
private func LadderToLandscapeCoordinates(int x)
@ -303,15 +324,20 @@ private func LadderToLandscapeCoordinates(int x)
return (x + 500) / 1000;
}
public func FxIntClimbControlStop(target, effect)
public func FxIntClimbControlStop(object target, effect fx, int reason, bool tmp)
{
if (tmp)
return FX_OK;
if (GetAction() == "Climb")
SetAction("Walk");
if (fx.ladder)
fx.ladder->~OnLadderReleased(this);
SetLadderRotation(0);
SetHandAction(0);
return FX_OK;
}
public func FxIntClimbControlControl(object target, proplist effect, int ctrl, int x, int y, int strength, bool repeat, bool release)
public func FxIntClimbControlControl(object target, effect fx, int ctrl, int x, int y, int strength, bool repeat, bool release)
{
// Only handle movement controls.
if (ctrl != CON_Up && ctrl != CON_Down && ctrl != CON_Right && ctrl != CON_Left)
@ -319,16 +345,24 @@ public func FxIntClimbControlControl(object target, proplist effect, int ctrl, i
// Perform actions on key down and not on release.
if (release)
return false;
// Move up and down by setting com dir.
if (ctrl == CON_Up)
{
SetComDir(COMD_Up);
else if (ctrl == CON_Down)
return true;
}
if (ctrl == CON_Down)
{
SetComDir(COMD_Down);
return true;
}
else if (ctrl == CON_Left)
// Handle left and right controls.
if (ctrl == CON_Left)
{
if (GetDir() == DIR_Left)
{
// Switch to the other side of the ladder.
if (GetComDir() == COMD_Stop)
{
SetPosition(GetX() - 10, GetY());
@ -343,17 +377,22 @@ public func FxIntClimbControlControl(object target, proplist effect, int ctrl, i
}
else
{
no_ladder_counter = 5;
// Let go of the ladder and remove the effect.
AddLadderBlock(fx.ladder, 5);
if (GetComDir() == COMD_Up)
this->ObjectCommand("Jump");
else
this->ObjectComLetGo(-10);
RemoveEffect(nil, target, fx);
}
return true;
}
else if (ctrl == CON_Right)
if (ctrl == CON_Right)
{
if (GetDir() == DIR_Right)
{
// Switch to the other side of the ladder.
if (GetComDir() == COMD_Stop)
{
SetPosition(GetX() + 10, GetY());
@ -368,12 +407,15 @@ public func FxIntClimbControlControl(object target, proplist effect, int ctrl, i
}
else
{
no_ladder_counter = 5;
// Let go of the ladder and remove the effect.
AddLadderBlock(fx.ladder, 5);
if (GetComDir() == COMD_Up)
this->ObjectCommand("Jump");
else
this->ObjectComLetGo(10);
RemoveEffect(nil, target, fx);
}
return true;
}
return true;
}

View File

@ -1,24 +1,43 @@
/**
Ladder Control
Containes the basic functionality for ladders.
Containes the basic functionality for ladder segments.
@author Randrian
*/
local master;
local next_segment;
local prev_segment;
public func IsLadder() { return true; }
public func SetMaster(object new_master)
{
master = new_master;
return;
}
public func GetMaster()
{
return master;
}
// Returns whether this segment and the other one are from the same ladder.
public func IsSameLadder(object other_segment)
{
return GetMaster() == other_segment->GetMaster();
}
// Returns the segment (start x, start y, end x, end y, angle) on which the clonk can climb.
// The coordinate value must be specified with a precision of a 1000.
public func GetLadderData()
{
// Normally (if not overloaded) interpret the first vertex as start and the second as end.
return [
GetX() + GetVertex(0, 0),
GetY() + GetVertex(0, 1),
GetX() + GetVertex(1, 0),
GetY() + GetVertex(1, 1),
GetX(1000) + 1000 * GetVertex(0, 0),
GetY(1000) + 1000 * GetVertex(0, 1),
GetX(1000) + 1000 * GetVertex(1, 0),
GetY(1000) + 1000 * GetVertex(1, 1),
0
];
}

View File

@ -127,31 +127,40 @@ private func Seed()
var plant;
if (CheckSeedChance())
{
// Apply confinement for plant placement
var size = SeedArea();
var area = Shape->Rectangle(GetX() - size / 2, GetY() - size / 2, size, size);
var confined_area = nil;
if (this.Confinement)
{
confined_area = Shape->Intersect(this.Confinement, area);
// Quick-check if intersection to confinement yields an empty area
// to avoid unnecessery search by PlaceVegetation
area = confined_area->GetBoundingRectangle();
if (area.w <= 0 || area.h <= 0) return;
}
// Place the plant...
plant = PlaceVegetation(GetID(), area.x, area.y, area.w, area.h, 3, confined_area);
if (plant)
{
// ...but check if it is not close to another one.
var neighbour = FindObject(Find_ID(GetID()), Find_Exclude(plant), Sort_Distance(plant->GetX() - GetX(), plant->GetY() - GetY()));
var distance = ObjectDistance(plant, neighbour);
// Closeness check
if (distance < SeedOffset())
plant->RemoveObject();
else if (this.Confinement)
plant->KeepArea(this.Confinement);
}
plant = DoSeed();
}
return plant;
}
/** Forcefully places a seed of the plant, without random chance
or other sanity checks. This is useful for testing.
*/
private func DoSeed()
{
// Apply confinement for plant placement
var size = SeedArea();
var area = Shape->Rectangle(GetX() - size / 2, GetY() - size / 2, size, size);
var confined_area = nil;
if (this.Confinement)
{
confined_area = Shape->Intersect(this.Confinement, area);
// Quick-check if intersection to confinement yields an empty area
// to avoid unnecessery search by PlaceVegetation
area = confined_area->GetBoundingRectangle();
if (area.w <= 0 || area.h <= 0) return;
}
// Place the plant...
var plant = PlaceVegetation(GetID(), area.x, area.y, area.w, area.h, 3, confined_area);
if (plant)
{
// ...but check if it is not close to another one.
var neighbour = FindObject(Find_ID(GetID()), Find_Exclude(plant), Sort_Distance(plant->GetX() - GetX(), plant->GetY() - GetY()));
var distance = ObjectDistance(plant, neighbour);
// Closeness check
if (distance < SeedOffset())
plant->RemoveObject();
else if (this.Confinement)
plant->KeepArea(this.Confinement);
}
return plant;
}

View File

@ -79,7 +79,7 @@ func FxIntBaseHealTimer(pClonk, effect)
if(GetWealth(GetOwner()) >= GetHealCost())
{
DoWealth(GetOwner(), -GetHealCost());
Sound("UnCash", 0, 100, pClonk->GetOwner()+1); // TODO: get sound
Sound("UI::UnCash?", {player = pClonk->GetOwner()});
iEnergy = GetHeal()*5;
}
}

View File

@ -128,7 +128,7 @@ protected func Initialize()
lib_power = {};
// A single variable to keep track whether power is needed.
// Power is not needed when the no power need rule is active.
lib_power.power_need = ObjectCount(Find_ID(Rule_NoPowerNeed)) == 0;
lib_power.power_need = !FindObject(Find_ID(Rule_NoPowerNeed));
return _inherited(...);
}

View File

@ -19,7 +19,8 @@ public func GetInteractionMenus(object clonk)
{
var menus = _inherited() ?? [];
// Only add a power menu if the structure is a flagpole (Library_Flag).
if (this->~IsFlagpole())
// And only if a power network is already initialized for this object.
if (this->~IsFlagpole() && this->GetPowerHelper())
{
var power_menu =
{
@ -43,6 +44,24 @@ public func GetPowerDisplayMenuEntries(object clonk)
if (!power_network)
return menu_entries;
// If the no power need rule is active just state that.
if (FindObject(Find_ID(Rule_NoPowerNeed)))
{
var entry =
{
Bottom = "1.1em",
BackgroundColor = {Std = 0, OnHover = 0x50ff0000},
Priority = 0,
text =
{
Style = GUI_TextVCenter | GUI_TextLeft,
Text = "$MsgPowerNoNeed$"
}
};
PushBack(menu_entries, {symbol = Icon_Lightbulb, extra_data = "nopowerneed", custom = entry});
return menu_entries;
}
// Get all the power data.
var power_production_current = power_network->GetActivePowerAvailable(true) / 10;
var power_production_capacity = power_network->GetBarePowerAvailable() / 10;
@ -122,6 +141,10 @@ public func OnPowerDisplayHover(id symbol, string extra_data, desc_menu_target,
var power_stored_capacity = GetStoredPowerString(power_network->GetStoredPowerCapacity());
text = Format("$DescPowerStored$", power_stored, power_stored_capacity, power_stored);
}
else if (extra_data == "nopowerneed")
{
text = "$DescPowerNoNeed$";
}
}
GuiUpdateText(text, menu_id, 1, desc_menu_target);
return;

View File

@ -5,7 +5,9 @@ MsgPowerConsumption=Stromverbrauch:
MsgPowerConsumptionDemand=gesamte Nachfrage
MsgPowerStored=Gespeicherter Strom:
MsgPowerStoredCapacity=gesamte Kapazität
MsgPowerNoNeed=The no power need rule is active.
DescPowerProduction=All the power producers in this network together have a capacity of producing %d {{Icon_Lightbulb}}, currently %d {{Icon_Lightbulb}} is being produced.
DescPowerConsumption=Currently the consumers in this network demand %d {{Icon_Lightbulb}} in total to operate, %d {{Icon_Lightbulb}} is currently being supplied.
DescPowerStored=Power storages are currently holding %s {{Icon_Lightbulb}} out of their total capacity of %s {{Icon_Lightbulb}}. This is equivalent of powering a consumer using up one {{Icon_Lightbulb}} for %s minutes.
DescPowerStored=Power storages are currently holding %s {{Icon_Lightbulb}} out of their total capacity of %s {{Icon_Lightbulb}}. This is equivalent of powering a consumer using up one {{Icon_Lightbulb}} for %s minutes.
DescPowerNoNeed=If the no power need rule is active, none of the power consumers require power supply to operate.

View File

@ -5,7 +5,9 @@ MsgPowerConsumption=Power consumption:
MsgPowerConsumptionDemand=total demand
MsgPowerStored=Stored power:
MsgPowerStoredCapacity=total capacity
MsgPowerNoNeed=The no power need rule is active.
DescPowerProduction=All the power producers in this network together have a capacity of producing %d {{Icon_Lightbulb}}, currently %d {{Icon_Lightbulb}} is being produced.
DescPowerConsumption=Currently the consumers in this network demand %d {{Icon_Lightbulb}} in total to operate, %d {{Icon_Lightbulb}} is currently being supplied.
DescPowerStored=Power storages are currently holding %s {{Icon_Lightbulb}} out of their total capacity of %s {{Icon_Lightbulb}}. This is equivalent of powering a consumer using up one {{Icon_Lightbulb}} for %s minutes.
DescPowerStored=Power storages are currently holding %s {{Icon_Lightbulb}} out of their total capacity of %s {{Icon_Lightbulb}}. This is equivalent of powering a consumer using up one {{Icon_Lightbulb}} for %s minutes.
DescPowerNoNeed=If the no power need rule is active, none of the power consumers require power supply to operate.

View File

@ -64,30 +64,27 @@ func GetSellValue(object item)
// ------------------------ Buying -------------------------------------
func DoBuy(id item, int for_player, int wealth_player, object buyer, bool buy_all_available, bool show_errors)
func DoBuy(id item, int for_player, int wealth_player, object buyer, bool buy_all_available, bool error_sound)
{
// Tries to buy an object or all available objects for bRight == true
// Returns the last bought object
var num_available = this->GetBuyableAmount(wealth_player, item);
if(!num_available) return; //TODO
if (!num_available) return; //TODO
var num_buy = 1, purchased = nil;
if (buy_all_available) num_buy = num_available;
while (num_buy--)
{
var price = this->GetBuyValue(item);
// Does the player have enough money?
if(price > GetWealth(wealth_player))
if (price > GetWealth(wealth_player))
{
if(show_errors)
{
Sound("UI::Error", {player = for_player + 1});
PlayerMessage(for_player, "$MsgNotEnoughWealth$");
}
if (error_sound)
Sound("UI::Error", {player = for_player});
break;
}
// Take the cash
DoWealth(wealth_player, -price);
Sound("UI::UnCash", {player = for_player + 1}); // TODO: get sound
Sound("UI::UnCash?", {player = for_player});
// Decrease the base material, allow runtime overload
this->ChangeBuyableAmount(wealth_player, item, -1);
// Deliver the object
@ -113,7 +110,13 @@ func DoSell(object obj, int wealth_player)
// Give the player the cash
DoWealth(wealth_player, this->GetSellValue(obj));
Sound("UI::Cash", {player = wealth_player + 1});
Sound("UI::Cash", {player = wealth_player});
// Add the item to the homebase material.
if (!obj->~QueryRebuy(wealth_player, this))
{
this->ChangeBuyableAmount(wealth_player, obj, +1);
}
// OnSale callback to object e.g. for goal updates
obj->~OnSale(wealth_player, this);
@ -190,10 +193,10 @@ func GetBuyMenuEntry(int index, id item, int amount, int value)
{
var entry =
{
Right = "4em", Bottom = "2em",
Right = "2em", Bottom = "3em",
BackgroundColor = {Std = 0, OnHover = 0x50ff0000},
image = {Right = "2em", Style = GUI_TextBottom | GUI_TextRight},
price = {Left = "2em", Priority = 3}
image = {Bottom = "2em", Style = GUI_TextBottom | GUI_TextRight},
price = {Style = GUI_TextBottom | GUI_TextRight, Priority = 3}
};
entry.image.Symbol = item;
entry.image.Text = Format("%dx", amount);
@ -264,7 +267,7 @@ public func OnBuyMenuSelection(id def, extra_data, object clonk)
var wealth_player = GetOwner();
var for_player = clonk->GetController();
// Buy
DoBuy(def, for_player, wealth_player, clonk);
DoBuy(def, for_player, wealth_player, clonk, false, true);
// Excess objects exit flag (can't get them out...)
EjectAllContents();
UpdateInteractionMenus(this.GetBuyMenuEntries);

View File

@ -138,4 +138,4 @@ public func SaveScenarioObject(proplist props)
local Name = "$Name$";
local Description ="$Description$";
local HitPoints = 80;
local Plane = 190;
local Plane = 190;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 118 B

View File

@ -109,7 +109,7 @@ public func OnProductEjection(object product)
product->SetPosition(GetX() + 18 * GetCalcDir(), GetY() + 16);
product->SetSpeed(0, -17);
product->SetR(30 - Random(59));
Sound("Pop");
Sound("Structures::EjectionPop");
return;
}

View File

@ -215,7 +215,7 @@ public func EjectWood()
if (!wood) return;
wood->Exit(-25 * GetCalcDir(), -8, 30 - Random(59), -2 * GetCalcDir(), 1);
Sound("Pop");
Sound("Structures::EjectionPop");
// Refresh interaction menus to show the wood count.
UpdateInteractionMenus(this.GetInfoMenuEntries);

View File

@ -2,12 +2,12 @@
id=Shipyard
Version=6,0
Category=C4D_Structure
Width=128
Height=106
Offset=-64,-53
Width=96
Height=72
Offset=-48,-36
Vertices=8
VertexX=0,-64,58,-20,20,-64,59,0
VertexY=53,53,53,53,53,3,3,-17
VertexX=0,-48,-24,24,48,-40,46,0
VertexY=36,36,36,36,36,3,3,-17
VertexFriction=100,100,100,100,100,50,50,50
Mass=4500
Components=Wood=4;Metal=3

View File

@ -78,9 +78,10 @@ public func OnProductionFinish(id product)
return _inherited(...);
}
func Definition(def){
SetProperty("MeshTransformation", Trans_Rotate(8, 0,1,0), def);
SetProperty("PictureTransformation", Trans_Mul(Trans_Translate(0,-25000,50000), Trans_Scale(500)), def);
public func Definition(def)
{
def.MeshTransformation = Trans_Mul(Trans_Scale(800), Trans_Translate(2000, 0, 0), Trans_Rotate(8, 0, 1, 0));
def.PictureTransformation = Trans_Mul(Trans_Translate(0, -25000, 50000), Trans_Scale(600));
}
local ActMap = {

View File

@ -171,7 +171,7 @@ public func OnProductEjection(object product)
product->SetPosition(GetX() - 25 * GetCalcDir(), GetY() + 40);
product->SetSpeed(0, -17);
product->SetR(30 - Random(59));
Sound("Pop");
Sound("Structures::EjectionPop");
return;
}

View File

@ -13,11 +13,12 @@ global func ExplosionEffect(int level, int x, int y, int smoothness, bool silent
if(!silent) //Does object use it's own explosion sound effect?
{
// Select sound according to level: from 1 to 3, add the * to allow alternatives.
var grade = BoundBy(level / 10 - 1, 1, 3);
if(GBackLiquid(x, y))
SoundAt(Format("Fire::BlastLiquid%d",grade), x, y);
SoundAt(Format("Fire::BlastLiquid%d*",grade), x, y);
else
SoundAt(Format("Fire::Blast%d", grade), x, y);
SoundAt(Format("Fire::Blast%d*", grade), x, y);
}
// possibly init particle definitions?

View File

@ -0,0 +1,11 @@
[DefCore]
id=Vine
Version=6,0
Category=C4D_StaticBack
Width=10
Height=56
Offset=-5,-28
Vertices=3
VertexX=0,0,0
VertexY=-27,0,27
Mass=4

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -0,0 +1,146 @@
/**
Vine
A single vine which can hang down from ceilings.
@author Maikel, Randrian
*/
local segments;
protected func Initialize()
{
// Create vine segments to climb on.
CreateSegments();
return;
}
protected func Damage()
{
return;
}
/*-- Ladder Control --*/
// Creates the segments which control the climbing.
private func CreateSegments()
{
segments = [];
var nr_segments = (GetBottom() - GetTop()) / 8;
for (var index = 0; index < nr_segments; index++)
{
var y = GetTop() + index * 8;
var segment = CreateObject(VineSegment, 0, y + 4);
segment->SetMaster(this, index);
// Store the segments.
PushBack(segments, segment);
// Set next and previous segment for climbing control.
if (index > 0)
{
segments[index - 1]->SetPreviousLadder(segment);
segment->SetNextLadder(segments[index - 1]);
}
}
return;
}
// Callback by the ladder climb library when the vine is grabbed.
public func OnLadderGrab(object clonk, object segment, int segment_index)
{
segment->Sound("Environment::Vine::Grab?");
return;
}
// Callback by the ladder climb library when the vine is climbed.
public func OnLadderClimb(object clonk, object segment, int segment_index)
{
if (clonk->GetComDir() == COMD_Up || clonk->GetComDir() == COMD_Down)
if (!Random(20))
segment->Sound("Environment::Vine::Grab?", {volume = 35});
return;
}
// Callback by the ladder climb library when the vine is released.
public func OnLadderReleased(object clonk, object segment, int segment_index)
{
segment->Sound("Environment::Vine::Grab?", {volume = 50});
return;
}
/*-- Placement --*/
// Place an amount of branches in the specified area. Settings:
// min_dist: the minimal distance between vines (default 32 pixels).
public func Place(int amount, proplist area, proplist settings)
{
// Only allow definition call.
if (this != Vine)
return;
// Default parameters.
if (!settings)
settings = {};
if (!settings.min_dist)
settings.min_dist = 32;
var loc_area = nil;
if (area)
loc_area = Loc_InArea(area);
var vines = [];
var max_tries = Max(200, amount * 20);
var nr_created = 0;
for (var i = 0; i < max_tries && nr_created < amount; i++)
{
var loc = FindLocation(Loc_Sky(), Loc_Not(Loc_Liquid()), Loc_Wall(CNAT_Top, Loc_Or(Loc_Material("Granite"), Loc_Material("Rock"), Loc_MaterialVal("Soil", "Material", nil, 1))), loc_area);
if (!loc)
continue;
var vine = CreateObject(Vine);
vine->SetPosition(loc.x, loc.y);
if (!Random(3))
vine.Plane = 510;
// Adjust position with respect to landscape.
vine->AdjustPosition();
// Retry if the center is at a solid location or if another vine is too close.
if (vine->GBackSolid() || vine->FindObject(Find_ID(Vine), Find_Distance(settings.min_dist + Random(8)), Find_Exclude(vine)))
{
vine->RemoveObject();
continue;
}
PushBack(vines, vine);
nr_created++;
}
return vines;
}
// Adjust position with respect to material.
public func AdjustPosition()
{
// Find distance to material.
var d = 0;
while (!GBackSolid(0, d) && d < 36 * GetCon() / 100)
d++;
// Adjust position.
var size = 12 * GetCon() / 100;
SetPosition(GetX(), GetY() + d - size);
return;
}
/*-- Saving --*/
// Save placed ladder segments in scenarios.
public func SaveScenarioObject(props)
{
if (!inherited(props, ...))
return false;
props->AddCall("CreateSegments", this, "CreateSegments");
return true;
}
/*-- Properties --*/
local Name = "$Name$";
local BlastIncinerate = 1;
local ContactIncinerate = 3;
local Placement = 4;

View File

@ -0,0 +1 @@
Name=Kletterpflanze

View File

@ -0,0 +1 @@
Name=Vine

View File

@ -0,0 +1,7 @@
[DefCore]
id=VineSegment
Version=6,0
Category=C4D_StaticBack
Width=5
Height=8
Offset=-3,-4

View File

@ -0,0 +1,80 @@
/**
Vine Segment
@author Maikel
*/
#include Library_Ladder
local index;
// Called from the ladder object to set a master and the segment index.
public func SetMaster(object new_master, int new_index)
{
// First perform setting the master in the library function.
_inherited(new_master, new_index, ...);
// Then set index and attach to master object.
index = new_index;
AddVertex(0, new_master->GetY() - GetY() + new_master->GetTop());
SetAction("Attach", master);
return;
}
// Returns whether the ladder can be climbed.
public func CanNotBeClimbed(bool is_climbing)
{
var test_height = 10;
if (is_climbing)
test_height = 8;
if (GBackSolid(1, test_height) && GBackSolid(-1, test_height))
return true;
return false;
}
// Returns the segment (start x, start y, end x, end y, angle) on which the clonk can climb.
// The coordinate value must be specified with a precision of a 1000.
public func GetLadderData()
{
return [
GetX(1000),
GetY(1000) + 4000,
GetX(1000),
GetY(1000) - 4000,
0
];
}
public func OnLadderGrab(object clonk)
{
if (master)
master->OnLadderGrab(clonk, this, index);
return;
}
public func OnLadderClimb(object clonk)
{
if (master)
master->OnLadderClimb(clonk, this, index);
return;
}
public func OnLadderReleased(object clonk)
{
if (master)
master->OnLadderReleased(clonk, this, index);
return;
}
// Main vine object is saved.
public func SaveScenarioObject() { return false; }
/*-- Properties --*/
local ActMap = {
Attach = {
Prototype = Action,
Name = "Attach",
Procedure = DFA_ATTACH,
},
};

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -5,7 +5,7 @@ Author Work(s)
===============================================================================
ala - Fire/Spark1&2&3, Objects/Weapons/Musket/Click1&2&3, Clonk/Action/Munch2, Clonk/Movement/DivingLoop1&2&3, Animals/Wipf/Snuff3
Structures/DoorOpen*, Structures/DoorClose*, Hits/BucketHit*, Objects/Lorry/Dump*
Structures/DoorOpen*, Structures/DoorClose*, Hits/BucketHit*, Objects/Lorry/Dump*, UI/UnCash1&2&3, Environment/Vine/Grab1&2
Structures/Repair, Structures/FinishBuilding made from following resources:
- JoelAudio: https://www.freesound.org/people/JoelAudio/sounds/135860/ - CC-By 3.0
- cmusounddesign: https://www.freesound.org/people/cmusounddesign/sounds/84696 - CC-By 3.0
@ -19,7 +19,7 @@ ala - Fire/Spark1&2&3, Objects/Weapons/Musket/Click1&2&3, Clonk/Acti
Chirp, Flutter1&2&3, Noise1&2&3
Animals/Mooq:
Die1-5, DieFat, Hurt1-2, Munch1-4, Snort1-3, Snorting1-2, Spit1-2
K-Pone - Objects/Pickaxe/ClangHard1
K-Pone - Objects/Pickaxe/ClangHard1 Fire/Blast3alt Fire/BlastLiquid3alt
Ringwaul - Monster/Growl1-3, Monster/Die, Wipf/Snuff1-2, Wipf/Aroof, Wipf/Whine, Chest/Open, Chest/Close
Winbag/Charge, Winbag/ChargeStop, Winbag/Gust, Pickaxe/Clang1-3
@ -61,7 +61,7 @@ luffy - SmokeSizzle (https://www.freesound.org/people/luffy/sounds/172
Pullover - PropellerLoop (from Milch (EngineLoop))
daveincamas - StoneDoor/Chain (http://www.freesound.org/people/daveincamas/sounds/44076/)
pempi - Elevator/Start, Elevator/Moving, Elevator/Stop (http://www.freesound.org/people/pempi/sounds/33873/)
Traveler - Pop (http://www.freesound.org/people/Traveler/sounds/16064/)
Traveler - Structures/EjectionPop (http://www.freesound.org/people/Traveler/sounds/16064/)
Pat - Clonk/Roll, Clonk/Rustle1-4, Clonk/RustleLand, (http://www.freesound.org/people/pwausc1/sounds/118259/)
Stephen Hall - Clonk/Dig1-5 (http://www.freesound.org/people/shall555/sounds/72199/)
sarge4267 - BlastFireworks (http://www.freesound.org/people/soundscalpel.com/sounds/110391)

View File

@ -3656,7 +3656,7 @@ void C4Landscape::SetGravity(C4Real g)
BYTE C4Landscape::_GetPix(int32_t x, int32_t y) const
{
#ifdef _DEBUG
if (x < 0 || y < 0 || x >= Width || y >= Height) { BREAKPOINT_HERE; }
if (x < 0 || y < 0 || x >= p->Width || y >= p->Height) { BREAKPOINT_HERE; }
#endif
return p->Surface8->_GetPix(x, y);
}
@ -3719,7 +3719,7 @@ int32_t C4Landscape::GetPlacement(int32_t x, int32_t y) const // get landscape m
BYTE C4Landscape::_GetBackPix(int32_t x, int32_t y) const // get landscape pixel (bounds not checked)
{
#ifdef _DEBUG
if (x < 0 || y < 0 || x >= Width || y >= Height) { BREAKPOINT_HERE; }
if (x < 0 || y < 0 || x >= p->Width || y >= p->Height) { BREAKPOINT_HERE; }
#endif
return p->Surface8Bkg->_GetPix(x, y);
}

View File

@ -757,8 +757,8 @@ bool C4MapScriptHost::InitializeMap(C4SLandscape *pLandscape, C4TextureMap *pTex
if (result)
{
map->ConvertSkyToTransparent();
std::tie(*pmap_fg_surface, *pmap_bg_surface) = map->ReleaseSurfaces();
}
std::tie(*pmap_fg_surface, *pmap_bg_surface) = map->ReleaseSurfaces();
return !!result;
}

View File

@ -95,10 +95,15 @@ typedef ptrdiff_t ssize_t;
#define GNUC_FORMAT_ATTRIBUTE_O __attribute__ ((format (printf, 2, 3)))
#define ALWAYS_INLINE inline __attribute__ ((always_inline))
#define NORETURN __attribute__ ((noreturn))
#else
#elif defined(_MSC_VER)
#define GNUC_FORMAT_ATTRIBUTE
#define GNUC_FORMAT_ATTRIBUTE_O
#define ALWAYS_INLINE __forceinline
#define NORETURN __declspec(noreturn)
#else
#define GNUC_FORMAT_ATTRIBUTE
#define GNUC_FORMAT_ATTRIBUTE_O
#define ALWAYS_INLINE inline
#define NORETURN
#endif

View File

@ -108,7 +108,6 @@ enum C4AulTokenType
ATT_BLCLOSE,// "}"
ATT_CALL, // "->"
ATT_CALLFS, // "->~"
ATT_STAR, // "*"
ATT_LDOTS, // '...'
ATT_SET, // '='
ATT_OPERATOR,// operator
@ -184,7 +183,7 @@ private:
void Shift();
void Match(C4AulTokenType TokenType, const char * Expected = NULL);
void Check(C4AulTokenType TokenType, const char * Expected = NULL);
void UnexpectedToken(const char * Expected) NORETURN;
NORETURN void UnexpectedToken(const char * Expected);
static const char * GetTokenName(C4AulTokenType TokenType);
void Warn(const char *pMsg, ...) GNUC_FORMAT_ATTRIBUTE_O;

View File

@ -54,6 +54,8 @@ C4Value AulTest::RunCode(const char *code, bool wrap)
src += test_info->test_case_name();
src += "::";
src += test_info->name();
src += "::";
src += std::to_string(test_info->result()->total_part_count());
src += ">";
GameScript.LoadData(src.c_str(), wrapped.c_str(), NULL);

View File

@ -62,8 +62,6 @@ for the above references.
bccType==AB_DUP ||
bccType==AB_STACK_SET ||
bccType==AB_POP_TO ||
bccType==AB_PARN_CONTEXT ||
bccType==AB_VARN_CONTEXT ||
bccType==AB_GLOBALN ||
bccType==AB_GLOBALN_SET ||
bccType==AB_NEW_ARRAY ||
@ -179,7 +177,7 @@ for the above references.
</Type>
<Type Name="C4AulScriptFunc">
<DisplayString>{*Owner,view(name)}::{Name,sb}</DisplayString>
<DisplayString>{*Parent,view(name)}::{Name,sb}</DisplayString>
<Expand>
<Synthetic Name="[parameters]">
<!--<DisplayString>{ParType,[ParCount]}</DisplayString>-->
@ -239,4 +237,27 @@ for the above references.
<Type Name="C4Material">
<DisplayString>{Name,sb}</DisplayString>
</Type>
<Type Name="C4ValueMapNames">
<Expand>
<ArrayItems>
<Size>iSize</Size>
<ValuePointer>pNames</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="C4ValueMapData">
<Expand>
<CustomListItems>
<Variable Name="i" InitialValue="0"/>
<Size>pNames-&gt;iSize</Size>
<Loop>
<Item Name="{pNames-&gt;pNames[i],sb}">pData[i]</Item>
<Exec>++i</Exec>
<Break Condition="i == pNames-&gt;iSize"/>
</Loop>
</CustomListItems>
</Expand>
</Type>
</AutoVisualizer>