Cleaned scripts from artefacts and wrong indentation

floating-point
Julius Michaelis 2010-09-13 17:27:48 +02:00
parent 425a7739c8
commit b2018f76d1
104 changed files with 540 additions and 540 deletions

View File

@ -55,7 +55,7 @@ global func CreateChestContents(id obj_id)
if (obj_id == Musket)
obj->CreateContents(LeadShot);
obj->Enter(this);
return;
return;
}
// GameCall from MicroMelee_Relaunch

View File

@ -47,7 +47,7 @@ global func CreateChestContents(id obj_id)
if (obj_id == Musket)
obj->CreateContents(LeadShot);
obj->Enter(this);
return;
return;
}
// The weapons available to the players. Needed by MicroMelee_Relaunch

View File

@ -1,4 +1,4 @@
/*--
/*--
Pyramid
Author: Maikel
@ -19,7 +19,7 @@ protected func Initialize()
CreateObject(Chest, 200, 760, NO_OWNER);
CreateObject(Chest, 970, 760, NO_OWNER);
CreateObject(Chest, 860, 560, NO_OWNER);
CreateObject(Chest, 670, 610, NO_OWNER);
CreateObject(Chest, 670, 610, NO_OWNER);
AddEffect("IntFillChests", nil, 100, 70, this);
// Brick edges.
@ -65,7 +65,7 @@ protected func JoinPlayer(int plr)
{
var clonk = GetCrew(plr);
clonk->DoEnergy(100000);
var x = Random(LandscapeWidth()), y = 590;
var x = Random(LandscapeWidth()), y = 590;
clonk->SetPosition(x, y);
return;
}
@ -101,5 +101,5 @@ global func CreateChestContents(id obj_id)
if (obj_id == Musket)
obj->CreateContents(LeadShot);
obj->Enter(this);
return;
return;
}

View File

@ -35,7 +35,7 @@ public func FxIntFadeOutStart(object target, int num) {
public func FxIntFadeOutTimer(object target, int num, int time) {
if(time < fade_time * 2/3) return;
//Log("%d,%d,%08x,%08x => %08x", fade_time, time, EffectVar(4, target, num), EffectVar(3, target, num), ((fade_time - time) * EffectVar(4, target, num) / (fade_time/3)));
if(!(target->Contained())
if(!(target->Contained())
&& EffectVar(0, target, num) == target->GetX()
&& EffectVar(1, target, num) == target->GetY()
) {

View File

@ -11,11 +11,11 @@ protected func Initialize()
CreateObject(Chest, 570, 220, NO_OWNER);
CreateObject(Chest, 70, 80, NO_OWNER);
CreateObject(Chest, 340, 200, NO_OWNER);
CreateObject(Rule_ObjectFade);
CreateObject(Rule_ObjectFade);
CreateObject(Rule_ObjectFade);
CreateObject(Rule_ObjectFade);
CreateObject(Rule_ObjectFade);
CreateObject(Rule_ObjectFade);
CreateObject(Rule_ObjectFade);
CreateObject(Rule_ObjectFade);
CreateObject(Rule_ObjectFade);
CreateObject(Rule_ObjectFade);
AddEffect("IntFillChests", nil, 200, 70, this);
Edges();
@ -79,7 +79,7 @@ global func CreateChestContents(id obj_id)
if (obj_id == Musket)
obj->CreateContents(LeadShot);
obj->Enter(this);
return;
return;
}
// GameCall from MicroMelee_Relaunch

View File

@ -29,7 +29,7 @@ protected func Activity()
if (Random(2)) return;
// Reproduction
if (!Random(ReproductionRate()))
if (!Random(ReproductionRate()))
Reproduction();
// Jump
@ -76,7 +76,7 @@ public func TurnLeft()
if (Stuck() || (GetAction() != "Walk" && GetAction() != "Swim")) return;
if (GetXDir() > 0) SetXDir(0);
SetDir(DIR_Left);
SetComDir(COMD_Left);
SetComDir(COMD_Left);
return 1;
}
@ -96,7 +96,7 @@ protected func CatchBlow()
return 1;
}
protected func Death()
protected func Death()
{
Sound("WolfDead"); // TODO Get Sound
SetDir(0);

View File

@ -224,7 +224,7 @@ protected func Death(int killed_by)
GameCallEx("OnClonkDeath", this, killed_by);
// The broadcast could have revived the clonk.
if (GetAlive())
if (GetAlive())
return;
Sound("Die");
@ -237,7 +237,7 @@ protected func Death(int killed_by)
protected func Destruction()
{
// If the clonk wasn't dead yet, he will be now.
// If the clonk wasn't dead yet, he will be now.
if (GetAlive())
GameCallEx("OnClonkDeath", this, GetKiller());
// If this is the last crewmember, do broadcast.
@ -312,7 +312,7 @@ func AttachHandItem(bool secondary)
{
if(!iHandMesh) iHandMesh = [0,0];
DetachHandItem(secondary);
UpdateAttach();
UpdateAttach();
}
func UpdateAttach()
@ -988,7 +988,7 @@ func FxIntWalkTimer(pTarget, iNumber, iTime)
// Play animations
AnimationSetState("StandTurn", EffectVar(18, pTarget, iNumber)*100, nil);
AnimationSetState("RunTurn", EffectVar(18, pTarget, iNumber)*100, nil);
//
//
if( ( EffectVar(17, pTarget, iNumber) == COMD_Left && GetDir() )
|| ( EffectVar(17, pTarget, iNumber) == COMD_Right && !GetDir() ) )
{
@ -1281,7 +1281,7 @@ func FxIntHangleStart(pTarget, iNumber, fTmp)
// EffectVars:
// 0: whether the clonk is currently moving or not (<=> current animation is Hangle or HangleStand)
// 1: Current animation number
// 6: Player requested the clonk to stop
// 6: Player requested the clonk to stop
// 7: Whether the HangleStand animation is shown front-facing or back-facing
// 10: Previous Hangle physical
@ -1636,7 +1636,7 @@ func FxIntThrowTimer(target, number, time)
if(time == iThrowTime*8/15)
DoThrow(EffectVar(0, target, number), EffectVar(1, target, number));
if(time >= iThrowTime)
return -1;
return -1;
}
func FxIntThrowStop(target, number, reason, tmp)

View File

@ -12,7 +12,7 @@ global func Bubble(int iamount, int x, int y)
{
CreateObject(Bubble1, x, y);
++i;
}
}
}
protected func Initialize()

View File

@ -4,14 +4,14 @@ static const g_CrosshairID = Trajectory;
protected func Initialize()
{
SetProperty("Visibility",VIS_Owner);
SetProperty("Visibility",VIS_Owner);
}
global func RemoveTrajectory(object pObj)
{
// Find and remove
var pTrajectory = FindObject(Find_ID(Trajectory), Find_ActionTarget(pObj));
if(pTrajectory) pTrajectory->RemoveObject();
// Find and remove
var pTrajectory = FindObject(Find_ID(Trajectory), Find_ActionTarget(pObj));
if(pTrajectory) pTrajectory->RemoveObject();
}
//pObj = Object which has the trajectory. pObj must be owned by a player for the player to see the trajectory.
@ -22,41 +22,41 @@ global func RemoveTrajectory(object pObj)
//int spacing = distance of pixels between each trajectory particle
global func AddTrajectory(object pObj, int iX, int iY, int iXDir, int iYDir, int iColor, int spacing)
{
// Delete old trajectory
RemoveTrajectory(pObj);
// Create new helper object
var pTrajectory = CreateObject(Trajectory, pObj->GetX() - GetX(), pObj->GetY() - GetY(), pObj->GetOwner());
pTrajectory->SetAction("Attach", pObj);
// Set starting values
var i = -1, iXOld, iYOld;
var iFaktor = 100;
iX *= iFaktor; iY *= iFaktor;
iYDir *= 5; iXDir *= 5;
iY -= 4*iFaktor;
iXOld = iX; iYOld = iY;
// Trajectory simulation
while(++i < 500)
{
// Speed and gravity offset
iX += iXDir;
iY += iYDir + GetGravity() * i / 20;
// If we are far enough away insert a new point
// Delete old trajectory
RemoveTrajectory(pObj);
// Create new helper object
var pTrajectory = CreateObject(Trajectory, pObj->GetX() - GetX(), pObj->GetY() - GetY(), pObj->GetOwner());
pTrajectory->SetAction("Attach", pObj);
// Set starting values
var i = -1, iXOld, iYOld;
var iFaktor = 100;
iX *= iFaktor; iY *= iFaktor;
iYDir *= 5; iXDir *= 5;
iY -= 4*iFaktor;
iXOld = iX; iYOld = iY;
// Trajectory simulation
while(++i < 500)
{
// Speed and gravity offset
iX += iXDir;
iY += iYDir + GetGravity() * i / 20;
// If we are far enough away insert a new point
if(!spacing) spacing = 10;
if(Distance((iXOld - iX) / iFaktor, (iYOld - iY) / iFaktor) >= spacing)
{
CreateParticle("Trajectory", iX/iFaktor - pTrajectory->GetX(), iY/iFaktor - pTrajectory->GetY(), iXDir/500, iYDir/500, 15, iColor, pTrajectory);
iXOld = iX; iYOld = iY;
}
// Or is it here already?
if(GBackSolid(iX / iFaktor - GetX(), iY / iFaktor - GetY())) break;
}
// So, ready
return pTrajectory;
if(Distance((iXOld - iX) / iFaktor, (iYOld - iY) / iFaktor) >= spacing)
{
CreateParticle("Trajectory", iX/iFaktor - pTrajectory->GetX(), iY/iFaktor - pTrajectory->GetY(), iXDir/500, iYDir/500, 15, iColor, pTrajectory);
iXOld = iX; iYOld = iY;
}
// Or is it here already?
if(GBackSolid(iX / iFaktor - GetX(), iY / iFaktor - GetY())) break;
}
// So, ready
return pTrajectory;
}
public func AttachTargetLost()
{
RemoveObject();
RemoveObject();
}
local ActMap = {

View File

@ -23,7 +23,7 @@ protected func Initialize()
SetPhase(RandomX(1,16));
//Push low flying clouds up to proper height
while(MaterialDepthCheck(GetX(),GetY(),"Sky",150)!=true)
while(MaterialDepthCheck(GetX(),GetY(),"Sky",150)!=true)
{
SetPosition(GetX(),GetY()-1);
}
@ -53,7 +53,7 @@ public func Precipitation()
}
//acid precipitation
if(iWaitTime == 0 && szMat == "Acid")
if(iWaitTime == 0 && szMat == "Acid")
{
RainDrop();
iAcidity = --iAcidity;
@ -84,7 +84,7 @@ protected func Evaporation() //Creates a search line every x-amount(currently fi
var iSearchX = GetX();
var iPrecision = 5;
if(iSize >= 700 || iAcidity >= 100)
if(iSize >= 700 || iAcidity >= 100)
{
iCondensing = 0;
iSearchY = 0;
@ -92,7 +92,7 @@ protected func Evaporation() //Creates a search line every x-amount(currently fi
}
//line below prevents clouds evaporating through solids
if(GetMaterial(0, iSearchY) != Material("Water") && GetMaterial(0, iSearchY) != Material("Acid") && GetMaterial(0, iSearchY) != Material("Sky")) return(iSearchY=0);
if(GetMaterial(0, iSearchY) == Material("Water"))
if(GetMaterial(0, iSearchY) == Material("Water"))
{
ExtractMaterialAmount(0, iSearchY,Material("Water"), 3);
iSize = iSize+3;
@ -129,7 +129,7 @@ public func RainDrop()
}
//For use as scenario setting. Can work after initialize, if you really want to.
global func AdjustLightningFrequency(int iFreq)
global func AdjustLightningFrequency(int iFreq)
{
for(var Cloud in FindObjects(Find_ID(Cloud)))
Cloud->SetLightningFrequency(iFreq);

View File

@ -1,11 +1,11 @@
/*--
/*--
Earthquake
Author: Maikel
This is the earthquake control object, earthquakes are realized through a global effect.
Earthquakes can be activated in Scenario.txt under [Environment], Earthquake=x will result
in a 10*x % earthquake level. You can also just create the control object and modify the
chance with Get/Set/DoChance. The third option is to directly launch an earthquake with
in a 10*x % earthquake level. You can also just create the control object and modify the
chance with Get/Set/DoChance. The third option is to directly launch an earthquake with
LaunchEarthquake(int x, int y, int strength) at the global coordinates (x,y).
--*/
@ -35,14 +35,14 @@ public func GetChance()
return EffectVar(0, this, effect);
}
public func SetChance(int chance)
public func SetChance(int chance)
{
var effect = GetEffect("IntEarthquakeControl", this);
EffectVar(0, this, effect) = BoundBy(chance, 0, 100);
return;
}
public func DoChance(int chance)
public func DoChance(int chance)
{
SetChance(GetChance() + chance);
return;
@ -57,14 +57,14 @@ protected func FxIntEarthquakeControlTimer(object target, int fxnum, int time)
return FX_OK;
}
// Launches an earthquake with epicenter (x,y).
// Launches an earthquake with epicenter (x,y).
global func LaunchEarthquake(int x, int y, int strength)
{
{
// Earthquake should start in solid.
if (!GBackSemiSolid(x, y))
return false;
// Minimum strength is 15, maximum strength is 100.
strength = BoundBy(strength, 15, 100);
strength = BoundBy(strength, 15, 100);
// The earthquake is handled by a global effect.
var effect = AddEffect("IntEarthquake", 0, 100, 1, nil, Earthquake);
EffectVar(0, 0, effect) = x; // Epicentre x coordinate.
@ -111,10 +111,10 @@ protected func FxIntEarthquakeTimer(object target, int fxnum, int time)
ShakeObjects(x, y, 4 * str);
// Move the quake around a little.
var dx, dy, cnt = 0;
do
do
{ // Try ten times to find a nearby in material location.
dx = Random(str * 4 + 1) - str * 2;
dy = Random(str * 4 + 1) - str * 2;
dy = Random(str * 4 + 1) - str * 2;
cnt++;
} while (!GBackSemiSolid(x + dx, y + dy) && cnt < 10)
// No continuation.
@ -123,7 +123,7 @@ protected func FxIntEarthquakeTimer(object target, int fxnum, int time)
// Set new position.
EffectVar(0, 0, fxnum) += dx;
EffectVar(1, 0, fxnum) += dy;
// Done.
// Done.
return FX_OK;
}

View File

@ -1,14 +1,14 @@
/*--
Ecke
/*--
Ecke
Originally from Sven2
Modified by Mimmo
Modified by Mimmo
--*/
local dir;
protected func Initialize() {
Snap();
AutoP();
return true;
Snap();
AutoP();
return true;
}
func PermaEdge()
@ -33,18 +33,18 @@ protected func AutoP()
if(dir[0] && dir[3]) SetP(1);
if(dir[2] && dir[3]) SetP(0);
}
public func Snap(int o,int p)
{
SetPosition((GetX()+5)/10*10-5+o, (GetY()+5)/10*10-5+p);
}
{
SetPosition((GetX()+5)/10*10-5+o, (GetY()+5)/10*10-5+p);
}
public func SetP(int p)
{
SetObjDrawTransform(1000-((p%2)*2000),0,0,0,1000-((p/2)*2000));
SetAction("Edge"); SetPhase(p);
SetSolidMask(p*10,0,10,10);
dir=p;
}
{
SetObjDrawTransform(1000-((p%2)*2000),0,0,0,1000-((p/2)*2000));
SetAction("Edge"); SetPhase(p);
SetSolidMask(p*10,0,10,10);
dir=p;
}

