mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-07 09:07:00 -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
|
||||
}
|
||||
localX := (v.subcellX - v.subcellY) * 16
|
||||
@ -248,7 +248,7 @@ func (v *AnimatedEntity) updateFrameCache() {
|
||||
if v.Cof.CofLayers[cofLayerIdx].Transparent {
|
||||
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)
|
||||
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)
|
||||
if img == nil {
|
||||
img = v.generateWallCache(tile)
|
||||
if img == nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
tileData := v.getTile(int32(tile.MainIndex), int32(tile.SubIndex), int32(tile.Orientation))
|
||||
if tileData == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user