|
|
@ -1,50 +1,51 @@
|
|
|
|
ptt_dfstring={}
|
|
|
|
ptt_dfstring={}
|
|
|
|
if(COMPATMODE) then
|
|
|
|
if WINDOWS then
|
|
|
|
ptt_dfstring.ptr={off=4,rtype=DWORD}
|
|
|
|
ptt_dfstring.ptr={off=0,rtype=DWORD}
|
|
|
|
ptt_dfstring.size={off=20,rtype=DWORD}
|
|
|
|
ptt_dfstring.size={off=16,rtype=DWORD}
|
|
|
|
|
|
|
|
ptt_dfstring.alloc={off=20,rtype=DWORD}
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
function ptt_dfstring:getval()
|
|
|
|
ptt_dfstring.ptr={off=0,rtype=DWORD}
|
|
|
|
|
|
|
|
ptt_dfstring.size={off=16,rtype=DWORD}
|
|
|
|
|
|
|
|
ptt_dfstring.alloc={off=20,rtype=DWORD}
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
function ptt_dfstring:getval()
|
|
|
|
|
|
|
|
--print(string.format("GETTING FROM:%x",self.__offset))
|
|
|
|
|
|
|
|
if self.size<16 then
|
|
|
|
|
|
|
|
--print(string.format("GETTING FROM:%x",self.__offset))
|
|
|
|
--print(string.format("GETTING FROM:%x",self.__offset))
|
|
|
|
return string.sub(engine.peekstr(self.__offset),1,self.size)
|
|
|
|
if self.size<16 then
|
|
|
|
else
|
|
|
|
--print(string.format("GETTING FROM:%x",self.__offset))
|
|
|
|
--print(string.format("GETTING FROM:%x",self.ptr))
|
|
|
|
return string.sub(engine.peekstr(self.__offset),1,self.size)
|
|
|
|
return string.sub(engine.peekstr(self.ptr),1,self.size)
|
|
|
|
else
|
|
|
|
|
|
|
|
--print(string.format("GETTING FROM:%x",self.ptr))
|
|
|
|
|
|
|
|
return string.sub(engine.peekstr(self.ptr),1,self.size)
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
function ptt_dfstring:setval(newstring)
|
|
|
|
function ptt_dfstring:setval(newstring)
|
|
|
|
local offset=self.__offset
|
|
|
|
local offset=self.__offset
|
|
|
|
local strl=string.len(newstring)
|
|
|
|
local strl=string.len(newstring)
|
|
|
|
if strl<16 then
|
|
|
|
if strl<16 then
|
|
|
|
--print(string.format("GETTING FROM:%x",self.__offset))
|
|
|
|
--print(string.format("GETTING FROM:%x",self.__offset))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
engine.poked(offset+ptt_dfstring.size.off,strl)
|
|
|
|
engine.poked(offset+ptt_dfstring.size.off,strl)
|
|
|
|
engine.poked(offset+ptt_dfstring.alloc.off,15)
|
|
|
|
engine.poked(offset+ptt_dfstring.alloc.off,15)
|
|
|
|
engine.pokestr(offset,newstring)
|
|
|
|
engine.pokestr(offset,newstring)
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
local loc
|
|
|
|
|
|
|
|
if engine.peekd(offset+ptt_dfstring.alloc.off) > strl then
|
|
|
|
|
|
|
|
loc=engine.peekd(offset)
|
|
|
|
|
|
|
|
print("Will fit:"..loc.." len:"..strl)
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
loc=Allocate(strl+1)
|
|
|
|
local loc
|
|
|
|
engine.poked(offset+ptt_dfstring.alloc.off,strl)
|
|
|
|
if engine.peekd(offset+ptt_dfstring.alloc.off) > strl then
|
|
|
|
print("Will not fit:"..loc.." len:"..strl)
|
|
|
|
loc=engine.peekd(offset)
|
|
|
|
|
|
|
|
print("Will fit:"..loc.." len:"..strl)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
loc=Allocate(strl+1)
|
|
|
|
|
|
|
|
engine.poked(offset+ptt_dfstring.alloc.off,strl)
|
|
|
|
|
|
|
|
print("Will not fit:"..loc.." len:"..strl)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--print(string.format("GETTING FROM:%x",self.ptr))
|
|
|
|
|
|
|
|
engine.poked(self.__offset+ptt_dfstring.size.off,strl)
|
|
|
|
|
|
|
|
engine.pokestr(loc,newstring)
|
|
|
|
|
|
|
|
engine.poked(self.__offset,loc)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
--print(string.format("GETTING FROM:%x",self.ptr))
|
|
|
|
end
|
|
|
|
engine.poked(self.__offset+ptt_dfstring.size.off,strl)
|
|
|
|
else
|
|
|
|
engine.pokestr(loc,newstring)
|
|
|
|
--ptt_dfstring.ptr={off=0,rtype=DWORD}
|
|
|
|
engine.poked(self.__offset,loc)
|
|
|
|
function ptt_dfstring:getval()
|
|
|
|
|
|
|
|
return engine.peekstr_stl(self.__offset)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--if(COMPATMODE) then
|
|
|
|
--if(COMPATMODE) then
|
|
|
|
--ptr_vector={}
|
|
|
|
--ptr_vector={}
|
|
|
|
--ptr_vector.st={off=4,rtype=DWORD}
|
|
|
|
--ptr_vector.st={off=4,rtype=DWORD}
|
|
|
@ -173,7 +174,7 @@ local posoff=VersionInfo.getGroup("Creatures"):getGroup("creature"):getOffset("p
|
|
|
|
ptr_Creature.x={off=posoff,rtype=WORD} --ok
|
|
|
|
ptr_Creature.x={off=posoff,rtype=WORD} --ok
|
|
|
|
ptr_Creature.y={off=posoff+2,rtype=WORD} --ok
|
|
|
|
ptr_Creature.y={off=posoff+2,rtype=WORD} --ok
|
|
|
|
ptr_Creature.z={off=posoff+4,rtype=WORD} --ok
|
|
|
|
ptr_Creature.z={off=posoff+4,rtype=WORD} --ok
|
|
|
|
ptr_Creature.flags={off=224,rtype=ptt_dfflag.new(10)}
|
|
|
|
ptr_Creature.flags={off=VersionInfo.getGroup("Creatures"):getGroup("creature"):getOffset("flags1"),rtype=ptt_dfflag.new(10)}
|
|
|
|
ptr_Creature.name={off=0,rtype=ptt_dfstring}
|
|
|
|
ptr_Creature.name={off=0,rtype=ptt_dfstring}
|
|
|
|
ptr_Creature.ID={off=252,rtype=DWORD} --ok i guess
|
|
|
|
ptr_Creature.ID={off=252,rtype=DWORD} --ok i guess
|
|
|
|
ptr_Creature.followID={off=592,rtype=DWORD} --ok
|
|
|
|
ptr_Creature.followID={off=592,rtype=DWORD} --ok
|
|
|
|