Skip to content

Commit

Permalink
MEGA COMMIT:
Browse files Browse the repository at this point in the history
- Added C++ version of the trigger system that works for most levels
- Updated physics engine to use bump allocator for internal allocations
- Updated project to latest MSVC version
- Updated framerate to 30fps
- Various other improvements and incomplete changes
  • Loading branch information
Mankarse committed Apr 1, 2018
1 parent 75e0c07 commit aa3445a
Show file tree
Hide file tree
Showing 105 changed files with 4,983 additions and 638 deletions.
87 changes: 87 additions & 0 deletions data/SimpleConfiguredProxyLuaGlobals/basicTriggerSystem.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
local function cloneAttachment(a)
return {platform = a.platform, xOffset = a.xOffset, yOffset = a.yOffset}
end

local function momentarySwitch(p)
return {
type = 'momentarySwitch',
timeDirection = p.timeDirection,
attachment = cloneAttachment(p.attachment),
width = p.width,
height = p.height,
triggerID = p.triggerID,
stateTriggerID = p.stateTriggerID,
extraTriggerIDs = p.extraTriggerIDs,
}
end

local function stickySwitch(p)
return {
type = 'stickySwitch',
timeDirection = p.timeDirection,
attachment = cloneAttachment(p.attachment),
width = p.width,
height = p.height,
triggerID = p.triggerID,
stateTriggerID = p.stateTriggerID,
extraTriggerIDs = p.extraTriggerIDs,
}
end

