mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-12 03:26:31 -05:00
Prevent some map load crashes. (#206)
This commit is contained in:
parent
30b680d9d1
commit
908d186fea
@ -161,7 +161,7 @@ func (v *AnimatedEntity) Render(target *ebiten.Image, offsetX, offsetY int) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if v.currentFrame < 0 || v.frames == nil || v.currentFrame > len(v.frames) || v.frames[v.currentFrame] == nil {
|
if v.currentFrame < 0 || v.frames == nil || v.currentFrame >= len(v.frames) || v.frames[v.currentFrame] == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
localX := (v.subcellX - v.subcellY) * 16
|
localX := (v.subcellX - v.subcellY) * 16
|
||||||
@ -248,7 +248,7 @@ func (v *AnimatedEntity) updateFrameCache() {
|
|||||||
if v.Cof.CofLayers[cofLayerIdx].Transparent {
|
if v.Cof.CofLayers[cofLayerIdx].Transparent {
|
||||||
transparency = byte(128)
|
transparency = byte(128)
|
||||||
}
|
}
|
||||||
if animationIdx > len(dccLayer.Directions[v.direction].Frames) {
|
if animationIdx >= len(dccLayer.Directions[v.direction].Frames) {
|
||||||
log.Printf("Invalid animation index of %d for animated entity", animationIdx)
|
log.Printf("Invalid animation index of %d for animated entity", animationIdx)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -203,6 +203,9 @@ func (v *Region) renderWall(tile d2ds1.WallRecord, offsetX, offsetY int, target
|
|||||||
img := v.GetImageCacheRecord(tile.MainIndex, tile.SubIndex, tile.Orientation)
|
img := v.GetImageCacheRecord(tile.MainIndex, tile.SubIndex, tile.Orientation)
|
||||||
if img == nil {
|
if img == nil {
|
||||||
img = v.generateWallCache(tile)
|
img = v.generateWallCache(tile)
|
||||||
|
if img == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tileData := v.getTile(int32(tile.MainIndex), int32(tile.SubIndex), int32(tile.Orientation))
|
tileData := v.getTile(int32(tile.MainIndex), int32(tile.SubIndex), int32(tile.Orientation))
|
||||||
if tileData == nil {
|
if tileData == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user