diff --git a/pkg/balance/boolprops.go b/pkg/balance/boolprops.go index e278717..fa0552f 100644 --- a/pkg/balance/boolprops.go +++ b/pkg/balance/boolprops.go @@ -45,6 +45,10 @@ var Boolprops = map[string]Boolprop{ Get: func() bool { return CompressDrawings }, Set: func(v bool) { CompressDrawings = v }, }, + "eager-render": { + Get: func() bool { return EagerRenderLevelChunks }, + Set: func(v bool) { EagerRenderLevelChunks = v }, + }, } // GetBoolProp reads the current value of a boolProp. diff --git a/pkg/balance/numbers.go b/pkg/balance/numbers.go index cfbbead..3ceceaa 100644 --- a/pkg/balance/numbers.go +++ b/pkg/balance/numbers.go @@ -105,6 +105,14 @@ var ( // Limits on the Flood Fill tool so it doesn't run away on us. FloodToolVoidLimit = 600 // If clicking the void, +- 1000 px limit FloodToolLimit = 1200 // If clicking a valid color on the level + + // Eager render level chunks to images during the load screen. + // Originally chunks rendered to image and SDL texture on-demand, the loadscreen was + // added to eager load (to image) the whole entire level at once (SDL textures were + // still on demand, as they scroll into screen). Control this in-game with + // `boolProp eager-render false` and the loadscreen will go quicker cuz it won't + // load the whole entire level. Maybe useful to explore memory issues. + EagerRenderLevelChunks = true ) // Edit Mode Values diff --git a/pkg/collision/collide_level.go b/pkg/collision/collide_level.go index 1e240b7..33d7ae0 100644 --- a/pkg/collision/collide_level.go +++ b/pkg/collision/collide_level.go @@ -55,8 +55,8 @@ The `target` is the point the actor wants to move to on this tick. */ func CollidesWithGrid(d Actor, grid *level.Chunker, target render.Point) (*Collide, bool) { var ( - P = d.Position() - S = d.Size() + P = d.Position() + S = d.Size() hitbox = d.Hitbox() result = &Collide{ @@ -162,6 +162,10 @@ func CollidesWithGrid(d Actor, grid *level.Chunker, target render.Point) (*Colli // left wall sometimes, but breaks walking up leftward slopes. point.X = capLeft } + if capRight != 0 && point.X > capRight { + // This if check fixes the climbing-walls-on-the-right bug. + point.X = capRight + } if has := result.ScanBoundingBox(render.Rect{ X: point.X, diff --git a/pkg/modal/loadscreen/loadscreen.go b/pkg/modal/loadscreen/loadscreen.go index 7ac1676..5accb18 100644 --- a/pkg/modal/loadscreen/loadscreen.go +++ b/pkg/modal/loadscreen/loadscreen.go @@ -7,6 +7,7 @@ import ( "git.kirsle.net/apps/doodle/pkg/balance" "git.kirsle.net/apps/doodle/pkg/level" + "git.kirsle.net/apps/doodle/pkg/log" "git.kirsle.net/apps/doodle/pkg/shmem" "git.kirsle.net/apps/doodle/pkg/uix" "git.kirsle.net/go/render" @@ -225,9 +226,12 @@ func Loop(windowSize render.Rect, e render.Engine) { // of chunks vs. chunks remaining to pre-cache bitmaps from. func PreloadAllChunkBitmaps(chunker *level.Chunker) { loadChunksTarget := len(chunker.Chunks) - // if loadChunksTarget == 0 { - // return - // } + + // Skipping the eager rendering of chunks? + if !balance.EagerRenderLevelChunks { + log.Info("PreloadAllChunkBitmaps: skipping eager render") + return + } for { remaining := chunker.PrerenderN(10)