local function pickup(p)
return {
type = 'pickup',
timeDirection = p.timeDirection,
attachment = cloneAttachment(p.attachment),
width = p.width,
height = p.height,
pickupType = p.pickupType,
triggerID = p.triggerID,
pickupNumber = p.pickupNumber,
}
end
local function spikes(p)
return {
type = 'spikes',
timeDirection = p.timeDirection,
attachment = cloneAttachment(p.attachment),
width = p.width,
height = p.height,
}
end
local function wireGlitz(p)
end
local function easyWireGlitz(p)
end
local function basicRectangleGlitz(p)
end
local function basicTextGlitz(p)
end
local function calculatePhysicsAffectingStuff(tempStore)
return tempStore
end
local function getDepartureInformation(tempStore)
return tempStore
end
local function mutateObject(tempStore)
return tempStore
end
return {
momentarySwitch = momentarySwitch,
--toggleSwitch = toggleSwitch,
stickySwitch = stickySwitch,
--stickyLaserSwitch = stickyLaserSwitch,
--multiStickySwitch = multiStickySwitch,
pickup = pickup,
spikes = spikes,
--boxOMatic = boxOMatic,
wireGlitz = wireGlitz,
easyWireGlitz = easyWireGlitz,
basicRectangleGlitz = basicRectangleGlitz,
basicTextGlitz = basicTextGlitz,
mutateObject = mutateObject,
calculatePhysicsAffectingStuff = calculatePhysicsAffectingStuff,
getDepartureInformation = getDepartureInformation,
--calculateBidirectionalGlitz = calculateBidirectionalGlitz,
--timeDirectionToInt = timeDirectionToInt,
}
35 changes: 20 additions & 15 deletions data/basicTriggerSystem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ local function calculateCollisions(protoCollisions, triggerArrivals, outputTrigg
if math.abs(velocity) <= deceleration then
velocity = 0
else
velocity = velocity + (math.abs(velocity)/velocity)*deceleration
velocity = velocity + sign(velocity)*deceleration
end
end
local maxSpeed = destination.maxSpeed
Expand Down Expand Up @@ -152,8 +152,8 @@ local function snapAttachment(objectTimeDirection, attachment, collisions)
return x, y, xspeed, yspeed
end

local function calculatePortals(forwardsGlitz, reverseGlitz, protoPortals, protoLasers, collisions, triggerArrivals, frameNumber)
local function calculatePortal(protoPortal, collisions, isLaser)
local function calculatePortals(forwardsGlitz, reverseGlitz, protoPortals, collisions, triggerArrivals, frameNumber)
local function calculatePortal(protoPortal, collisions)
local x, y, xspeed, yspeed =
snapAttachment(protoPortal.timeDirection, protoPortal.attachment, collisions)

Expand All @@ -178,7 +178,7 @@ local function calculatePortals(forwardsGlitz, reverseGlitz, protoPortals, proto
destinationDirection = protoPortal.destinationDirection or 'forwards',
illegalDestination = protoPortal.illegalDestination,
fallable = protoPortal.fallable,
isLaser = isLaser,
isLaser = (protoPortal.isLaser or false),
winner = false
}

Expand Down Expand Up @@ -252,15 +252,17 @@ local function calculatePortals(forwardsGlitz, reverseGlitz, protoPortals, proto
local arrivalLocations = {}

for i, protoPortal in ipairs(protoPortals) do
local portal, active = calculatePortal(protoPortal, collisions, false)
calculatePortalGlitz(portal, forwardsGlitz, reverseGlitz, active)
local portal, active = calculatePortal(protoPortal, collisions)
if not protoPortal.isLaser then
calculatePortalGlitz(portal, forwardsGlitz, reverseGlitz, active)
end
arrivalLocations[#arrivalLocations + 1] = calculateArrivalLocation(portal)
if active then
portalCount = portalCount + 1
portals[portalCount] = portal
end
end

--[[
if protoLasers then
for i, protoLaser in ipairs(protoLasers) do
local portal, active = calculatePortal(protoLaser, collisions, true)
Expand All @@ -271,7 +273,7 @@ local function calculatePortals(forwardsGlitz, reverseGlitz, protoPortals, proto
end
end
end

]]--
return portals, arrivalLocations
end

Expand Down Expand Up @@ -864,7 +866,7 @@ local function pickup(p)
local forwardsImageGlitz = {
type = "image",
layer = 430,
key = pickupGlitzNameMap[p.pickupType],
key = pickupGlitzNameMap[proto.pickupType],
x = PnV.x,
y = PnV.y,
width = proto.height,
Expand All @@ -874,7 +876,7 @@ local function pickup(p)
local reverseImageGlitz = {
type = "image",
layer = 430,
key = pickupGlitzNameMap[p.pickupType],
key = pickupGlitzNameMap[proto.pickupType],
x = PnV.x,
y = PnV.y,
width = proto.height,
Expand Down Expand Up @@ -936,6 +938,8 @@ local function spikes(p)
deathGlitz[#deathGlitz+1] = {
x = dynamicObject.x,
y = dynamicObject.y,
xspeed = dynamicObject.xspeed,
yspeed = dynamicObject.yspeed,
width = dynamicObject.width,
height = dynamicObject.height,
timeDirection = dynamicObject.timeDirection
Expand Down Expand Up @@ -1133,7 +1137,7 @@ function calculatePhysicsAffectingStuff(tempStore)
tempStore.forwardsGlitz,
tempStore.reverseGlitz,
tempStore.protoPortals,
tempStore.protoLasers,
--tempStore.protoLasers,
retv.collisions,
triggerArrivals,
tempStore.frameNumber
Expand Down Expand Up @@ -1167,11 +1171,12 @@ function calculatePhysicsAffectingStuff(tempStore)
end

local function mutateObject(tempStore)
return function(responsibleManipulatorIndices, dynamicObject)
for i in list_iter(responsibleManipulatorIndices) do
if dynamicObject then
dynamicObject = tempStore.activeMutators[i]:effect(dynamicObject)
return function(responsibleMutatorIndices, dynamicObject)
for i in list_iter(responsibleMutatorIndices) do
if not dynamicObject then
break
end
dynamicObject = tempStore.activeMutators[i]:effect(dynamicObject)
end
return dynamicObject
end
Expand Down
22 changes: 22 additions & 0 deletions data/levels/0Level.lvl/triggerSystem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,28 @@ local tempStore =
fallable = false,
winner = true
},
{
attachment = {xOffset = 6 * 3200, yOffset = 6 * 3200},
index = 2,
xaim = 5 * 3200,
yaim = 20 * 3200,
collisionOverlap = 50,
timeDirection = 'forwards',
destinationIndex = nil,
xDestination = 0,
yDestination = 0,
relativeTime = true,
timeDestination = -600,
illegalDestination = 1,
fallable = false,
winner = false,
isLaser = true,
triggerFunction = function(triggerArrivals, frameNumber)
return triggerArrivals[1][1] == 1
end
},
},
--[[
protoLasers =
{
{
Expand All @@ -43,6 +64,7 @@ local tempStore =
end
},
},
]]--
protoCollisions = {
{
width = 3 * 3200,
Expand Down
2 changes: 1 addition & 1 deletion data/levels/13FishInABarrel.lvl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ initialArrivals =
}
triggerSystem =
{
type = "DirectLua",
type = "CompatibleLua",

luaFiles = {"triggerSystem", "global.basicTriggerSystem"},
system = [==[require "triggerSystem"]==],
Expand Down
2 changes: 1 addition & 1 deletion data/levels/19Impossibru.lvl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ initialArrivals =
}
triggerSystem =
{
type = "DirectLua",
type = "CompatibleLua",

luaFiles = {"triggerSystem", "global.basicTriggerSystem"},
system = [==[require "triggerSystem"]==],
Expand Down
2 changes: 1 addition & 1 deletion data/levels/19a_Really_Impossibru.lvl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ initialArrivals =
}
triggerSystem =
{
type = "DirectLua",
type = "CompatibleLua",

luaFiles = {"triggerSystem", "global.basicTriggerSystem"},
system = [==[require "triggerSystem"]==],
Expand Down
2 changes: 1 addition & 1 deletion data/levels/1EasyStart.lvl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ triggerSystem =
--DirectLua does a minimum amount of work in C++, before calling
--Lua with the same arguments and expecting the same return values
--as the TriggerSystem in C++
type = "DirectLua",
type = "CompatibleLua",

luaFiles = {"triggerSystem", "global.basicTriggerSystem"},
--This describes a lua chunk which will be loaded by TriggerFrameState
Expand Down
4 changes: 1 addition & 3 deletions data/levels/1EasyStart.lvl/triggerSystem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ end
function shouldPort(responsiblePortalIndex, dynamicObject, porterActionedPortal)
return true
end
function mutateObject(responsibleManipulatorIndices, dynamicObject)
return dynamicObject
end
mutateObject = bts.mutateObject(tempStore)

getDepartureInformation = bts.getDepartureInformation(tempStore)
5 changes: 1 addition & 4 deletions data/levels/21WhichWay.lvl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ initialArrivals =
}
triggerSystem =
{
--DirectLua does a minimum amount of work in C++, before calling
--Lua with the same arguments and expecting the same return values
--as the TriggerSystem in C++
type = "DirectLua",
type = "CompatibleLua",

luaFiles = {"triggerSystem", "global.basicTriggerSystem"},
--This describes a lua chunk which will be loaded by TriggerFrameState
Expand Down
5 changes: 1 addition & 4 deletions data/levels/22AnotherBoxPuzzle.lvl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ initialArrivals =
}
triggerSystem =
{
--DirectLua does a minimum amount of work in C++, before calling
--Lua with the same arguments and expecting the same return values
--as the TriggerSystem in C++
type = "DirectLua",
type = "CompatibleLua",

luaFiles = {"triggerSystem", "global.basicTriggerSystem"},
--This describes a lua chunk which will be loaded by TriggerFrameState
Expand Down
2 changes: 1 addition & 1 deletion data/levels/25Shafted.lvl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ initialArrivals =
}
triggerSystem =
{
type = "DirectLua",
type = "CompatibleLua",

luaFiles = {"triggerSystem", "global.basicTriggerSystem"},
system = [==[require "triggerSystem"]==],
Expand Down
2 changes: 1 addition & 1 deletion data/levels/2OpenAndClosed.lvl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ initialGuy =
}
triggerSystem =
{
type = "DirectLua",
type = "CompatibleLua",

luaFiles = {"triggerSystem", "global.basicTriggerSystem"},
system = [==[ require "triggerSystem" ]==],
Expand Down
2 changes: 1 addition & 1 deletion data/levels/31UpsAndDowns.lvl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ initialArrivals =
}
triggerSystem =
{
type = "DirectLua",
type = "CompatibleLua",

luaFiles = {"triggerSystem", "global.basicTriggerSystem"},
system = [==[require "triggerSystem"]==],
Expand Down
2 changes: 1 addition & 1 deletion data/levels/33Upsypupsy.lvl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ initialArrivals =
}
triggerSystem =
{
type = "DirectLua",
type = "CompatibleLua",

luaFiles = {"triggerSystem", "global.basicTriggerSystem"},
system = [==[require "triggerSystem"]==],
Expand Down
5 changes: 1 addition & 4 deletions data/levels/38SomethingMissing.lvl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ initialArrivals =
}
triggerSystem =
{
--DirectLua does a minimum amount of work in C++, before calling
--Lua with the same arguments and expecting the same return values
--as the TriggerSystem in C++
type = "DirectLua",
type = "CompatibleLua",

luaFiles = {"triggerSystem", "global.basicTriggerSystem"},
--This describes a lua chunk which will be loaded by TriggerFrameState
Expand Down
2 changes: 1 addition & 1 deletion data/levels/3StandardBoxPuzzle.lvl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ initialArrivals =
}
triggerSystem =
{
type = "DirectLua",
type = "CompatibleLua",

luaFiles = {"triggerSystem", "global.basicTriggerSystem"},
system = [==[ require "triggerSystem" ]==],
Expand Down
2 changes: 1 addition & 1 deletion data/levels/40TooHigh.lvl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ initialArrivals =
}
triggerSystem =
{
type = "DirectLua",
type = "CompatibleLua",

luaFiles = {"triggerSystem", "global.basicTriggerSystem"},
system = [==[ require "triggerSystem" ]==],
Expand Down
2 changes: 1 addition & 1 deletion data/levels/44Widdershins.lvl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ initialArrivals =
}
triggerSystem =
{
type = "DirectLua",
type = "CompatibleLua",

luaFiles = {"triggerSystem", "global.basicTriggerSystem"},
system = [==[require "triggerSystem"]==],
Expand Down
2 changes: 1 addition & 1 deletion data/levels/4NotSoStandard.lvl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ initialArrivals =
}
triggerSystem =
{
type = "DirectLua",
type = "CompatibleLua",

luaFiles = {"triggerSystem", "global.basicTriggerSystem"},
system = [==[ require "triggerSystem" ]==],
Expand Down
2 changes: 1 addition & 1 deletion data/levels/6StackedHigh.lvl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ initialArrivals =
}
triggerSystem =
{
type = "DirectLua",
type = "CompatibleLua",

luaFiles = {"triggerSystem", "global.basicTriggerSystem"},
system = [==[ require "triggerSystem" ]==],
Expand Down
Loading

0 comments on commit aa3445a

Please sign in to comment.