mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 07:55:33 +01:00
Revert "simplify and expand Stage Object indexer"
This reverts commit 19e1eae5e2.
This commit is contained in:
@@ -30,7 +30,7 @@ type Stage struct {
|
|||||||
|
|
||||||
// Objects
|
// Objects
|
||||||
objects map[uint32]*Object
|
objects map[uint32]*Object
|
||||||
objectIndex uint16
|
objectIndex uint8
|
||||||
|
|
||||||
// Map of session -> charID.
|
// Map of session -> charID.
|
||||||
// These are clients that are CURRENTLY in the stage
|
// These are clients that are CURRENTLY in the stage
|
||||||
@@ -56,6 +56,7 @@ func NewStage(ID string) *Stage {
|
|||||||
clients: make(map[*Session]uint32),
|
clients: make(map[*Session]uint32),
|
||||||
reservedClientSlots: make(map[uint32]bool),
|
reservedClientSlots: make(map[uint32]bool),
|
||||||
objects: make(map[uint32]*Object),
|
objects: make(map[uint32]*Object),
|
||||||
|
objectIndex: 0,
|
||||||
rawBinaryData: make(map[stageBinaryKey][]byte),
|
rawBinaryData: make(map[stageBinaryKey][]byte),
|
||||||
maxPlayers: 4,
|
maxPlayers: 4,
|
||||||
}
|
}
|
||||||
@@ -96,10 +97,16 @@ func (s *Stage) isQuest() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Stage) NextObjectID() uint32 {
|
func (s *Stage) NextObjectID() uint32 {
|
||||||
s.objectIndex++
|
s.objectIndex = s.objectIndex + 1
|
||||||
|
// Objects beyond 127 do not duplicate correctly
|
||||||
|
// Indexes 0 and 127 does not update position correctly
|
||||||
|
if s.objectIndex == 127 {
|
||||||
|
s.objectIndex = 1
|
||||||
|
}
|
||||||
bf := byteframe.NewByteFrame()
|
bf := byteframe.NewByteFrame()
|
||||||
bf.WriteUint16(127)
|
bf.WriteUint8(0)
|
||||||
bf.WriteUint16(s.objectIndex)
|
bf.WriteUint8(s.objectIndex)
|
||||||
bf.Seek(0, 0)
|
bf.WriteUint16(0)
|
||||||
return bf.ReadUint32()
|
obj := uint32(bf.Data()[3]) | uint32(bf.Data()[2])<<8 | uint32(bf.Data()[1])<<16 | uint32(bf.Data()[0])<<24
|
||||||
|
return obj
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user