improve terror zone
This commit is contained in:
@@ -5,14 +5,20 @@ import (
|
||||
)
|
||||
|
||||
func (gd *GameReader) TerrorZones() (areas []area.ID) {
|
||||
const maxActiveZoneCount = 16
|
||||
|
||||
structPtr := gd.moduleBaseAddressPtr + gd.offset.TZ
|
||||
zonesPtr := uintptr(gd.ReadUInt(structPtr, Uint64))
|
||||
actualActiveZoneCount := int(gd.ReadUInt(structPtr+0x8, Uint8))
|
||||
if zonesPtr == 0 || actualActiveZoneCount <= 0 || actualActiveZoneCount > maxActiveZoneCount {
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < actualActiveZoneCount; i++ {
|
||||
tzArea := gd.ReadUInt(zonesPtr+uintptr(i*Uint32), Uint32)
|
||||
if tzArea != 0 {
|
||||
areas = append(areas, area.ID(tzArea))
|
||||
id := area.ID(tzArea)
|
||||
if id.CanBeTerrorized() {
|
||||
areas = append(areas, id)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user