From 4bc35a2ad995e2ffe5ee2007816e358ef72e4689 Mon Sep 17 00:00:00 2001 From: Luchs Date: Thu, 27 Sep 2012 21:56:48 +0200 Subject: [PATCH 1/5] Enable directional double jumping while tumbling Note: the ControlSpecial overload is for testing only and should be removed. --- Clinfinity.c4d/System.c4g/DoubleJump.c | 32 ++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/Clinfinity.c4d/System.c4g/DoubleJump.c b/Clinfinity.c4d/System.c4g/DoubleJump.c index d34e01ab..c9003d5d 100644 --- a/Clinfinity.c4d/System.c4g/DoubleJump.c +++ b/Clinfinity.c4d/System.c4g/DoubleJump.c @@ -1,6 +1,6 @@ #strict 2 -#appendto CLNK +#appendto AVTR local doubleJumpPossible; local jumpParticleColour; @@ -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 { @@ -53,6 +53,23 @@ 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()]; + 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 { @@ -61,6 +78,13 @@ protected func ControlUp() { return 0; } +protected func ControlSpecial() { + if(GetAction() == "Jump") { + SetAction("Tumble"); + } + return _inherited(...); +} + protected func MakeDoubleJumpPossible() { doubleJumpPossible = true; } From b6eacfce921c9ff7b75d4fffa0d8feb2f625968c Mon Sep 17 00:00:00 2001 From: Luchs Date: Thu, 27 Sep 2012 22:18:40 +0200 Subject: [PATCH 2/5] Flip jump direction on DIR_Right --- Clinfinity.c4d/System.c4g/DoubleJump.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Clinfinity.c4d/System.c4g/DoubleJump.c b/Clinfinity.c4d/System.c4g/DoubleJump.c index c9003d5d..bc4b2b77 100644 --- a/Clinfinity.c4d/System.c4g/DoubleJump.c +++ b/Clinfinity.c4d/System.c4g/DoubleJump.c @@ -56,6 +56,8 @@ protected func ControlUp() { } 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); From 47bd6816bd07bb21902960c466dc38424c551033 Mon Sep 17 00:00:00 2001 From: Luchs Date: Fri, 28 Sep 2012 20:58:38 +0200 Subject: [PATCH 3/5] Add tumble mode to RACE_Pilottraining In tumble mode, Clonks will always tumble when jumping, but have unlimited double jumps available with no delay! (I'm not sure whether it's actually possible to complete the race that way...) --- .../RACE_Pilottraining.c4s/Script.c | 22 ++++++++++++++++- .../System.c4g/Aviator.c | 24 +++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 Clinfinity.c4f/RACE_Pilottraining.c4s/System.c4g/Aviator.c diff --git a/Clinfinity.c4f/RACE_Pilottraining.c4s/Script.c b/Clinfinity.c4f/RACE_Pilottraining.c4s/Script.c index 72cb61db..e50404b6 100644 --- a/Clinfinity.c4f/RACE_Pilottraining.c4s/Script.c +++ b/Clinfinity.c4f/RACE_Pilottraining.c4s/Script.c @@ -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)); @@ -83,7 +85,25 @@ 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", ROCK, false, true); + AddEnumChoiceItem(menu, 0, "Gamemode", "Tumble", "Tumble", EFLN, true, false); + CreateMenuByTemplate(GetCrew(), 0, "SetGameOptions", menu); +} + +public func SetGameOptions(array options) { + tumbleMode = HashGet(options, "Gamemode"); + if(tumbleMode) + Message("Tumble mode \\o/"); +} private func JoinPlayer(int plr) { var clonk = GetCrew(plr); diff --git a/Clinfinity.c4f/RACE_Pilottraining.c4s/System.c4g/Aviator.c b/Clinfinity.c4f/RACE_Pilottraining.c4s/System.c4g/Aviator.c new file mode 100644 index 00000000..691f6f62 --- /dev/null +++ b/Clinfinity.c4f/RACE_Pilottraining.c4s/System.c4g/Aviator.c @@ -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(...); +} From 5644828dcc37f7f65371148488591534f7a4717d Mon Sep 17 00:00:00 2001 From: Luchs Date: Fri, 28 Sep 2012 21:25:30 +0200 Subject: [PATCH 4/5] Add game speed option for tumble mode --- Clinfinity.c4f/RACE_Pilottraining.c4s/Script.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Clinfinity.c4f/RACE_Pilottraining.c4s/Script.c b/Clinfinity.c4f/RACE_Pilottraining.c4s/Script.c index e50404b6..b97c6004 100644 --- a/Clinfinity.c4f/RACE_Pilottraining.c4s/Script.c +++ b/Clinfinity.c4f/RACE_Pilottraining.c4s/Script.c @@ -94,15 +94,22 @@ protected func InitializePlayer(int plr) { private func SelectGamemode() { var menu = CreateMenuTemplate(AVTR, "Options"); AddEnumChoice(menu, 0, "Gamemode", 0, "Gamemode"); - AddEnumChoiceItem(menu, 0, "Gamemode", "Normal", "Normal", ROCK, false, true); - AddEnumChoiceItem(menu, 0, "Gamemode", "Tumble", "Tumble", EFLN, true, false); + 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) - Message("Tumble mode \\o/"); + 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) { From 8c58db68199e1be2058000c43cb8f00dea2f3842 Mon Sep 17 00:00:00 2001 From: Luchs Date: Fri, 28 Sep 2012 23:25:57 +0200 Subject: [PATCH 5/5] Convert FragileRock.c to LF --- Clinfinity.c4d/System.c4g/FragileRock.c | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Clinfinity.c4d/System.c4g/FragileRock.c b/Clinfinity.c4d/System.c4g/FragileRock.c index 0e56741b..aad74d91 100644 --- a/Clinfinity.c4d/System.c4g/FragileRock.c +++ b/Clinfinity.c4d/System.c4g/FragileRock.c @@ -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(); + } } \ No newline at end of file