View File

@ -15,9 +15,9 @@ protected func Initialize()
public func Phase(bool noAdvance)
{
if(noAdvance!=true)
{
if(phase<=5) phase=phase+1;
if(phase>=6) phase=1;
{
if(phase<=5) phase=phase+1;
if(phase>=6) phase=1;
}
if(phase==1) SetGraphics();

View File

@ -1,9 +1,9 @@
/*--
/*--
Time Controller
Author:Ringwall
Creates time based on the 24-hour time scheme.
Time is computed in minutes, which are by default
Time is computed in minutes, which are by default
1/2 a second in real life (18 frames). This will
make each complete day/night cycle last 12 minutes
in real life.
@ -24,14 +24,14 @@ global func SetTime(int iTime) //Sets the current time using a 1440-minute clock
AddEffect("IntSunset",0,1,1);
}
if(IsDay()==false && IsDay(iTime)==true)
if(IsDay()==false && IsDay(iTime)==true)
{
AddEffect("IntSunrise",0,1,1);
}
timeobject["itime"]=iTime;
if(timeobject!=nil) return 1;
else
else
return 0;
}
@ -150,7 +150,7 @@ global func UpdateTime(bool advance)
SetSkyAdjust(RGB(skyshade,skyshade,skyshade));
//time advancement
if(advance != true)
if(advance != true)
return 1;
if(GetTime()>=1439) SetTime(0);
if(GetTime()<1439) SetTime(GetTime()+1);

View File

@ -14,7 +14,7 @@ local timer;
func Initialize() {
ScheduleCall(this, "PostInitialize", 1, 0);
ScheduleCall(this, "PostInitialize", 1, 0);
timer=0;
return(1);
}
@ -120,8 +120,8 @@ func AdjustStarColor()
{
var percent=(king->GetEnergy() * 100) / (king->GetPhysical("Energy") / 1000);
var red=255; if(percent > 50) red=(255*(100-2*(percent-50))) / 100;
var green=255; if(percent < 50) green=(255*(2*percent)) / 100;
color=RGB(red/2, green/2, 0);
var green=255; if(percent < 50) green=(255*(2*percent)) / 100;
color=RGB(red/2, green/2, 0);
}
else
{

View File

@ -162,9 +162,9 @@ private func CheckForWinner()
if (check_plr == plr)
continue;
if (GetPlayerTeam(check_plr) != 0 && GetPlayerTeam(check_plr) == GetPlayerTeam(plr))
continue;
continue;
EliminatePlayer(check_plr);
}
}
break;
}
}
@ -180,7 +180,7 @@ public func Activate(int byplr)
for(var i=0;i<GetLength(teams);++i)
{
lines[GetLength(lines)]=Format("%s: %d", teams[i]["player_names"], teams[i]["points"] );
}
}
var msg=Format("$MsgGoalDesc$", Goal_KingOfTheHill->GetPointLimit());
for(var i=0;i<GetLength(lines);++i)
@ -242,7 +242,7 @@ func RefreshScoreboard()
var points=GetTeamPoints();
for(var cnt=0;cnt<GetPlayerCount();cnt++)
{
var plr=GetPlayerByIndex(cnt);

View File

@ -53,7 +53,7 @@ func FxIntTimeLimitTimer(target, num, fxtime)
{
var clonk = Contents();
if (fxtime >= time)
{
{
RelaunchClonk();
return -1;
}
@ -66,7 +66,7 @@ func FxIntTimeLimitTimer(target, num, fxtime)
public func Selected(object menu, object selector)
{
if (!selector)
if (!selector)
return false;
for (var i = 0; i < selector->GetAmount(); i++)
@ -88,7 +88,7 @@ private func RelaunchClonk()
var clonk = Contents();
clonk->Exit();
GameCall("OnClonkLeftRelaunch", clonk);
if (menu)
if (menu)
menu->Close();
PlayerMessage(clonk->GetOwner(), "");
RemoveObject();

View File

@ -38,7 +38,7 @@ private func RelaunchCount()
{
var relaunch_cnt = GameCall("RelaunchCount");
if (relaunch_cnt != nil)
return relaunch_cnt;
return relaunch_cnt;
return MIME_RelaunchCount;
}
@ -46,7 +46,7 @@ private func KillsToRelaunch()
{
var kills_to_relaunch = GameCall("KillsToRelaunch");
if (kills_to_relaunch != nil)
return kills_to_relaunch;
return kills_to_relaunch;
return MIME_KillsToRelaunch;
}
@ -88,7 +88,7 @@ protected func RelaunchPlayer(int plr, int killer)
// Scenario script callback.
GameCall("OnPlayerRelaunch", plr);
// Show scoreboard for a while.
DoScoreboardShow(1, plr + 1);
DoScoreboardShow(1, plr + 1);
Schedule(Format("DoScoreboardShow(-1, %d)", plr + 1), 35 * MIME_ShowBoardTime);
return; // _inherited(plr, killer, ...);
}

View File

@ -22,9 +22,9 @@ protected func InitializePlayer(int newplr, int x, int y, object base, int team)
private func CheckTeamHostile(int plr1, int plr2)
{
var team1 = GetPlayerTeam(plr1);
if (team1 != GetPlayerTeam(plr2))
if (team1 != GetPlayerTeam(plr2))
return true;
if (team1)
if (team1)
return false;
return Hostile(plr1, plr2);
}
@ -40,7 +40,7 @@ public func IsFulfilled()
// Compare with other players.
for (var j = i + 1; j < GetPlayerCount(); j++)
{
var plr2cmp = GetPlayerByIndex(j);
var plr2cmp = GetPlayerByIndex(j);
// Still enemy players out there?
if (CheckTeamHostile(plr, plr2cmp) ) return false;
}
@ -59,7 +59,7 @@ public func Activate(int byplr)
var plr = GetPlayerByIndex(i);
if (plr == byplr)
continue;
if (Hostile(plr, byplr) )
if (Hostile(plr, byplr) )
hostile_count++;
}

View File

@ -1,7 +1,7 @@
/*-- Parkour arrow --*/
protected func Initialize()
{
{
this["Visibility"] = VIS_Owner;
return;
}
@ -20,6 +20,6 @@ local ActMap = {
Wdt = 40,
Hgt = 20,
NextAction = "Show",
},
},
};
local Name = "$Name$";

View File

@ -1,4 +1,4 @@
/*--
/*--
CheckPoint
Author: Maikel
@ -24,7 +24,7 @@ static const PARKOUR_CP_Check = 8;
static const PARKOUR_CP_Ordered = 16;
static const PARKOUR_CP_Bonus = 32;
public func SetCPMode(int mode)
public func SetCPMode(int mode)
{
if (mode & PARKOUR_CP_Start) // Start always occurs alone.
mode = PARKOUR_CP_Start;
@ -36,7 +36,7 @@ public func SetCPMode(int mode)
// Set CP number.
SetCPNumber(ObjectCount(Find_ID(GetID()), Find_Func("GetCPNumber")) + 1);
}
cp_mode = mode;
cp_mode = mode;
DoGraphics();
return;
}
@ -48,19 +48,19 @@ public func FindCPMode(int mode) { return cp_mode & mode; }
/*-- Checkpoint controller --*/
local cp_con;
public func SetCPController(object con)
{
cp_con = con;
return;
public func SetCPController(object con)
{
cp_con = con;
return;
}
/*-- Checkpoint number --*/
local cp_num;
public func SetCPNumber(int num)
{
cp_num = num;
return;
public func SetCPNumber(int num)
{
cp_num = num;
return;
}
public func GetCPNumber() { return cp_num; }
@ -78,7 +78,7 @@ protected func Initialize()
UpdateGraphics();
AddEffect("IntCheckpoint", this, 100, 1, this);
return;
}
}
/*-- Checkpoint status --*/
@ -103,7 +103,7 @@ public func IsActiveForPlr(int plr)
return false;
return true;
}
if (cp_mode & PARKOUR_CP_Ordered)
if (cp_mode & PARKOUR_CP_Ordered)
{
if (GetCPNumber() == 1) // First ordered checkpoint is always active.
return true;
@ -137,7 +137,7 @@ public func ResetCleared() // reset progress done by players
/*-- Checkpoint activity --*/
protected func FxIntCheckpointTimer(object target, int fxnum, int fxtime)
{
{
if (!(fxtime % 5))
CheckForClonks();
UpdateGraphics(fxtime);
@ -148,7 +148,7 @@ protected func CheckForClonks()
{
// Loop through all clonks inside the checkpoint.
for (var pClonk in FindObjects(Find_OCF(OCF_CrewMember), Find_Distance(20)))
{
{
var plr = pClonk->GetOwner();
var team = GetPlayerTeam(plr);
var plrid = GetPlayerID(plr);
@ -156,7 +156,7 @@ protected func CheckForClonks()
if (!IsActiveForPlr(plr) && !IsActiveForTeam(team))
continue;
// Check respawn status.
if (cp_mode & PARKOUR_CP_Respawn)
if (cp_mode & PARKOUR_CP_Respawn)
if (cp_con)
cp_con->SetPlrRespawnCP(plr, this); // Notify race goal.
// If already done by player -> continue.
@ -178,7 +178,7 @@ protected func CheckForClonks()
}
}
// Check finish status.
if (cp_mode & PARKOUR_CP_Finish)
if (cp_mode & PARKOUR_CP_Finish)
{
Sound("Cleared", false, nil, plr);
aDoneByPlr[plrid] = true;
@ -198,10 +198,10 @@ protected func CheckForClonks()
public func SetBaseGraphics(id gfx, int mod)
{
// Update base graphics in overlay layer 1
SetGraphics("", gfx, 1, GFXOV_MODE_Base);
SetClrModulation(mod , 1);
return true;
// Update base graphics in overlay layer 1
SetGraphics("", gfx, 1, GFXOV_MODE_Base);
SetClrModulation(mod , 1);
return true;
}
// Mode graphics.
@ -255,7 +255,7 @@ protected func GetColorByAngle(int angle)
for (var i = 0; i < GetPlayerCount(); i++)
if (ClearedByPlr(GetPlayerByIndex(i)) || (cp_mode & PARKOUR_CP_Start))
cnt++;
if (!cnt)
if (!cnt)
return RGBa(255, 255, 255, 192);
var prt = 360 / cnt;

View File

@ -1,5 +1,5 @@
/*--
Parkour
/*--
Parkour
Authors: Maikel
The goal is to be the first to reach the finish, the team or player to do so wins the round.
@ -10,7 +10,7 @@
* Ordered: On/Off - The checkpoints mussed be passed in the order specified.
* The start and finish are also checkpoints.
TODO:
TODO:
* Update CP Graphics -> looks satisfactory atm but cpu intensive.
* Add significant message under goal, done.
--*/
@ -190,7 +190,7 @@ public func GetShortDescription(int plr)
if (pos == 1)
msg = "$MsgDescTeamFirst$";
if (pos == 2)
msg = "$MsgDescTeamSecond$";
msg = "$MsgDescTeamSecond$";
if (pos == 3)
msg = "$MsgDescTeamThird$";
if (pos >= 4)
@ -202,19 +202,19 @@ public func GetShortDescription(int plr)
if (pos == 1)
msg = "$MsgDescFirst$";
if (pos == 2)
msg = "$MsgDescSecond$";
msg = "$MsgDescSecond$";
if (pos == 3)
msg = "$MsgDescThird$";
if (pos >= 4)
msg = Format("$MsgDescNth$", pos);
}
msg = Format("$MsgDescNth$", pos);
}
return msg;
}
private func GetPlayerPosition(int plr)
{
var pos = 1;
var plrid = GetPlayerID(plr);
var plrid = GetPlayerID(plr);
for (var i = 0; i < GetPlayerCount(); i++)
if (plr_list[plrid] < plr_list[GetPlayerID(GetPlayerByIndex(i))])
pos++;
@ -375,12 +375,12 @@ protected func FxIntDirNextCPTimer(object target, int fxnum)
{
nextcp = cp;
break;
}
}
if (!nextcp)
return EffectVar(0, target, fxnum)->SetClrModulation(RGBa(0, 0, 0, 0));
// Calculate parameters.
var angle = Angle(target->GetX(), target->GetY(), nextcp->GetX(), nextcp->GetY());
var dist = Min(510 * ObjectDistance(GetCrew(plr), nextcp) / 400, 510);
var dist = Min(510 * ObjectDistance(GetCrew(plr), nextcp) / 400, 510);
var red = BoundBy(dist, 0, 255);
var green = BoundBy(510 - dist, 0, 255);
var color = RGBa(red, green, 0, 128);
@ -449,7 +449,7 @@ private func SetEvalData(int winner)
for (var i = 0; i < GetPlayerCount(); i++)
AddEvalData(GetPlayerByIndex(i));
// Obviously get rid of settlement score.
HideSettlementScoreInEvaluation(true);
HideSettlementScoreInEvaluation(true);
return;
}

View File

@ -1,4 +1,4 @@
/*--
/*--
Script goal
Author: Maikel
@ -16,9 +16,9 @@ protected func Initialize()
return inherited(...);
}
public func IsFulfilled()
{
return fulfilled;
public func IsFulfilled()
{
return fulfilled;
}
public func Fulfill()

View File

@ -153,14 +153,14 @@ public func OnCrewSelection(object clonk, bool deselect)
{
// selected
if(!deselect)
{
{
// fill actionbar
// inventory
var i;
for(i = 0; i < Min(2,clonk->HandObjects()); ++i)
{
ActionButton(clonk,i,clonk->GetItem(i),ACTIONTYPE_INVENTORY);
}
}
ClearButtons(i);
// and start effect to monitor vehicles and structures...
@ -175,7 +175,7 @@ public func OnCrewSelection(object clonk, bool deselect)
}
public func FxIntSearchInteractionObjectsEffect(string newname, object target, int num, int new_num)
{
{
if(newname == "IntSearchInteractionObjects")
return -1;
}

View File

@ -22,7 +22,7 @@ public func Update()
var hudinfo = goal->~GetShortDescription(GetOwner());
if(hudinfo)
CustomMessage(Format("@%s",hudinfo), this, GetOwner(), 0, 90);
else
else
CustomMessage("", this, GetOwner(), 0, 90);
SetGraphics(nil,goal->GetID(),1,GFXOV_MODE_IngamePicture);

View File

@ -101,8 +101,8 @@ public func SetObject(object obj)
RemoveEffect("IntRemoveGuard",myobject);
if(!myobject)
{
if(!myobject)
{
SetGraphics(nil,nil,1);
SetName("$TxtEmpty$");
this["MouseDragImage"] = nil;

View File

@ -137,7 +137,7 @@ public func MouseSelection(int plr)
{
myobject->Interact(crew);
return true;
}
}
}
}
@ -280,8 +280,8 @@ public func SetObject(object obj, int type, int pos, int hot)
myobject = obj;
hotkey = hot;
if(!myobject)
{
if(!myobject)
{
SetGraphics(nil,nil,1);
SetName(Format("$TxtSlot$",pos+1));
this["MouseDragImage"] = nil;
@ -392,7 +392,7 @@ public func UpdateSelectionStatus()
}
else if(actiontype == ACTIONTYPE_VEHICLE)
if(crew->GetProcedure() == "PUSH" && crew->GetActionTarget() == myobject)
sel = 1;
sel = 1;
else if(actiontype == ACTIONTYPE_STRUCTURE)
if(crew->Contained() == myobject)
sel = 1;

View File

@ -5,7 +5,7 @@
0=Grey Circle
1=Icon of the Object
2,3=Extraslot
10,11,12= Amount
10,11,12= Amount
*/
@ -41,8 +41,8 @@ public func SetSymbol(obj)
this["Visibility"] = VIS_Owner;
if(!obj)
{
if(!obj)
{
SetGraphics(nil, nil, 1);
SetGraphics(nil, nil, 2);
SetGraphics(nil, nil, 3);
@ -122,7 +122,7 @@ public func SetAmount(Amount)
if(hun > 0)
{
SetGraphics(Format("%d",hun),Icon_SlimNumber,10,GFXOV_MODE_IngamePicture);
SetObjDrawTransform(s,0,xoffs-spacing*3-500,0,s,yoffs+300, 9);
SetObjDrawTransform(s,0,xoffs-spacing*3-500,0,s,yoffs+300, 9);
SetObjDrawTransform(s,0,xoffs-spacing*2,0,s,yoffs, 10);
}

View File

@ -52,7 +52,7 @@ global func CreateRingMenu(id symbol, object commander)
menu->SetMenu(this,commander);
menu->SetMenuIcon(symbol);
menu->Hide();
return menu;
return menu;
}
@ -65,19 +65,19 @@ public func GetMenuObject()
public func SetMenu(object menuobject, object commandobject)
{
if(menuobject->GetOCF() & OCF_CrewMember)
menu_object=menuobject;
menu_object=menuobject;
command_object=commandobject;
menuobject->~SetMenu(this);
}
}
//re-set icon
func SetMenuIcon(id symbol)
{
this["Visibility"] = VIS_Owner;
if(!symbol)
{
this["Visibility"] = VIS_Owner;
if(!symbol)
{
SetGraphics(nil,nil,0);
SetGraphics(nil,nil,1);
}
@ -90,17 +90,17 @@ func SetMenuIcon(id symbol)
}
//adds an item, icon, amount, extra (the item can be an object too)
public func AddItem(new_item, int amount, extra)
{
public func AddItem(new_item, int amount, extra)
{
var index = GetLength(menu_icons);
menu_icons[index] = CreateObject(GUI_RingMenu_Icon,0,0,menu_object->GetOwner());
menu_icons[index]->SetSymbol(new_item);
menu_icons[index]->SetExtraData(extra);
menu_icons[index]->SetExtraData(extra);
if(amount == nil)
{
menu_icons[index]->SetAmount(1);
}
else
else
{
menu_icons[index]->SetAmount(amount);
}
@ -111,7 +111,7 @@ public func AddItem(new_item, int amount, extra)
//selects by dx,dy and alt=alternative selection
public func Select(int dx, int dy, bool alt)
{
var item_count=GetLength(menu_icons);
var item_count=GetLength(menu_icons);
if(!item_count)
if(command_object->Selected(this,nil,alt))
Close();
@ -134,17 +134,17 @@ public func Select(int dx, int dy, bool alt)
func IsVisible() { return shown; }
//makes me visible/updates me
func Show()
func Show()
{
var item_count = GetLength(menu_icons);
var item_count = GetLength(menu_icons);
if(!item_count) return;
var segment=360/item_count;
var x = GetX();
var y = GetY();
for(var i=0; i<item_count; i++)
{
for(var i=0; i<item_count; i++)
{
if(menu_icons[i])
{
var angle=(i*segment)+(segment/2);
@ -164,11 +164,11 @@ func Show()
}
public func UpdateCursor(int dx, int dy)
{
{
if(shown)
{
var angle = Angle(0,0,dx,dy);
var item_count = GetLength(menu_icons);
var item_count = GetLength(menu_icons);
if(!item_count) return;
var distance = Sqrt(dx*dx+dy*dy);
@ -188,7 +188,7 @@ public func UpdateCursor(int dx, int dy)
if(outside) item = -1;
for(var i=0; i< item_count; i++)
{
{
if(menu_icons[i])
{
// calculate distance to angle
@ -227,7 +227,7 @@ func Close()
if(command_object)
command_object->~MenuClosed(this);
RemoveObject();
RemoveObject();
}
local Name = "$Name$";

View File

@ -124,7 +124,7 @@ public func ControlUseCancel(object clonk, int x, int y)
}
private func LoamDone(object clonk)
{
{
// Get out of animation
if(clonk->GetAction() == "Bridge")
{

View File

@ -7,7 +7,7 @@ private func Hit()
}
public func ControlUse(object pByClonk, int iX, int iY)
{
{
var pTree;
if( pTree = FindObject(Find_AtPoint(iX, iY), Find_Func("IsTree") && Find_Func("IsStanding")) )
{

View File

@ -1,8 +1,8 @@
/*--
/*--
Wooden Barrel
Author: Ringwaul
The barrel is used to transport liquids
The barrel is used to transport liquids
--*/
local szLiquid;
@ -62,7 +62,7 @@ private func FillBarrel(string szMat)
var iCapacity = 300;
if(iVolume >= 1 && szMat != szLiquid) return 0;
while(iVolume != iCapacity && GetMaterial(0,iDrain) == Material(szMat))
while(iVolume != iCapacity && GetMaterial(0,iDrain) == Material(szMat))
{
ExtractLiquid(0,iDrain);
iVolume = ++iVolume;

View File

@ -8,7 +8,7 @@
he is attached, he has more control over it than if it were just in his
inventory: The ControlLeft/Right/Up/Down callbacks are issued to the boom-
pack too. Here, they are used to slightly steer the boompack to the left
or right plus to jump off the rocket.
or right plus to jump off the rocket.
--*/
local fuel;
@ -31,7 +31,7 @@ protected func Destruction()
}
func ControlRight()
{
{
SetRDir(+3);
return true;
}
@ -61,7 +61,7 @@ func ControlUseStart(object clonk, int x, int y)
}
func ControlUse(object clonk, int x, int y)
{
{
// forward control to item
if(clonk->GetProcedure()=="ATTACH") return false;

View File

@ -25,8 +25,8 @@ public func GetConnectedObject(object pObject)
{
if(GetActionTarget(0) == pObject)
return GetActionTarget(1);
if(GetActionTarget(1) == pObject)
return GetActionTarget(0);
if(GetActionTarget(1) == pObject)
return GetActionTarget(0);
return;
}

View File

@ -19,7 +19,7 @@ protected func Activate(object pClonk)
// Is there an object which accepts power lines?
var pObj = FindObject(Find_AtPoint(), Find_Func("CanPowerConnect"));
// No such object -> message.
if(!pObj)
if(!pObj)
return pClonk->Message("$TxtNoNewLine$");
// Is there a power line connected to this wire roll?
var pLine = FindObject(Find_PowerLine());
@ -32,7 +32,7 @@ protected func Activate(object pClonk)
Sound("Connect");
pClonk->Message("$TxtLineRemoval$");
return true;
}
}
else // Connect existing power line to pObj.
{
if(pLine->GetActionTarget(0) == this)

View File

@ -2,7 +2,7 @@
Dynamite
Author: Newton
A volatile tool that can be pressed into walls
A volatile tool that can be pressed into walls
for accurate mining, burning a short fuse before exploding.
*/
@ -99,7 +99,7 @@ protected func Incineration() { Extinguish(); Fuse(); }
protected func RejectEntrance()
{
return GetAction() == "Fuse" || GetAction() == "Ready";
return GetAction() == "Fuse" || GetAction() == "Ready";
}
// Controle of the Dynamite box
@ -118,7 +118,7 @@ public func Reset()
SetAction("Idle");
}
private func Fusing()
private func Fusing()
{
var sin=Sin(180-GetR(),5);
var cos=Cos(180-GetR(),5);

View File

@ -21,7 +21,7 @@ public func SetColorWarning(fOn)
public func Connect(pTarget1, pTarget2)
{
SetAction("Connect", pTarget1, pTarget2);
SetAction("Connect", pTarget1, pTarget2);
}
private func GetLineLength()

View File

@ -48,7 +48,7 @@ public func Ignite(clonk)
pIgniteClonk = clonk;
if (aWires[iIgniteNumber])
aWires[iIgniteNumber]->StartFusing(this);
else
else
for (var obj in FindObjects(Find_Category(C4D_StaticBack), Find_Func("IsFuse"), Find_ActionTargets(this)))
obj->~StartFusing(this);

View File

@ -2,7 +2,7 @@
Grapple Hook
Author: Randrian
The hook can be shot with the grappling bow.
The hook can be shot with the grappling bow.
On impact the hook will stick to the ground
The hook also controls the swinging controls for the clonk
*/

View File

@ -11,16 +11,16 @@ public func GetCarryBone() { return "main"; }
public func GetCarryTransform() { return Trans_Rotate(90,0,1,0); }
public func ControlUse(object clonk, int ix, int iy)
{
{
clonk->Message("Using hammer");
// Stop clonk
clonk->SetComDir(COMD_Stop);
// Is the clonk able to build?
if (clonk && !clonk->GetPhysical("CanConstruct", PHYS_Current) && CheckCanUse(clonk)==true)
{
PlayerMessage(clonk->GetController(), "$TxtCantConstruct$", clonk->GetName());
return 1;
{
PlayerMessage(clonk->GetController(), "$TxtCantConstruct$", clonk->GetName());
return 1;
}
if(clonk->GetAction()=="Build") //Stop building

View File

@ -14,7 +14,7 @@ public func GetCarryPhase() { return 600; }
public func FxJarReloadTimer(object target, int effect, int time)
{
target->Load();
target->Load();
}
protected func Initialize()
@ -29,7 +29,7 @@ protected func ControlUse(object pClonk, iX, iY)
if(!GetEffect("JarReload",this))
{
if(!GBackLiquid())
{
{
FireWeapon(pClonk, iX, iY);
Amount=0;
AddEffect("JarReload",this,100,1,this);
@ -42,7 +42,7 @@ protected func ControlUse(object pClonk, iX, iY)
{
pClonk->Message("Reloading!");
return true;
}
}
ChargeSoundStop();
}
@ -103,7 +103,7 @@ private func FireWeapon(object pClonk,iX,iY)
Sin(180 - Angle(0,0,iX,iY) + (R),(Amount / 2) + 25),
Cos(180 - Angle(0,0,iX,iY) + (R),(Amount / 2) + 25),
Max(i + 30, 90),
);
);
}
}
@ -115,7 +115,7 @@ private func FireWeapon(object pClonk,iX,iY)
var x = pClonk->GetXDir();
var y = pClonk->GetYDir();
pClonk->SetXDir((x) - (sinspeed / 3));
pClonk->SetYDir((y) - (cosspeed / 3));
pClonk->SetYDir((y) - (cosspeed / 3));
}
for( var obj in FindObjects(
@ -126,7 +126,7 @@ private func FireWeapon(object pClonk,iX,iY)
),
Find_Not(Find_Category(C4D_Structure))
)
)
)
{
if(obj != pClonk && PathFree(pClonk->GetX(),pClonk->GetY(),obj->GetX(),obj->GetY()))
{

View File

@ -29,13 +29,13 @@ public func ControlUseHolding(object pClonk, ix, iy)
if(target!=nil && pClonk->GetProcedure()== "WALK")
{
{
//Magical particle effect
if(Distance(GetX(),GetY(),GetX()+ix,GetY()+iy)<150)
{
var partx=-(Sin(180-Angle(0,0,ix,iy), 100)/10);
var party=-(Cos(180-Angle(0,0,ix,iy), 100)/10);
if(Random(3)==1)CreateParticle("Magic",ix,iy,partx,party,magic/10+50,RGB(0,220,250));
{
var partx=-(Sin(180-Angle(0,0,ix,iy), 100)/10);
var party=-(Cos(180-Angle(0,0,ix,iy), 100)/10);
if(Random(3)==1) CreateParticle("Magic",ix,iy,partx,party,magic/10+50,RGB(0,220,250));
}
//Don't mess around with underground objects. This stops you from triggering flints underground by pulling on them.

View File

@ -1,4 +1,4 @@
/*--
/*--
Powder Keg
Author: Ringwaul

View File

@ -1,4 +1,4 @@
/*--
/*--
Javelin
Author: Ringwaul
@ -147,13 +147,13 @@ public func OnStrike(object obj)
}
protected func Hit()
{
{
if(GetEffect("Flight",this))
{
Stick();
Sound("JavelinHitGround.ogg");
}
else
else
Sound("WoodHit");
}

View File

@ -28,7 +28,7 @@ public func Launch(object shooter, int angle, int dist, int speed)
SetController(shooter->GetController());
AddEffect("HitCheck", this, 1,1, nil,nil, shooter);
LaunchProjectile(angle, dist, speed);
LaunchProjectile(angle, dist, speed);
// remove after some time
SetAction("Travel");

View File

@ -18,7 +18,7 @@ local fRemove, iSpeed, pShot, w, l, r, x, y;
public func Set(int iWidth, int iLength, object pSht)
{
pShot = pSht;
pShot = pSht;
w = 1000*iWidth/this["ActMap"]["Travel"]["Wdt"];
l = 1000*iLength/this["ActMap"]["Travel"]["Hgt"];
@ -61,7 +61,7 @@ private func Traveling()
// Display
DrawTransform();
if(pShot)
if(pShot)
if(pShot->~TrailColor(GetActTime()) != nil)
SetClrModulation(pShot->~TrailColor(GetActTime()));
@ -90,7 +90,7 @@ public func DrawTransform() {
if(!fRemove && l < relative_length) return;
// stretch >-<
if(fRemove) l = Max(0,l-iSpeed);
if(fRemove) l = Max(0,l-iSpeed);
// stretch <->
var h = Min(l,relative_length);

View File

@ -15,7 +15,7 @@ public func GetCarryMode(clonk) { if(fAiming >= 0) return CARRY_Musket; }
public func GetCarrySpecial(clonk) { if(fAiming > 0) return "pos_hand2"; }
public func GetCarryBone() { return "main"; }
public func GetCarryTransform()
{
{
return Trans_Rotate(-90, 0, 1, 0);
}

View File

@ -60,24 +60,24 @@ func AdjustSolidMaskHelper()
solid_mask_helper->SetAction("Attach", Contained());
}
}
else
else
{
if(solid_mask_helper) return solid_mask_helper->RemoveObject();
else return;
}
}
var angle=BoundBy(iAngle, 0, 115);
var angle=BoundBy(iAngle, 0, 115);
if(iAngle > 180) angle=BoundBy(iAngle, 180+65, 360);
solid_mask_helper->SetR(angle - 90);
var distance=10;
var y_adjust=-5;
var x_adjust=1;
if(Contained()->GetDir() == DIR_Left) x_adjust=-1;
if(Contained()->GetDir() == DIR_Left) x_adjust=-1;
var x=Sin(angle, distance) + x_adjust;
var y=-Cos(angle, distance) + y_adjust;
solid_mask_helper->SetVertexXY(0, -x, -y);
solid_mask_helper->SetVertexXY(0, -x, -y);
}
func ControlUseHolding(clonk, x, y)
@ -144,7 +144,7 @@ func CheckStrike(iTime)
if(obj->GetOCF() & OCF_Alive)
{
if(push_livings)
{
{
found_alive=true;
obj->SetXDir((obj->GetXDir() + Contained()->GetXDir() * 3) / 4);
obj->SetYDir((obj->GetYDir() + Contained()->GetYDir() * 3) / 4);
@ -159,7 +159,7 @@ func CheckStrike(iTime)
//if(speed > 5000) continue;
speed=Max(150, speed/2);
obj->SetXDir(+Sin(a, speed), 100);
obj->SetYDir(-Cos(a, speed), 100);
obj->SetYDir(-Cos(a, speed), 100);
found=true;
}

View File

@ -1,8 +1,8 @@
/*--Helper --*/
func Initialize() {
return(1);
func Initialize()
{
return(1);
}
func Definition(def) {

View File

@ -93,7 +93,7 @@ func OnWeaponHitCheckStop(clonk)
if(GetEffect("SwordStrikeSpeedUp", clonk))
RemoveEffect("SwordStrikeSpeedUp", clonk);
//if(GetEffect("DelayTranslateVelocity", clonk))
// RemoveEffect("DelayTranslateVelocity", clonk);
// RemoveEffect("DelayTranslateVelocity", clonk);
return;
}

View File

@ -11,7 +11,7 @@ public func ControlCommandAcquire(target, x, y, target2, def)
AddCommand ("Get", obj, 0, 0, 0, 40);
return 1;
}
// Search for a building to produce the object
// Search for a building to produce the object
if (obj = GetProducerOf (def)) {
AddCommand ( "Call", this, 0, 0, 0, 0, "AutoProduction", 0, 1);
obj -> HowToProduce (this, def);
@ -23,13 +23,13 @@ public func ControlCommandAcquire(target, x, y, target2, def)
public func AutoProduction() { return 1; }
public func AutoProductionFailed()
public func AutoProductionFailed()
{
var def = GetCommand (5, 1);
if (!FindContents(def))
if (!FindContents(def))
{
var obj = GetAvailableObject (def, GetCommand ( 4, 1));
if (obj)
if (obj)
{
AddEffect("IntNotAvailable", obj, 1, 5, this);
AddCommand ("Get", obj,0,0,0,40);
@ -49,7 +49,7 @@ public func FxIntNotAvailableTimer(target, number)
{
var clonk = EffectVar(0, target, number);
// Check wether the clonk still wants to get the object
for (var i = 0; clonk->GetCommand(0,i); ++i)
for (var i = 0; clonk->GetCommand(0,i); ++i)
{
if (clonk->GetCommand(0, i) == "Get" && clonk->GetCommand(1, i) == target)
return;

View File

@ -267,7 +267,7 @@ func DoBuy(id idDef, int iForPlr, int iPayPlr, object pClonk, bool bRight, bool
if(pObj->GetOCF() & OCF_CrewMember) pObj->MakeCrewMember(iForPlr);
if(pObj->GetOCF() & OCF_Collectible) pClonk->Collect(pObj);
// is right clicked? then buy another object
if(bRight)
if(bRight)
DoBuy(idDef, iForPlr, iPayPlr, pClonk, bRight, iValue, 1);
return pObj;
}
@ -396,7 +396,7 @@ func DoSell(object pObj, int iPlr, bool bRight)
if(CanStack(pObj, pNewObj) && pObj != pNewObj)
{
bFound = 1;
break;
break;
}
}
// And remove the object

View File

@ -155,7 +155,7 @@ public func Aim(int ctrl, object clonk, int strength, int repeat, int release)
// aiming with analog pad
if (ctrl == CON_AimAxisUp || ctrl == CON_AimAxisDown || ctrl == CON_AimAxisLeft || ctrl == CON_AimAxisRight)
{
{
dirx = diry = 0;
if(ctrl == CON_AimAxisUp) ypos = -strength;

View File

@ -25,7 +25,7 @@
*Left, *Right, *Up, *Down
*Use, *UseStop, *UseStart, *UseHolding, *UseCancel
wheras * is 'Contained' if the clonk is contained and otherwise (riding,
pushing, to self) it is 'Control'. The item in the inventory only gets
pushing, to self) it is 'Control'. The item in the inventory only gets
the Use*-calls. If the callback is handled, you should return true.
Currently, this is explained more in detail here:
http://forum.openclonk.org/topic_show.pl?tid=337
@ -226,7 +226,7 @@ protected func Ejection(object obj)
var success = false;
for(var item in inventory)
{
if (obj == item)
if (obj == item)
{
inventory[i] = nil;
indexed_inventory--;
@ -315,7 +315,7 @@ protected func AttachTargetLost() { CancelUse(); return _inherited(...); }
// ...aaand the same for when the clonk is deselected
protected func CrewSelection(bool unselect)
{
if (unselect)
if (unselect)
{
// cancel usage on unselect first...
CancelUse();
@ -520,10 +520,10 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
{
/* objects to which clonks are attached (like horses, mechs,...) have
a special handling:
movement controls are forwarded normally to the horse as if it is a
movement controls are forwarded normally to the horse as if it is a
pushed vehicle. Use controls however are, too, forwarded to the
horse but if the control is considered unhandled (return false) on
the start of the usage, the control is forwarded further to the
horse but if the control is considered unhandled (return false) on
the start of the usage, the control is forwarded further to the
item. If the item then returns true on the call, that item is
regarded as the used item for the subsequent ControlUse* calls.
BUT the horse always gets the ControlUse*-calls that'd go to the used
@ -606,10 +606,10 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
// throw
if (ctrl == CON_ThrowAlt)
{
if (proc == "SCALE" || proc == "HANGLE")
return ObjectCommand("Drop", contents2);
else
return ObjectCommand("Throw", contents2, x, y);
if (proc == "SCALE" || proc == "HANGLE")
return ObjectCommand("Drop", contents2);
else
return ObjectCommand("Throw", contents2, x, y);
}
// throw delayed
if (ctrl == CON_ThrowAltDelayed)
@ -877,7 +877,7 @@ private func Control2Menu(int ctrl, int x, int y, int strength, bool repeat, boo
/* all this stuff is already done on a higher layer - in playercontrol.c
now this is just the same for gamepad control */
if (!PlayerHasVirtualCursor(GetOwner()))
return false;
@ -888,7 +888,7 @@ private func Control2Menu(int ctrl, int x, int y, int strength, bool repeat, boo
// update angle for visual effect on the menu
if (repeat)
{
{
if (ctrl == CON_UseDelayed || ctrl == CON_UseAltDelayed)
this->GetMenu()->~UpdateCursor(mex,mey);
}
@ -905,7 +905,7 @@ private func Control2Menu(int ctrl, int x, int y, int strength, bool repeat, boo
// Control use redirected to script
private func ControlUse2Script(int ctrl, int x, int y, int strength, bool repeat, bool release, string control, object obj)
{
{
// click on secondary cancels primary and the other way round
if (using)
{
@ -1136,7 +1136,7 @@ private func ShiftVehicle(int plr, bool back)
ObjectCommand("Grab", objs[index]);
return true;
}
}
/* Virtual cursor stuff */
@ -1215,7 +1215,7 @@ func SetMenu(object m)
// new one
menu = m;
if (menu)
{
{
CancelUse();
// stop clonk
SetComDir(COMD_Stop);
@ -1284,7 +1284,7 @@ func Selected(object mnu, object mnu_item, bool alt)
var show_new_item = GetItem(hands_index);
mnu_item->SetSymbol(show_new_item);
// swap index with backpack index
Switch2Items(hands_index, backpack_index);
Switch2Items(hands_index, backpack_index);
return false;
}
@ -1313,7 +1313,7 @@ private func DoThrow(object obj, int angle)
iYDir += GetYDir(1000)/2;
// throw
obj->Exit(iX, iY, iR, 0, 0, iRDir);
obj->Exit(iX, iY, iR, 0, 0, iRDir);
obj->SetXDir(iXDir,1000);
obj->SetYDir(iYDir,1000);

View File

@ -31,7 +31,7 @@ protected func ControlSpecial2()
/* Context menu entries */
/*public func ContextRelease(pCaller)
/*public func ContextRelease(pCaller)
{
[$CtxRelease$|Image=CXRL|Condition=ReleaseAllowed]
FindObject(REAC)->Activate(GetOwner());
@ -41,7 +41,7 @@ protected func ControlSpecial2()
public func ContextEnergy(pCaller)
{
[$TxtEnergysupply$|Image=CXEC|Condition=AtEnergySite]
var pSite;
var pSite;
if (pSite = FindEnergySite())
SetCommand("Energy", pSite);
return 1;
@ -50,7 +50,7 @@ public func ContextEnergy(pCaller)
public func ContextConstructionSite(pCaller)
{
[$CtxConstructionMaterial$|Image=CXCM|Condition=AtConstructionSite]
var pSite;
var pSite;
if (pSite = FindConstructionSite())
pSite->PlayerMessage(GetOwner(), pSite->GetNeededMatStr());
return 1;
@ -59,7 +59,7 @@ public func ContextConstructionSite(pCaller)
public func ContextChop(pCaller)
{
[$CtxChop$|Image=CXCP|Condition=AtTreeToChop]
var pTree;
var pTree;
if (pTree = FindTree())
SetCommand("Chop", pTree);
return 1;
@ -80,7 +80,7 @@ public func ContextHome(pCaller)
return 1;
}
public func ContextDescend(pCaller)
public func ContextDescend(pCaller)
{
[$TxtDescend$|Image=DSCN|Condition=IsRiding]
DescendVehicle();
@ -162,5 +162,5 @@ public func DescendVehicle()
// Vehicle is stuck as well? Back to the roots.
SetPosition(x,y);
}
}
}
}

View File

@ -1,5 +1,5 @@
/*--
Goal control
/*--
Goal control
Author: Sven2
Include this to all C4D_Goal objects
@ -38,7 +38,7 @@ func RecheckGoalTimer()
if (!GetEffect("IntGoalCheck", 0))
{
var timer_interval = 35;
if (GetLeague())
if (GetLeague())
timer_interval = 2; // league has more frequent checks
var num = AddEffect("IntGoalCheck", 0, 1, timer_interval, 0);
FxIntGoalCheckTimer(nil, num);
@ -52,7 +52,7 @@ public func NotifyHUD()
{
var plr = GetPlayerByIndex(i);
var HUD = FindObject(Find_ID(GUI_Controller), Find_Owner(plr));
if (HUD)
if (HUD)
HUD->OnGoalUpdate(this);
}
}
@ -60,7 +60,7 @@ public func NotifyHUD()
protected func InitializePlayer(int plr)
{
var HUD = FindObject(Find_ID(GUI_Controller), Find_Owner(plr));
if (HUD)
if (HUD)
HUD->OnGoalUpdate(this);
}
@ -73,7 +73,7 @@ global func FxIntGoalCheckTimer(object trg, int num, int time)
if (curr_goal && (curr_goal->GetCategory() & C4D_Goal))
{
curr_goal->NotifyHUD();
if (!curr_goal->~IsFulfilled())
if (!curr_goal->~IsFulfilled())
return true;
}
// Current goal is fulfilled/destroyed - check all others
@ -89,7 +89,7 @@ global func FxIntGoalCheckTimer(object trg, int num, int time)
}
}
// No goal object? Kill timer
if (!goal_count)
if (!goal_count)
return FX_Execute_Kill;
// Game over :(
AllGoalsFulfilled();
@ -126,7 +126,7 @@ public func IsFulfilled() { return true; }
protected func Activate(plr)
{
if (IsFulfilled())
if (IsFulfilled())
return(MessageWindow("$MsgGoalFulfilled$", plr));
return MessageWindow(GetProperty("Description"), plr);
}

View File

@ -23,7 +23,7 @@ public func HUDAdapter()
// hotkey control
public func ControlHotkey(int hotindex)
{
if (HUDcontroller)
if (HUDcontroller)
return HUDcontroller->ControlHotkey(hotindex);
}
@ -35,7 +35,7 @@ protected func Recruitment(int plr)
HUDcontroller = FindObject(Find_ID(GUI_Controller), Find_Owner(plr));
if (!HUDcontroller)
HUDcontroller = CreateObject(GUI_Controller, 10, 10, plr);
return _inherited(plr, ...);
return _inherited(plr, ...);
}
public func OnDisplayInfoMessage()
@ -65,30 +65,30 @@ protected func OnPhysicalChange(string physical, int change, int mode)
else if (physical == "Breath") HUDselector->UpdateBreathBar();
else if (physical == "Magic") HUDselector->UpdateMagicBar();
}
return _inherited(physical, change, mode, ...);
return _inherited(physical, change, mode, ...);
}
// calls to both crew selector and controller
protected func CrewSelection(bool unselect)
{
if (HUDselector)
if (HUDselector)
HUDselector->UpdateSelectionStatus();
if (HUDcontroller)
if (HUDcontroller)
HUDcontroller->OnCrewSelection(this,unselect);
return _inherited(unselect, ...);
return _inherited(unselect, ...);
}
// calls to controller
protected func OnCrewEnabled()
{
if (HUDcontroller)
if (HUDcontroller)
HUDcontroller->OnCrewEnabled(this);
return _inherited(...);
}
protected func OnCrewDisabled()
{
if (HUDcontroller)
if (HUDcontroller)
HUDcontroller->OnCrewDisabled(this);
return _inherited(...);
}

View File

@ -1,4 +1,4 @@
/*--
/*--
Item container
Author: Maikel
@ -65,7 +65,7 @@ public func OpenMenu(object clonk)
{
//var proc = clonk->GetProcedure();
// not opened yet v- why is this check here? - it belongs in the object script - Newton
if (!content_menu /* && (proc == "WALK" || proc == "PUSH")*/)
if (!content_menu /* && (proc == "WALK" || proc == "PUSH")*/)
{
content_menu = clonk->CreateRingMenu(GetID(), this);
// all contents into the menu

View File

@ -73,7 +73,7 @@ func FxIntSearchLadderTimer(target, number, time)
}
if(ladder && ladder->~CanNotBeClimbed()) ladder = nil;
}
else
else
no_ladder_counter--;
// Found ladder?
if (ladder != nil)
@ -89,14 +89,14 @@ func FxIntSearchLadderTimer(target, number, time)
func FxIntSearchLadderStop(target, number, reason, tmp)
{
if (tmp) return;
no_ladder_counter = 0;
no_ladder_counter = 0;
}
func FxIntClimbControlStart(target, number, tmp, ladder)
{
if (tmp) return;
EffectVar(0, target, number) = ladder;
SetXDir(0);
SetXDir(0);
SetYDir(0);
SetComDir(COMD_Stop);
EffectVar(2, target, number) = 0; // odd or even segment?

View File

@ -1,8 +1,8 @@
/*--
/*--
Melee weapons
Author: Zapper
Generic weapon template
Generic weapon template
--*/
@ -75,7 +75,7 @@ func FxIntWeaponChargeTimer(pTarget, iEffectNumber, iEffectTime)
{
if(!pTarget->IsWalking())
return -1;
}
}
else if(!pTarget->IsJumping())
{
return -1;
@ -324,7 +324,7 @@ func GetJumpLength(pClonk)
}
func ApplyShieldFactor(pFrom, pTo, damage)
{
{
// totally prevent the strike?
if(pTo->~QueryCatchBlow(pFrom)) return 100;

View File

@ -1,6 +1,6 @@
/*-- Plant Library --*/
private func SeedChance() { return 500; }
private func SeedChance() { return 500; }
private func SeedAreaSize() { return 300; } //The distance seeds may travel
private func SeedAmount() { return 10; } //The amount of plants possible within a diameter of 500px.

View File

@ -2,10 +2,10 @@
Power consumer
Author: Maikel
To be included by all objects that need a supply of energy.
To be included by all objects that need a supply of energy.
The object then can check and consume power by calling it's
function CheckPower(int power_check, bool no_substract),
see below for an explanation.
see below for an explanation.
--*/
@ -13,7 +13,7 @@
// Functions that specify object properties, should be overloaded by the consumer.
// Returns whether the object is a power consumer.
public func IsPowerConsumer()
public func IsPowerConsumer()
{
return true;
}
@ -31,12 +31,12 @@ public func CanPowerConnect() // Other name?
// fSubstract determines whether the check substracts powerNeed.
// If false it starts showing the power need object.
// If true it stops showing the power need object.
public func CheckPower(int power_check, bool no_substract)
public func CheckPower(int power_check, bool no_substract)
{
if (!FindObject(Find_ID(Rule_NeedEnergy))) // Rule: Consumers do not need power.
return true;
// Check all power generators connected to this consumer and sort them according to priority.
for (var generator in FindObjects(Find_PowerGenerator(), Sort_GeneratorPriority()))
for (var generator in FindObjects(Find_PowerGenerator(), Sort_GeneratorPriority()))
{
var power = generator->GetPower();
if (power > power_check)
@ -97,9 +97,9 @@ private func FxEnergyNeedTimer(object trg, int fxnum, int time)
// Do not show symbol.
trg->SetGraphics(nil, nil, GFX_Overlay, GFXOV_MODE_Base);
EffectVar(0, trg, fxnum) = false;
}
}
else // Effect was not showing symbol.
{
{
// Do show symbol.
trg->SetGraphics(nil, Library_PowerConsumer, GFX_Overlay, GFXOV_MODE_Base);
trg->SetObjDrawTransform(1000, 0, 0, 0, 1000, -500 * GetID()->GetDefCoreVal("Height", "DefCore"), GFX_Overlay);

View File

@ -14,7 +14,7 @@ local power;
// Functions that specify object properties, should be overloaded by the generator.
// Maximum amount of power that can be stored in this power generator.
public func GetCapacity()
public func GetCapacity()
{
return 0;
}
@ -71,7 +71,7 @@ public func IsPowerGeneratorFor(object consumer, object next, object old_line, a
// Finds all power lines connected to pObject (can be nil in local calls).
private func Find_PowerLine(object line)
{
if (!line)
if (!line)
line = this;
return [C4FO_Func, "IsConnectedTo", line];
}
@ -101,7 +101,7 @@ public func DoPower(int do_power)
/*-- Debug --*/
protected func Initialize()
protected func Initialize()
{
//AddEffect("ShowPower",this,100,10,this);
return _inherited(...);

View File

@ -441,7 +441,7 @@ public func ConstraintObjects()
public func ConstraintLength()
{
// Satisfy all stick constraints (move the particles to fit the length)
// Satisfy all stick constraints (move the particles to fit the length)
var normal_restlength = Rope_SegmentLength*Rope_Precision;
var normal_restlength2 = normal_restlength*normal_restlength;
var restlength, restlength2;

View File

@ -28,7 +28,7 @@ protected func InitializePlayer(int plr)
{
var plrid = GetPlayerID(plr);
// Create scoreboard relaunch count entry for this player.
score_relaunch_list[plrid] = RelaunchCount();
score_relaunch_list[plrid] = RelaunchCount();
SetScoreboardData(plrid, GetRelaunchCol(), Format("%d", score_relaunch_list[plrid]), score_relaunch_list[plrid]);
return _inherited(plr, ...);
}

View File

@ -5,7 +5,7 @@
Including this object means, the object is stackable. Other objects of
the same type will be added automatically to the object. This functionality
is similar to the Pack-functionality of the arrows in old clonk titles only
more general.
more general.
The count of how many objects are stacked together (into a single one, this
one) is shown in the picture of the object and can be queried and set via
GetStackCount()/SetStackCount().
@ -169,7 +169,7 @@ private func TryPutInto(object into)
// first check if stackable can be put into object with extra slot
for (var content in contents)
{
if (!content)
if (!content)
continue;
if (content->~HasExtraSlot())
if (TryPutInto(content))
@ -180,7 +180,7 @@ private func TryPutInto(object into)
for (var content in contents)
{
var howmany = 0;
if (!content)
if (!content)
continue;
if (content->~IsStackable())
if (content->GetID() == GetID())
@ -195,6 +195,6 @@ private func TryPutInto(object into)
}
}
Update();
Update();
return false;
}

View File

@ -3,11 +3,11 @@
func Activate(int plr)
{
// Notify scenario.
if (GameCall("OnRestart", plr))
if (GameCall("OnRestart", plr))
return;
// Remove the player's clonk, including contents.
var clonk = GetCrew(plr);
if (clonk)
if (clonk)
clonk->RemoveObject();
}

View File

@ -50,7 +50,7 @@ private func Close()
Sound("Close.ogg");
}
protected func Definition(def)
protected func Definition(def)
{
SetProperty("PictureTransformation", Trans_Mul(Trans_Translate(0,-3000,-5000), Trans_Rotate(-30,1,0,0), Trans_Rotate(30,0,1,0), Trans_Translate(1000,1,0)),def);
}

View File

@ -6,7 +6,7 @@
func ProductType() { return C4D_Vehicle | C4D_Object; }
func ProductCondition() { return "IsToolProduct"; }
public func Construction()
public func Construction()
{
SetProperty("MeshTransformation",Trans_Rotate(RandomX(-30,30),0,1,0));
}
@ -25,7 +25,7 @@ public func NeedsEnergy()
/* Production */
public func IsProducerOf(caller, def)
public func IsProducerOf(caller, def)
{
if (!(def->GetCategory () & ProductType())) return 0;
if (!IsBuilt ()) return 0;
@ -53,7 +53,7 @@ func FindSuppliedObjectCloseTo (obj, def)
public func HowToProduce (clonk, def)
{
if(NeedsEnergy())
{
{
clonk->AddCommand ("Call", this, def, 0, 0, 0, "HowToProduce");
clonk->AddCommand ("Energy", this);
return 1;
@ -109,7 +109,7 @@ public func StartProduction(pWorker,idType,bSpecial2)
}
public func ProductionCompleteFailed(pWorker,idType,bSpecial2)
{
{
// Action "Build" can't be executed (resources are missing)
// To recieve the Message "x needs y" execute one more the command "Build"
// so that it fails and puts out the message.
@ -142,7 +142,7 @@ protected func IsBuilt()
/* Control */
protected func ContainedUp(pCaller)
protected func ContainedUp(pCaller)
{
[$Production$|Image=CXCN]
return MenuProduction(pCaller);
@ -151,7 +151,7 @@ protected func ContainedUp(pCaller)
/* Activity */
private func CheckBuild()
{
{
// TimerCall: The workshop starts its own Build-Action, when
// someone works in the workshop. The work in a building only proceeds
// when the building supports this with an own build-action.
@ -174,7 +174,7 @@ private func IsWorking()
}
private func Smoking()
{
{
if (GetPhase()%3) return 1;
if (Random(6)) Smoke(+16,-14,16);
if (Random(8)) Smoke(10,-14,15+Random(3));

View File

@ -1,7 +1,7 @@
/*-- Airplane Reticle --*/
protected func Initialize()
{
{
this["Visibility"] = VIS_Owner;
AddEffect("IntRotate",this,1,1,this);
return;
@ -15,7 +15,7 @@ public func FxIntRotateTimer(object target, int num, int timer)
/*-- Proplist --*/
protected func Definition(def)
protected func Definition(def)
{
SetProperty("Name", "$Name$", def);
SetProperty("ActMap", {
@ -30,6 +30,6 @@ protected func Definition(def)
Wdt = 40,
Hgt = 20,
NextAction = "Show",
},
},
}, def);
}

View File

@ -1,4 +1,4 @@
/*--
/*--
Airplane
Author: Ringwaul
@ -20,7 +20,7 @@ protected func Construction(object byobj)
}
protected func Initialize()
{
{
propanim = PlayAnimation("Propellor", 15, Anim_Const(0),Anim_Const(1000));
AddEffect("IntPlane",this,1,1,this);
SetAction("Land");
@ -67,7 +67,7 @@ public func ContainedUseStop(object clonk, int ix, int iy)
CreateParticle("MuzzleFlash",IX,IY,+Sin(angle,500),-Cos(angle,500),600,RGB(255,255,255),this);
CreateParticle("Flash",0,0,GetXDir(),GetYDir(),800,RGBa(255,255,64,150));
AddEffect("IntCooldown", this,1,1,this);
AddEffect("IntCooldown", this,1,1,this);
}
return 1;
}
@ -327,7 +327,7 @@ Fly = {
Wdt = 40,
Hgt = 56,
NextAction = "Fly",
},
},
Land = {
Prototype = Action,
Name = "Land",
@ -341,7 +341,7 @@ Land = {
Wdt = 40,
Hgt = 56,
NextAction = "Land",
},
},
}, def);
SetProperty("Name", "$Name$", def);
SetProperty("MeshTransformation", Trans_Mul(Trans_Rotate(90,0,0,1), Trans_Translate(-10000,-3375,0), Trans_Rotate(25,0,1,0)));

View File

@ -1,4 +1,4 @@
/*--
/*--
Cannon
Author: Ringwaul
@ -96,13 +96,13 @@ private func CheckForKeg(object clonk)
if (keg) // If there is a keg, put into cannon.
{
keg->Exit();
keg->Enter(this);
Sound("WoodHit*");
}
keg->Enter(this);
Sound("WoodHit*");
}
else // No keg, stop using cannon.
{
PlayerMessage(clonk->GetOwner(),"$TxtNeedsGunp$");
return false;
return false;
}
}
return true;
@ -256,7 +256,7 @@ func ControlLeft(object clonk)
SetDir();
}
func ControlRight(object clonk)
func ControlRight(object clonk)
{
SetDir(1);
}
@ -298,7 +298,7 @@ protected func DoFire(object iammo, object clonk, int angle)
}
func Timer()
{
{
//Turning
if(olddir != GetDir())
{

View File

@ -36,7 +36,7 @@ protected func ContactLeft()
protected func ContactRight()
{
if (Stuck() && !Random(5))
if (Stuck() && !Random(5))
SetRDir(RandomX(-7, +7));
}
@ -109,7 +109,7 @@ local ActMap = {
Hgt = 16,
NextAction = "Drive",
//Animation = "Drive",
},
},
};
func Definition(def)

View File

@ -13,7 +13,7 @@ func Initialize()
pGoal->AddCheckpoint(3830, 710, 28);
pGoal->SetFinishpoint(3650, 180);
SetSkyAdjust (RGB(255,128,0), RGB(0,0,0));
SetSkyAdjust (RGB(255,128,0), RGB(0,0,0));
}
// Gamecall from Race-goal, on respawning.

View File

@ -32,7 +32,7 @@ protected func Initialize()
x = pos[0]; y = pos[1];
goal->SetFinishpoint(x, y);
// Place chests.
d = 300;
d = 300;
while (d < LandscapeHeight() - 300)
{
var i = 0;
@ -40,7 +40,7 @@ protected func Initialize()
i++; // Max 25 attempts.
x = pos[0]; y = pos[1];
CreateObject(Chest, x, y + 8, NO_OWNER);
d += RandomX(250, 300);
d += RandomX(250, 300);
}
// Fill chests.
var content_list = [GrappleBow, DynamiteBox, Ropeladder, Boompack, Loam];

View File

@ -1,4 +1,4 @@
/*--
/*--
C4.c
Authors:
@ -17,7 +17,7 @@ static const DFA_DIG = 5;
static const DFA_SWIM = 6;
static const DFA_THROW = 7;
static const DFA_BRIDGE = 8;
static const DFA_BUILD = 9;
static const DFA_BUILD = 9;
static const DFA_PUSH = 10;
static const DFA_CHOP = 11;
static const DFA_LIFT = 12;
@ -35,9 +35,9 @@ static const Action = {
global func GetActMapVal(string entry, string action, id def, int num)
{
if (!def)
if (!def)
def = GetID();
if (entry == "Facet")
if (entry == "Facet")
entry = ["X", "Y", "Wdt", "Hgt", "OffX", "OffY"][num];
return GetProperty(entry, GetProperty(action, def));
}
@ -55,9 +55,9 @@ global func ShowNeededMaterial(object of_obj)
global func FlameConsumeMaterial(int x, int y)
{
var mat = GetMaterial(x, y);
if (mat == -1)
if (mat == -1)
return false;
if (!GetMaterialVal("Inflammable", "Material", mat))
if (!GetMaterialVal("Inflammable", "Material", mat))
return false;
return !!ExtractMaterialAmount(x, y, mat, 1);
}
@ -70,7 +70,7 @@ global func ExtractLiquid(int x, int y)
{
var mat = GetMaterial(x, y);
var density = GetMaterialVal("Density", "Material", mat);
if (density < C4M_Liquid || density >= C4M_Solid)
if (density < C4M_Liquid || density >= C4M_Solid)
return -1;
ExtractMaterialAmount(x, y, mat, 1);
return mat;
@ -86,7 +86,7 @@ global func LaunchEffect(id type, int x, int y)
// Splits the calling object into its components.
global func Split2Components()
{
if (!this)
if (!this)
return false;
var ctr = Contained();
// Transfer all contents to container.

View File

@ -1,4 +1,4 @@
/*--
/*--
Colors.c
Authors: Tyron
@ -19,7 +19,7 @@ global func RGBa (int r, int g, int b, int a) { return (a & 255) << 24 | (r & 25
global func GetRGBaValue(int val, int sel) { return val >> ((3 - sel) * 8) & 255; }
global func DoRGBaValue(int val, int chng, int sel) { return val + (chng << ((3 - sel) * 8)); }
global func SetRGBaValue(int val, int newval, int sel)
global func SetRGBaValue(int val, int newval, int sel)
{
// 'delete' old color
val = val & ~(255 << ((3 - sel) * 8));
@ -40,10 +40,10 @@ global func HSL2RGB(int hsl)
if (sat == 0)
{
red = green = blue = lightness;
}
}
else
{
if (lightness < 128)
if (lightness < 128)
var2 = lightness * (255 + sat) / 255;
else
var2 = lightness + sat - lightness * sat / 255;
@ -64,9 +64,9 @@ global func Hue_2_RGB(int var1, int var2, int hue)
hue += 255;
if (hue > 255)
hue -= 255;
if (6 * hue < 255)
if (6 * hue < 255)
return var1 + (var2 - var1) * 6 * hue / 255;
if (2 * hue < 255)
if (2 * hue < 255)
return var2;
if (3 * hue < 510)
return var1 + (var2 - var1) * ( 510 / 3 - hue ) * 6 / 255;
@ -85,28 +85,28 @@ global func RGB2HSL(int rgb)
{
hue = 0;
sat = 0;
}
}
else
{
if (lightness < 128)
if (lightness < 128)
sat = 255 * diff_val / (max_val + min_val);
else
else
sat = 255 * diff_val / (510 - (max_val + min_val));
diff_red = ((255 * (max_val - red)) / 6 + (255 * diff_val) / 2) / diff_val;
diff_green = ((255 * (max_val - green)) / 6 + (255 * diff_val) / 2) / diff_val;
diff_blue = ((255 * (max_val - blue )) / 6 + (255 * diff_val) / 2) / diff_val;
if (red == max_val)
if (red == max_val)
hue = diff_blue -diff_green;
else if (green == max_val)
else if (green == max_val)
hue = 255 / 3 + diff_red - diff_blue;
else if (blue == max_val)
hue = 510 / 3 + diff_green - diff_red;
if (hue < 0)
if (hue < 0)
hue += 255;
if (hue > 255)
if (hue > 255)
hue -= 255;
}

View File

@ -7,27 +7,27 @@
// Returns the offset to x.
global func AbsX(int x)
global func AbsX(int x)
{
return x - GetX();
return x - GetX();
}
// Returns the offset to y.
global func AbsY(int y)
global func AbsY(int y)
{
return y - GetY();
return y - GetY();
}
// Supports negative values, and can deliver random values between two bounds.
global func RandomX(int start, int end)
global func RandomX(int start, int end)
{
var swap;
// Values swapped: reswap them.
if (start > end)
{
if (start > end)
{
swap = start;
start = end;
end = swap;
end = swap;
}
// Return random factor.
return Random(end - start + 1) + start;
@ -41,13 +41,13 @@ global func Tan(int angle, int radius, int prec)
global func Normalize(int angle, int start, int precision)
{
if (!precision)
if (!precision)
precision = 1;
var end = precision * 360 + start;
while (angle < start)
angle += precision * 360;
while (angle >= end)
while (angle >= end)
angle -= precision * 360;
return angle;
@ -72,7 +72,7 @@ global func SetVelocity(int angle, int speed)
return;
}
// Sets the completion of this to new_con.
// Sets the completion of this to new_con.
global func SetCon(int new_con)
{
return DoCon(new_con - GetCon());
@ -93,7 +93,7 @@ global func SetVertexXY(int index, int x, int y)
return;
}
// Returns the number of stuck vertices. (of this)
// Returns the number of stuck vertices. (of this)
global func VerticesStuck()
{
var vertices = 0;
@ -106,7 +106,7 @@ global func VerticesStuck()
return vertices;
}
// Creates amount objects of type id inside the indicated rectangle(optional) in the indicated material.
// Creates amount objects of type id inside the indicated rectangle(optional) in the indicated material.
// Returns the number of iterations needed, or -1 when the placement failed.
global func PlaceObjects(id id, int amount, string mat_str, int x, int y, int wdt, int hgt, bool onsf, bool nostuck)
{
@ -122,17 +122,17 @@ global func PlaceObjects(id id, int amount, string mat_str, int x, int y, int wd
return -1;
// Optional parameters wdt and hgt.
if (!wdt)
if (!wdt)
wdt = LandscapeWidth() - x - GetX();
if (!hgt)
if (!hgt)
hgt = LandscapeHeight() - y - GetY();
// Cycle-saving method.
if (mat != -1)
while (i < amount)
if (mat != -1)
while (i < amount)
{
// If there's isn't any or not enough of the given material, break before it gets an endless loop.
if (j++ > 20000)
if (j++ > 20000)
return -1;
// Destinated rectangle.
rndx = x + Random(wdt);
@ -141,22 +141,22 @@ global func PlaceObjects(id id, int amount, string mat_str, int x, int y, int wd
if (GetMaterial(rndx, rndy) == mat)
{
// On-surface option.
if (onsf)
while (GBackSemiSolid(rndx, rndy) && rndy >= y)
if (onsf)
while (GBackSemiSolid(rndx, rndy) && rndy >= y)
rndy--;
if (rndy < y)
if (rndy < y)
continue;
// Create and verify stuckness.
obj = CreateObject(id, rndx, rndy + objhgt / 2, NO_OWNER);
obj->SetR(Random(360));
if (obj->Stuck() || nostuck)
if (obj->Stuck() || nostuck)
i++;
else
else
obj->RemoveObject();
}
}
if (mat == -1)
if (mat == -1)
while (i < amount)
{
// If there's isn't any or not enough of the given material, break before it gets an endless loop.
@ -169,8 +169,8 @@ global func PlaceObjects(id id, int amount, string mat_str, int x, int y, int wd
if (eval(Format("%s(%d,%d)", mat_str, rndx, rndy)))
{
// On-surface Option.
if (onsf)
while (GBackSemiSolid(rndx, rndy) && rndy >= y)
if (onsf)
while (GBackSemiSolid(rndx, rndy) && rndy >= y)
rndy--;
if (rndy < y)
continue;
@ -189,7 +189,7 @@ global func PlaceObjects(id id, int amount, string mat_str, int x, int y, int wd
global func CastObjects(id def, int am, int lev, int x, int y, int angs, int angw)
{
if (!angw)
if (!angw)
angw = 360;
for (var i = 0; i < am; i++)
{
@ -208,7 +208,7 @@ global func CastObjects(id def, int am, int lev, int x, int y, int angs, int ang
global func CastPXS(string mat, int am, int lev, int x, int y, int angs, int angw)
{
if (!angw)
if (!angw)
angw = 360;
for (var i = 0; i < am; i++)
{
@ -221,21 +221,21 @@ global func CastPXS(string mat, int am, int lev, int x, int y, int angs, int ang
global func CheckVisibility(int plr)
{
var visible = this["Visibility"];
if (GetType(visible) == C4V_Array)
if (GetType(visible) == C4V_Array)
visible = visible[0];
// Not visible at all.
if (visible == VIS_None)
if (visible == VIS_None)
return false;
// Visible for all.
if (visible == VIS_All)
if (visible == VIS_All)
return true;
// Object is owned by the indicated player.
if (GetOwner() == plr)
{
if (visible & VIS_Owner)
return true;
{
if (visible & VIS_Owner)
return true;
}
// Object belongs to a player, hostile to plr.
else if (Hostile(GetOwner(), plr))
@ -245,7 +245,7 @@ global func CheckVisibility(int plr)
}
// Object belongs to a player, friendly to plr.
else
{
{
if (visible & VIS_Allies)
return true;
}
@ -270,12 +270,12 @@ global func MaterialDepthCheck(int x, int y, string mat, int depth)
if (depth == nil)
depth = LandscapeHeight();
while (travelled != depth)
while (travelled != depth)
{
if (GetMaterial(xval, yval) == Material(mat))
if (GetMaterial(xval, yval) == Material(mat))
{
travelled++;
yval++;
yval++;
}
if (GetMaterial(xval, yval) != Material(mat))
return travelled; // Returns depth of material.
@ -297,8 +297,8 @@ global func LaunchProjectile(int angle, int dist, int speed, int x, int y, bool
var x_offset = Sin(angle, dist);
var y_offset = -Cos(angle, dist);
if (Contained() != nil && rel_x == true)
if (Contained()->GetDir() == 0)
if (Contained() != nil && rel_x == true)
if (Contained()->GetDir() == 0)
x = -x;
if (Contained() != nil)
@ -308,7 +308,7 @@ global func LaunchProjectile(int angle, int dist, int speed, int x, int y, bool
return true;
}
if (Contained() == nil)
if (Contained() == nil)
{
SetPosition(GetX() + x_offset + x, GetY() + y_offset + y);
SetR(angle);
@ -320,30 +320,30 @@ global func LaunchProjectile(int angle, int dist, int speed, int x, int y, bool
global func ComDirTransform(int comdir, int tocomdir)
{
if (comdir == tocomdir)
if (comdir == tocomdir)
return comdir;
if (comdir == COMD_Stop)
if (comdir == COMD_Stop)
return tocomdir;
if (comdir == (tocomdir + 3) % 8 + 1)
if (comdir == (tocomdir + 3) % 8 + 1)
return COMD_Stop;
if (Inside(comdir, tocomdir + 1, tocomdir + 3))
if (Inside(comdir, tocomdir + 1, tocomdir + 3))
return comdir - 1;
if (Inside(comdir, tocomdir - 1, tocomdir - 3))
if (Inside(comdir, tocomdir - 1, tocomdir - 3))
return comdir + 1;
if (Inside(comdir, tocomdir - 7, tocomdir - 5))
if (Inside(comdir, tocomdir - 7, tocomdir - 5))
return (comdir + 6) % 8 + 1;
return comdir % 8 + 1;
}
global func ComDirLike(int comdir1, int comdir2)
{
if (comdir1 == comdir2)
if (comdir1 == comdir2)
return true;
if (comdir1 == COMD_Stop || comdir2 == COMD_Stop)
return false;
if (comdir1 % 8 + 1 == comdir2)
return true;
if (comdir1 == comdir2 % 8 + 1)
if (comdir1 == comdir2 % 8 + 1)
return true;
return false;
}
@ -352,9 +352,9 @@ global func SetObjAlpha(int by_alpha)
{
var clr_mod = GetClrModulation();
if (!clr_mod)
clr_mod = by_alpha << 24;
else
if (!clr_mod)
clr_mod = by_alpha << 24;
else
clr_mod = clr_mod & 16777215 | by_alpha << 24;
return SetClrModulation(clr_mod);
}

View File

@ -9,7 +9,7 @@
/*-- Explosion --*/
global func Explode(int level)
global func Explode(int level)
{
// Shake the viewport.
ShakeViewPort(level, nil, GetX(), GetY());
@ -41,9 +41,9 @@ global func DoExplosion(int x, int y, int level, object inobj, int cause_plr, ob
var container = inobj;
while (container)
{
if (container->GetID()->GetDefContainBlast())
if (container->GetID()->GetDefContainBlast())
break;
else
else
container = container->Contained();
}
@ -60,7 +60,7 @@ global func DoExplosion(int x, int y, int level, object inobj, int cause_plr, ob
}
// Damage in the objects, and outside.
BlastObjects(x + GetX(), y + GetY(), level, inobj, cause_plr, layer);
if (inobj != container)
if (inobj != container)
BlastObjects(x + GetX(), y + GetY(), level, container, cause_plr, layer);
// Landschaft zerstören. Nach BlastObjects, damit neu freigesprengte Materialien nicht betroffen sind
@ -110,10 +110,10 @@ global func BlastObjects(int x, int y, int level, object container, int cause_pl
if (container->GetObjectLayer() == layer)
{
container->BlastObject(level, cause_plr);
if (!container)
if (!container)
return true; // Container could be removed in the meanwhile.
for (obj in FindObjects(Find_Container(container), Find_Layer(layer)))
if (obj)
if (obj)
obj->BlastObject(level, cause_plr);
}
}
@ -132,14 +132,14 @@ global func BlastObjects(int x, int y, int level, object container, int cause_pl
var cnt = GetLength(shockwave_objs);
if (cnt)
{
// The hurl energy is distributed over the objects.
// The hurl energy is distributed over the objects.
//Log("Shockwave objs %v (%d)", shockwave_objs, cnt);
var shock_speed = Sqrt(2 * level * level / BoundBy(cnt, 2, 12));
for (var obj in shockwave_objs)
for (var obj in shockwave_objs)
if (obj) // Test obj, cause OnShockwaveHit could have removed objects.
{
// Object has special reaction on shockwave?
if (obj->~OnShockwaveHit(level, x, y))
if (obj->~OnShockwaveHit(level, x, y))
continue;
// Living beings are hurt more.
var cat = obj->GetCategory();
@ -149,14 +149,14 @@ global func BlastObjects(int x, int y, int level, object container, int cause_pl
obj->DoDamage(level / 2, FX_Call_DmgBlast, cause_plr);
}
// Killtracing for projectiles.
if (cat & C4D_Object)
if (cat & C4D_Object)
obj->SetController(cause_plr);
// Shockwave.
var mass_fact = 20, mass_mul = 100;
var mass_fact = 20, mass_mul = 100;
if (cat & C4D_Living)
{
mass_fact = 8;
mass_mul = 80;
mass_fact = 8;
mass_mul = 80;
}
mass_fact = BoundBy(obj->GetMass() * mass_mul / 1000, 4, mass_fact);
var dx = 100 * (obj->GetX() - x) + Random(51) - 25;
@ -169,9 +169,9 @@ global func BlastObjects(int x, int y, int level, object container, int cause_pl
{
// Objects shouldn't move too fast.
var ovx = obj->GetXDir(100), ovy = obj->GetYDir(100);
if (ovx * vx > 0)
if (ovx * vx > 0)
vx = (Sqrt(vx * vx + ovx * ovx) - Abs(vx)) * Abs(vx) / vx;
if (ovy * vy > 0)
if (ovy * vy > 0)
vy = (Sqrt(vy * vy + ovy * ovy) - Abs(vy)) * Abs(vy) / vy;
}
//Log("%v v(%v %v) d(%v %v) m=%v l=%v s=%v", obj, vx,vy, dx,dy, mass_fact, level, shock_speed);
@ -186,14 +186,14 @@ global func BlastObjects(int x, int y, int level, object container, int cause_pl
global func BlastObjectsShockwaveCheck(int x, int y)
{
var def = GetID();
// Some special cases, which won't go into FindObjects.
if (def->GetDefHorizontalFix())
// Some special cases, which won't go into FindObjects.
if (def->GetDefHorizontalFix())
return false;
if (def->GetDefGrab() != 1)
{
if (GetCategory() & C4D_Vehicle)
if (GetCategory() & C4D_Vehicle)
return false;
if (GetProcedure() == "FLOAT")
if (GetProcedure() == "FLOAT")
return false;
}
// Projectiles not when they fly downwards or are exactly in the explosion point.
@ -204,7 +204,7 @@ global func BlastObjectsShockwaveCheck(int x, int y)
if (GetYDir() > 5) return false;
}
// No stuck objects.
if (Stuck())
if (Stuck())
return false;
return true;
}
@ -214,7 +214,7 @@ global func BlastObjectsShockwaveCheck(int x, int y)
global func ShakeViewPort(int level, int x_off, int y_off)
{
if (level <= 0)
if (level <= 0)
return false;
var eff = GetEffect("ShakeEffect", this);
@ -300,7 +300,7 @@ global func CreateSmokeTrail(int strength, int angle, int x, int y, int color, b
x += GetX();
y += GetY();
var num = AddEffect("SmokeTrail", nil, 300, 1, nil, nil, strength, angle, x, y);
if (!color)
if (!color)
color = RGBa(130, 130, 130, 70);
EffectVar(6, nil, num) = color;
EffectVar(7, nil, num) = noblast;
@ -321,7 +321,7 @@ global func FxSmokeTrailStart(object target, int fxnum, int temp, strength, angl
if (temp)
return;
if (angle % 90 == 1)
if (angle % 90 == 1)
angle += 1;
strength = Max(strength, 5);
@ -401,7 +401,7 @@ global func Fireworks(int color, int x, int y)
global func FxFireworkStart(object target, int num, int tmp, speed, angle, x, y, color)
{
if (tmp)
if (tmp)
return;
EffectVar(0, target, num) = speed * 100;
@ -419,7 +419,7 @@ global func FxFireworkTimer(object target, int num, int time)
if (time > 65) return -1;
if (GBackSemiSolid(x / 100, y / 100))
if (GBackSemiSolid(x / 100, y / 100))
return -1;
// loose speed

View File

@ -1,9 +1,9 @@
/*--
/*--
FindObject.c
Authors:
Authors:
Wrappers for convenient calls to the FindObject family.
--*/
--*/
/*-- Find functions --*/
@ -16,7 +16,7 @@ global func Find_Not(cond)
global func Find_And()
{
var result = [C4FO_And];
for (var i = 0; Par(i); i++)
for (var i = 0; Par(i); i++)
result[i + 1] = Par(i);
return result;
}
@ -31,9 +31,9 @@ global func Find_Or()
global func Find_Exclude(object obj)
{
if (!obj)
if (!obj)
obj = this;
if (!obj)
if (!obj)
return;
return [C4FO_Exclude, obj];
}
@ -158,7 +158,7 @@ global func Find_Layer(object layer)
global func Find_PathFree(object to_obj)
{
if (!to_obj)
if (!to_obj)
to_obj = this;
return [C4FO_Func, "Find_PathFreeCheck", to_obj];
}

View File

@ -1,11 +1,11 @@
/*--
GetXVal.c
Authors:
Authors:
Some functions which request information from the GetXVal family.
Attention: These functions directly access internal values of the engine.
Attention: These functions directly access internal values of the engine.
The usage might, under certain circumstances, lead to desynchronisation in
either network games or save games. The most dangerous functions are marked
either network games or save games. The most dangerous functions are marked
with //(!).
--*/

View File

@ -1,4 +1,4 @@
/*--
/*--
Helpers.c
Authors:
@ -9,10 +9,10 @@
global func MessageWindow(string msg, int for_plr, id icon, string caption)
{
// Get icon.
if (!icon)
if (!icon)
icon = GetID();
// Get caption.
if (!caption)
if (!caption)
caption = GetName();
// Create msg window (menu).
var cursor = GetCursor(for_plr);
@ -28,7 +28,7 @@ global func RemoveAll(p)
if (GetType(p) == C4V_PropList) p = Find_ID(p); // RemoveAll(ID) shortcut
for (var obj in FindObjects(p, ...))
{
if (obj)
if (obj)
{
obj->RemoveObject();
cnt++;
@ -39,7 +39,7 @@ global func RemoveAll(p)
global func SetBit(int old_val, int bit_nr, bool bit)
{
if (GetBit(old_val, bit_nr) != (bit != 0))
if (GetBit(old_val, bit_nr) != (bit != 0))
return ToggleBit(old_val, bit_nr);
return old_val;
}
@ -57,7 +57,7 @@ global func ToggleBit(int old_val, int bit_nr)
global func DrawParticleLine (string particle, int x0, int y0, int x1, int y1, int prtdist, int a, int b0, int b1, int ydir)
{
// Right parameters?
if (!prtdist)
if (!prtdist)
return 0;
// Calculate required number of particles.
var prtnum = Max(Distance(x0, y0, x1, y1) / prtdist, 2);
@ -71,7 +71,7 @@ global func DrawParticleLine (string particle, int x0, int y0, int x1, int y1, i
b = ((b0 & 16711935) * i1 + (b1 & 16711935) * i2) >> 8 & 16711935
| ((b0 >> 8 & 16711935) * i1 + (b1 >> 8 & 16711935) * i2) & -16711936;
if (!b && (b0 | b1))
if (!b && (b0 | b1))
b++;
CreateParticle(particle, x0 + (x1 - x0) * i / prtnum, y0 + (y1 - y0) * i-- / prtnum, 0, ydir, a, b);
}
@ -89,7 +89,7 @@ global func GetAvailableObject (id def, object obj)
Find_Not(Find_OCF(OCF_OnFire)),
Find_Func("GetAvailableObjectCheck", GetOwner()),
Find_Not(Find_Container(obj)));
if (!obj)
if (!obj)
SetLength(crit, GetLength(crit) - 1);
return FindObject(crit, Sort_Distance());
}
@ -97,10 +97,10 @@ global func GetAvailableObject (id def, object obj)
global func GetAvailableObjectCheck(int plr)
{
// Object is not connected to anything (for line construction kits)
if (FindObject (Find_ActionTarget(this), Find_Procedure(DFA_CONNECT)))
if (FindObject (Find_ActionTarget(this), Find_Procedure(DFA_CONNECT)))
return false;
// Not chosen by another friendly clonk
if (GetEffect("IntNotAvailable", this) && !Hostile(plr, EffectVar(0, this, GetEffect("IntNotAvailable", this))->GetOwner()))
if (GetEffect("IntNotAvailable", this) && !Hostile(plr, EffectVar(0, this, GetEffect("IntNotAvailable", this))->GetOwner()))
return false;
return true;
}

View File

@ -19,7 +19,7 @@
global func FxHitCheckStart(object target, int effect, int temp, object by_obj, bool never_shooter)
{
if (temp)
if (temp)
return;
EffectVar(0, target, effect) = target->GetX();
EffectVar(1, target, effect) = target->GetY();
@ -35,11 +35,11 @@ global func FxHitCheckStart(object target, int effect, int temp, object by_obj,
if (target->GetCategory() & C4D_Object)
target->SetCategory((target->GetCategory() - C4D_Object) | C4D_Vehicle);
return;
}
}
global func FxHitCheckStop(object target, int effect, int reason, bool temp)
{
if (temp)
if (temp)
return;
target->SetCategory(target->GetID()->GetCategory());
@ -50,7 +50,7 @@ global func FxHitCheckDoCheck(object target, int effect)
{
var obj;
// rather search in front of the projectile, since a hit might delete the effect,
// and clonks can effectively hide in front of walls.
// and clonks can effectively hide in front of walls.
var oldx = target->GetX();
var oldy = target->GetY();
var newx = target->GetX() + target->GetXDir() / 10;
@ -84,17 +84,17 @@ global func FxHitCheckDoCheck(object target, int effect)
if (obj->~IsProjectileTarget(target, shooter) || obj->GetOCF() & OCF_Alive)
{
target->~HitObject(obj);
if (!target)
if (!target)
return;
}
}
}
return;
return;
}
global func FxHitCheckEffect(string newname)
{
if (newname == "HitCheck")
if (newname == "HitCheck")
return -2;
return;
}
@ -118,7 +118,7 @@ global func FxHitCheckTimer(object target, int effect, int time)
EffectCall(target, effect, "DoCheck");
// It could be that it hit something and removed itself. thus check if target is still there.
// The effect will be deleted right after this.
if (!target)
if (!target)
return -1;
EffectVar(0, target, effect) = target->GetX();
@ -129,9 +129,9 @@ global func FxHitCheckTimer(object target, int effect, int time)
// The projectile will be only switched to "live", meaning that it can hit the
// shooter himself when the shot exited the shape of the shooter one time.
if (!never_shooter)
if (!never_shooter)
{
if (!live)
if (!live)
{
var ready = true;
// We search for all objects with the id of our shooter.
@ -152,17 +152,17 @@ global func FxHitCheckTimer(object target, int effect, int time)
global func ProjectileHit(object obj, int dmg, bool tumble)
{
if (!this || !obj)
if (!this || !obj)
return;
if (obj->GetAlive())
if (obj->~QueryCatchBlow(this))
return;
if (!this || !obj)
if (!this || !obj)
return;
obj->~OnProjectileHit(this);
if (!this || !obj)
if (!this || !obj)
return;
this->~OnStrike(obj);
@ -176,7 +176,7 @@ global func ProjectileHit(object obj, int dmg, bool tumble)
obj->DoDamage(dmg, FX_Call_EngObjHit, GetController());
}
// Target could have done something with this projectile.
if (!this || !obj)
if (!this || !obj)
return;
// Tumble target.
@ -190,5 +190,5 @@ global func ProjectileHit(object obj, int dmg, bool tumble)
obj->SetXDir((obj->GetXDir() * obj_mass + GetXDir() * mass * unrealism) / (mass + obj_mass));
obj->SetYDir((obj->GetYDir() * obj_mass + GetYDir() * mass * unrealism) / (mass + obj_mass));
}
return;
return;
}

View File

@ -38,49 +38,49 @@ global func Anim_AbsY(int position, int begin, int end, int length)
global func Anim_XDir(int begin, int end, int max_xdir, int prec)
{
if (prec == nil)
if (prec == nil)
prec = 10;
return [C4AVP_XDir, begin, end, max_xdir, prec];
}
global func Anim_YDir(int begin, int end, int max_ydir, int prec)
{
if (prec == nil)
if (prec == nil)
prec = 10;
return [C4AVP_YDir, begin, end, max_ydir, prec];
}
global func Anim_RDir(int begin, int end, int max_rdir, int prec)
{
if (prec == nil)
if (prec == nil)
prec = 10;
return [C4AVP_RDir, begin, end, max_rdir, prec];
}
global func Anim_CosR(int begin, int end, int offset, int prec)
{
if (prec == nil)
if (prec == nil)
prec = 1;
return [C4AVP_CosR, begin, end, offset, prec];
}
global func Anim_SinR(int begin, int end, int offset, int prec)
{
if (prec == nil)
if (prec == nil)
prec = 1;
return [C4AVP_SinR, begin, end, offset, prec];
}
global func Anim_CosV(int begin, int end, int offset, int prec)
{
if (prec == nil)
if (prec == nil)
prec = 1;
return [C4AVP_CosV, begin, end, offset, prec];
}
global func Anim_SinV(int begin, int end, int offset, int prec)
{
if (prec == nil)
if (prec == nil)
prec = 1;
return [C4AVP_SinV, begin, end, offset, prec];
}

View File

@ -1,4 +1,4 @@
/*--
/*--
Player.c
Authors: timi, Maikel
@ -15,7 +15,7 @@ global func GetPlayerByName(string plr_name)
// Does the player's name match the one searched for?
if (WildcardMatch(GetPlayerName(GetPlayerByIndex(i)), plr_name))
// It does -> return player number.
return GetPlayerByIndex(i);
return GetPlayerByIndex(i);
// There is no player with that name.
return NO_OWNER;
}
@ -29,7 +29,7 @@ global func GetTeamByName(string team_name)
// Does the team's name match the one searched for?
if (WildcardMatch(GetTeamName(GetTeamByIndex(i)), team_name))
// It does -> return team number.
return GetTeamByIndex(i);
return GetTeamByIndex(i);
// There is no team with that name.
return NO_OWNER;
}
@ -38,7 +38,7 @@ global func GetTeamByName(string team_name)
global func GetTaggedPlayerName(int plr)
{
var plr_name = GetPlayerName(plr);
if (!plr_name)
if (!plr_name)
return;
var plr_color = MakeColorReadable(GetPlayerColor(plr));
var tagged_plr_name = Format("<c %x>%s</c>", plr_color, plr_name);
@ -49,7 +49,7 @@ global func GetTaggedPlayerName(int plr)
global func GetTaggedTeamName(int team)
{
var team_name = GetTeamName(team);
if (!team_name)
if (!team_name)
return;
var team_color = MakeColorReadable(GetTeamColor(team));
var tagged_team_name = Format("<c %x>%s</c>", team_color, team_name);
@ -67,7 +67,7 @@ global func MakeColorReadable(int color)
var r = (color >> 16 & 255), g = (color >> 8 & 255), b = (color & 255);
var lightness = r * 50 + g * 87 + b * 27;
// Above 55 / 164 (*255) is okay.
if (lightness < 14025)
if (lightness < 14025)
{
// Brighten up.
var inc = (14025 - lightness) / 164;

View File

@ -25,7 +25,7 @@ global func PlayerControl(int plr, int ctrl, id spec_id, int x, int y, int stren
// Forward control to cursor
var cursor = GetCursor(plr);
if (cursor)
if (cursor)
{
// Object controlled by plr
cursor->SetController(plr);

View File

@ -2,20 +2,20 @@
Schedule.c
Authors:
Schedule can be used to execute scripts or functions repetitively with delay.
Schedule can be used to execute scripts or functions repetitively with delay.
--*/
// Executes a script repetitively with delay.
global func Schedule(string script, int interval, int repeats, object obj)
{
// Defaults.
if (!repeats)
if (!repeats)
repeats = 1;
if (!obj)
if (!obj)
obj = this;
// Create effect.
var effect = AddEffect("IntSchedule", obj, 1, interval, obj);
if (effect <= 0)
if (effect <= 0)
return false;
// Set variables.
EffectVar(0, obj, effect) = script;
@ -36,19 +36,19 @@ global func FxIntScheduleTimer(object obj, int effect)
global func ScheduleCall(object obj, string function, int interval, int repeats, par0, par1, par2, par3, par4)
{
// Defaults.
if (!repeats)
if (!repeats)
repeats = 1;
if (!obj)
if (!obj)
obj = this;
// Create effect.
var effect = AddEffect("IntScheduleCall", obj, 1, interval, obj);
if (effect <= 0)
if (effect <= 0)
return false;
// Set variables.
EffectVar(0, obj, effect) = function;
EffectVar(1, obj, effect) = repeats;
// EffectVar(2): Just there for backwards compatibility.
EffectVar(2, obj, effect) = obj;
EffectVar(2, obj, effect) = obj;
for (var i = 0; i < 5; i++)
EffectVar(i + 3, obj, effect) = Par(i + 4);
return true;

View File

@ -166,7 +166,7 @@ global func Intersect(int Ax, int Ay, int Bx, int By, int Px, int Py, int Qx, in
// parallel!
if(denominator == 0)
{
if(numerator != 0) return false;
if(numerator != 0) return false;
// on same line somewhere
else
{

View File

@ -166,7 +166,7 @@ global func Intersect(int Ax, int Ay, int Bx, int By, int Px, int Py, int Qx, in
// parallel!
if(denominator == 0)
{
if(numerator != 0) return false;
if(numerator != 0) return false;
// on same line somewhere
else
{

View File

@ -166,7 +166,7 @@ global func Intersect(int Ax, int Ay, int Bx, int By, int Px, int Py, int Qx, in
// parallel!
if(denominator == 0)
{
if(numerator != 0) return false;
if(numerator != 0) return false;
// on same line somewhere
else
{

View File

@ -35,7 +35,7 @@ public func FxIntFadeOutStart(object target, int num) {
public func FxIntFadeOutTimer(object target, int num, int time) {
if(time < fade_time * 2/3) return;
//Log("%d,%d,%08x,%08x => %08x", fade_time, time, EffectVar(4, target, num), EffectVar(3, target, num), ((fade_time - time) * EffectVar(4, target, num) / (fade_time/3)));
if(!(target->Contained())
if(!(target->Contained())
&& EffectVar(0, target, num) == target->GetX()
&& EffectVar(1, target, num) == target->GetY()
) {

View File

@ -22,7 +22,7 @@ func ChooseMenu(object clonk)
menuitem->AddItem(Loam,3);
menuitem->AddItem(Firestone,5);
menuitem->AddItem(Fireglobe,3);
menuitem->AddItem(Blackpowder,3);
menuitem->AddItem(Blackpowder,3);
menuitem->Show();
}
return true;

View File

@ -9,7 +9,7 @@ func Initialize()
CreateObject(WindGenerator,68,188)->SetR(95);
CreateObject(WindGenerator,LandscapeWidth()-68,188)->SetR(-95);
SetSkyAdjust (RGB(230,210,150), RGB(150,100,0));
for(var i=0; i<30; i++) CreateObject(Rule_ObjectFade);
for(var i=0; i<30; i++) CreateObject(Rule_ObjectFade);
var b=LandscapeWidth();
DrawMaterialQuad("Vehicle",0,110,22,120,27,255,0,255);

View File

@ -14,7 +14,7 @@ func Initialize()
SetScoreboardData(SBRD_Caption, SBRD_Caption, "$ScoreCaption$", SBRD_Caption);
SetScoreboardData(SBRD_Caption, SBRD_Rockets, "{{Goal_SaveTheWindmills}}", SBRD_Caption);
// Remove settlement eval data.
HideSettlementScoreInEvaluation(true);
HideSettlementScoreInEvaluation(true);
inherited(...);
}
@ -93,7 +93,7 @@ protected func RemovePlayer(int plr)
return _inherited(plr, ...);
}
public func DoEvaluationData()
public func DoEvaluationData()
{
for (var i = 0; i < GetPlayerCount(); i++)
{

View File

@ -38,7 +38,7 @@ global func FxBoomAttackTimer(object target, int effect, int time)
if(time/35 % Boomattack_wave_delay == 1)
{
var gol = FindObject(Find_ID(Goal_SaveTheWindmills));
if(gol)
if(gol)
gol->SetWave(wave);
if (wave < 13)
{
@ -68,7 +68,7 @@ global func CreateAttackWave(int angle, int rockets, int anglespread)
rocket_id = BigBoomattack;
}
for(var i=0; i<rockets; ++i)
for(var i=0; i<rockets; ++i)
{
var rocket_angle = angle + Random(anglespread) - anglespread/2;
var rocket_radius = radius * RandomX(80,100) / 100;

View File

@ -1,4 +1,4 @@
/*--
/*--
Flag
--*/

View File

@ -1,4 +1,4 @@
/*--
/*--
Script goal
Author: Maikel
@ -10,8 +10,8 @@
local flag; // Pointer to the flag
public func IsFulfilled()
{
public func IsFulfilled()
{
// No flag, goal fulfilled.
if (!flag)
return true;

View File

@ -94,7 +94,7 @@ protected func FxRestoreStop(object target, int num, int reason, bool temporary)
// Only if there is something to restore.
if (to_restore)
{
to_restore->Exit();
to_restore->Exit();
if (to_container)
to_restore->Enter(to_container);
else
@ -140,12 +140,12 @@ global func AddRestoreMode(object to_container, int to_x, int to_y)
{
if (!this)
return;
var effect = AddEffect("RestoreMode", this, 100);
var effect = AddEffect("RestoreMode", this, 100);
EffectVar(0, this, effect) = to_container;
EffectVar(1, this, effect) = to_x;
EffectVar(2, this, effect) = to_y;
return;
}
}
// Destruction check, uses Fx*Stop to detect item removal.
// Effectvar 0: Container to which must be restored.
@ -163,7 +163,7 @@ global func FxRestoreModeStop(object target, int num, int reason, bool temporar
var to_x = EffectVar(1, target, num);
var to_y = EffectVar(2, target, num);
var restored = CreateObject(target->GetID(), 0, 0, target->GetOwner());
restorer->SetRestoreObject(restored, to_container, to_x, to_y);
restorer->SetRestoreObject(restored, to_container, to_x, to_y);
}
return 1;
}

View File

@ -1,4 +1,4 @@
/*--
/*--
Tutorial Guide
Author: Maikel
@ -37,7 +37,7 @@ public func SetGuideIndex(int to_index)
{
index = BoundBy(to_index, 0, GetLength(messages));
return;
}
}
// Add a message to the guide, the index is set to this message.
public func AddGuideMessage(string msg)
@ -55,12 +55,12 @@ public func AddGuideMessage(string msg)
public func ShowGuideMessage(int show_index)
{
index = Max(0, show_index);
if (!messages[index])
if (!messages[index])
return;
if (GetEffect("NotifyPlayer", this))
RemoveEffect("NotifyPlayer", this);
GuideMessage(index);
if (messages[index + 1])
if (messages[index + 1])
index++;
return;
}
@ -86,10 +86,10 @@ public func MouseSelection(int plr)
if (effect && EffectVar(0, this, effect) == index)
return ClearGuideMessage();
// Show guide message if there is a new one, and increase index if possible.
if (!messages[index])
if (!messages[index])
return;
GuideMessage(index);
if (messages[index + 1])
if (messages[index + 1])
index++;
return;
}
@ -149,7 +149,7 @@ protected func FxNotifyPlayerTimer(object target, int num, int time)
{
// Delete effect if time has passed.
if (time)
return -1;
return -1;
return 1;
}

View File

@ -56,7 +56,7 @@ local ActMap = {
Hgt = 20,
NextAction = "Attach",
Animation = "Spin",
},
},
Show = {
Prototype = Action,
Name = "Show",
@ -69,5 +69,5 @@ local ActMap = {
Hgt = 20,
NextAction = "Show",
Animation = "Bounce",
},
},
};

Some files were not shown because too many files have changed in this diff Show More