Linux support for onfunction/Die.

develop
Warmist 2011-08-21 16:27:01 +03:00
parent 246f704c68
commit 78ed7d314b
3 changed files with 48 additions and 40 deletions

@ -84,6 +84,8 @@ engine.peekb=Process.readByte
engine.pokeb=Process.writeByte
engine.peekw=Process.readWord
engine.pokew=Process.writeWord
engine.peekstr_stl=Process.readSTLString
engine.pokestr_stl=Process.writeSTLString
engine.peekstr=Process.readCString
--engine.pokestr=Process.readCString
engine.peekarb=Process.read

@ -1,6 +1,11 @@
mypos=engine.getmod("functions")
function DeathMsg(values)
local name
if WINDOWS then
name=engine.peek(values.edi,ptt_dfstring)
else
name=engine.peek(values.ebx,ptt_dfstring)
end
print(name:getval().." died")
end
if mypos then
@ -14,7 +19,7 @@ else
else
--onfunction.AddFunction(0x0899be82+offsets.base(),"Move") -- found out by attaching watch...
onfunction.AddFunction(0x899befe+offsets.base(),"Move") -- found out by attaching watch...
onfunction.AddFunction(0x850eecd+offsets.base(),"Die") -- same
end
onfunction.SetCallback("Die",DeathMsg)
end

@ -1,13 +1,9 @@
ptt_dfstring={}
if(COMPATMODE) then
ptt_dfstring.ptr={off=4,rtype=DWORD}
ptt_dfstring.size={off=20,rtype=DWORD}
else
if WINDOWS then
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
@ -44,7 +40,12 @@ function ptt_dfstring:setval(newstring)
engine.poked(self.__offset,loc)
end
end
else
--ptt_dfstring.ptr={off=0,rtype=DWORD}
function ptt_dfstring:getval()
return engine.peekstr_stl(self.__offset)
end
end
--if(COMPATMODE) then
--ptr_vector={}
--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.y={off=posoff+2,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.ID={off=252,rtype=DWORD} --ok i guess
ptr_Creature.followID={off=592,rtype=DWORD} --ok