Fix climbing on the right bug + eager-render boolprop
* New boolProp to help debug memory issues: eager-render, set it to false and the loadscreen will not eagerload Go images for all the level chunks. * Finally fix the level collision bug where the player could climb walls to the right.
This commit is contained in:
parent
6b8c7a1efe
commit
d694fcc7c2
|
@ -45,6 +45,10 @@ var Boolprops = map[string]Boolprop{
|
||||||
Get: func() bool { return CompressDrawings },
|
Get: func() bool { return CompressDrawings },
|
||||||
Set: func(v bool) { CompressDrawings = v },
|
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.
|
// GetBoolProp reads the current value of a boolProp.
|
||||||
|
|
|
@ -105,6 +105,14 @@ var (
|
||||||
// Limits on the Flood Fill tool so it doesn't run away on us.
|
// Limits on the Flood Fill tool so it doesn't run away on us.
|
||||||
FloodToolVoidLimit = 600 // If clicking the void, +- 1000 px limit
|
FloodToolVoidLimit = 600 // If clicking the void, +- 1000 px limit
|
||||||
FloodToolLimit = 1200 // If clicking a valid color on the level
|
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
|
// Edit Mode Values
|
||||||
|
|
|
@ -162,6 +162,10 @@ func CollidesWithGrid(d Actor, grid *level.Chunker, target render.Point) (*Colli
|
||||||
// left wall sometimes, but breaks walking up leftward slopes.
|
// left wall sometimes, but breaks walking up leftward slopes.
|
||||||
point.X = capLeft
|
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{
|
if has := result.ScanBoundingBox(render.Rect{
|
||||||
X: point.X,
|
X: point.X,
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
"git.kirsle.net/apps/doodle/pkg/balance"
|
"git.kirsle.net/apps/doodle/pkg/balance"
|
||||||
"git.kirsle.net/apps/doodle/pkg/level"
|
"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/shmem"
|
||||||
"git.kirsle.net/apps/doodle/pkg/uix"
|
"git.kirsle.net/apps/doodle/pkg/uix"
|
||||||
"git.kirsle.net/go/render"
|
"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.
|
// of chunks vs. chunks remaining to pre-cache bitmaps from.
|
||||||
func PreloadAllChunkBitmaps(chunker *level.Chunker) {
|
func PreloadAllChunkBitmaps(chunker *level.Chunker) {
|
||||||
loadChunksTarget := len(chunker.Chunks)
|
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 {
|
for {
|
||||||
remaining := chunker.PrerenderN(10)
|
remaining := chunker.PrerenderN(10)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user