04-18-2003, 04:54 AM
(This post was last modified: 04-18-2003, 06:02 AM by hakai_no_tenshi.)
Hi jarulf,
I just tried to use the PRNG and it always returned zero ... might it have something to do with
You declare x as an unsigned int but test for a negative number ?? Also, i really don't know how to read assembly but why is eax being accessed when nothing has been pushed into it?
--T
edit: Also, would you know how the 32 bit hireling ID works? Apparently, setting this to a random number and correctly setting the other parameters like experience, table index and so on will result in the first mercenary in hireling.txt being chosen with the experience you set.
I just tried to use the PRNG and it always returned zero ... might it have something to do with
Quote:#pragma warning( disable : 4035 ) // avoids warning for not returning any value
__declspec( naked ) unsigned int __fastcall d2rnd(struct seeddata *ptseed, unsigned int x)
{
__asm
{
push edi;
push esi;
push ebx;
mov edi,edx;
mov esi,ecx; // no check on pointer!!
test edi,edi; // check if x>0
jg OK;
xor eax,eax; // return 0 if x <= 0
jmp END;
OK:
You declare x as an unsigned int but test for a negative number ?? Also, i really don't know how to read assembly but why is eax being accessed when nothing has been pushed into it?
--T
edit: Also, would you know how the 32 bit hireling ID works? Apparently, setting this to a random number and correctly setting the other parameters like experience, table index and so on will result in the first mercenary in hireling.txt being chosen with the experience you set.