Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions Clinfinity.c4d/System.c4g/DoubleJump.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#strict 2

#appendto CLNK
#appendto AVTR

local doubleJumpPossible;
local jumpParticleColour;
Expand Down Expand Up @@ -34,9 +34,9 @@ protected func ControlRight() {
protected func ControlUp() {
var result = _inherited();
if( result == 0 ) {
if( GetAction() == "Jump" ) {
if( doubleJumpPossible ) {
doubleJumpPossible = false;
if( doubleJumpPossible ) {
doubleJumpPossible = false;
if( GetAction() == "Jump" ) {
if( GetDir() == DIR_Left ) {
SetXDir( -1 * Abs( GetXDir() ) );
} else {
Expand All @@ -53,6 +53,25 @@ protected func ControlUp() {
}
Sound("DoubleJump");
return true;
} else if(GetAction() == "Tumble") {
// Currently tumbling, do a directional jump!
var angle = [0, 10, 22, 40, 57, 90, 146, 157, 177, -169, -160, -145, -130, -90, -40, -20][GetPhase()];
if(GetDir() == DIR_Right)
angle *= -1;
var xdir = +Sin(angle, doubleJumpAcceleration);
var ydir = -Cos(angle, doubleJumpAcceleration);
SetXDir(GetXDir() + xdir);
SetYDir(GetYDir() + ydir);
var hgt = 9;
for(var i = -3; i < 4; i++) {
var a = 8*i + angle;
CreateParticle("MSpark", -Sin(a, hgt - Random(3)), Cos(a, hgt - Random(3)), -xdir/2, -ydir/2, 40, jumpParticleColour);
}
Sound("DoubleJump");
return true;
} else {
// We didn't do any jump, it's still possible!
doubleJumpPossible = true;
}
}
} else {
Expand All @@ -61,6 +80,13 @@ protected func ControlUp() {
return 0;
}

protected func ControlSpecial() {
if(GetAction() == "Jump") {
SetAction("Tumble");
}
return _inherited(...);
}

protected func MakeDoubleJumpPossible() {
doubleJumpPossible = true;
}
Expand Down
28 changes: 14 additions & 14 deletions Clinfinity.c4d/System.c4g/FragileRock.c
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#strict 2
#appendto ROCK
protected func Hit() {
_inherited(...);
if(GetOCF() & OCF_HitSpeed4) {
var colourIndex = Random(3);
var red = GetMaterialColor(Material("Rock"), colourIndex, 0);
var green = GetMaterialColor(Material("Rock"), colourIndex, 1);
var blue = GetMaterialColor(Material("Rock"), colourIndex, 2);
CastParticles("MatSpark", RandomX(3, 6), RandomX(20, 30), 0, 0, 40, 60, RGBa(red, green, blue, 50), RGBa(red, green, blue, 50));
RemoveObject();
}
#strict 2

#appendto ROCK

protected func Hit() {
_inherited(...);
if(GetOCF() & OCF_HitSpeed4) {
var colourIndex = Random(3);
var red = GetMaterialColor(Material("Rock"), colourIndex, 0);
var green = GetMaterialColor(Material("Rock"), colourIndex, 1);
var blue = GetMaterialColor(Material("Rock"), colourIndex, 2);
CastParticles("MatSpark", RandomX(3, 6), RandomX(20, 30), 0, 0, 40, 60, RGBa(red, green, blue, 50), RGBa(red, green, blue, 50));
RemoveObject();
}
}
29 changes: 28 additions & 1 deletion Clinfinity.c4f/RACE_Pilottraining.c4s/Script.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#strict 2

static tumbleMode;

protected func Initialize() {
// ozone
SetGamma(RGB(0,0,8), RGB(115,125,125), RGB(255,255,255));
Expand Down Expand Up @@ -83,7 +85,32 @@ func GetRACEEndOffset() { return 100; }

/* Spielerinitialisierung */

protected func InitializePlayer(int plr) { return JoinPlayer(plr); }
protected func InitializePlayer(int plr) {
if(plr == 0)
SelectGamemode();
return JoinPlayer(plr);
}

private func SelectGamemode() {
var menu = CreateMenuTemplate(AVTR, "Options");
AddEnumChoice(menu, 0, "Gamemode", 0, "Gamemode");
AddEnumChoiceItem(menu, 0, "Gamemode", "Normal", "Normal", HAT9, false, true);
AddEnumChoiceItem(menu, 0, "Gamemode", "Tumble", "Tumble", HAT2, true, false);

AddSubmenu(menu, 0, "TumbleSettings", MenuCond_Chosen(0, "Gamemode", "Tumble"), "Tumble Options", HAT6);
AddRangeChoice(menu, ["TumbleSettings"], "GameSpeed", 0, "Game Speed", BOMB, 10, 50, 1, 36);
CreateMenuByTemplate(GetCrew(), 0, "SetGameOptions", menu);
}

public func SetGameOptions(array options) {
tumbleMode = HashGet(options, "Gamemode");
if(tumbleMode) {
var tumbleSettings = HashGet(options, "TumbleSettings");
var speed = HashGet(tumbleSettings, "GameSpeed");
Message("Tumble mode @ %dfps \\o/", 0, speed);
SetGameSpeed(speed);
}
}

private func JoinPlayer(int plr) {
var clonk = GetCrew(plr);
Expand Down
24 changes: 24 additions & 0 deletions Clinfinity.c4f/RACE_Pilottraining.c4s/System.c4g/Aviator.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* Tumble mode hacks */
#strict 2

#appendto AVTR

protected func MakeDoubleJumpPossible() {
if(tumbleMode)
// No normal jumping
SetAction("Tumble");
return inherited(...);
}

protected func ControlUp() {
if(tumbleMode)
// Always possible \o/
doubleJumpPossible = true;
return inherited(...);
}

protected func ControlUpDouble() {
if(tumbleMode)
// Faster double jump
return ControlUp(...);
}