Get a negative value from a WORD. by RonsWare21st Apr 2012 10:39
|
---|
Summary The function below gets a' negative value like -512 from a WORD. This function is written thank's to the help of WLGfx. He is the best. Description I am working on a map editor voor WAD files. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com `Thanks to WLGfx this function is written. global outint as integer x1 = 0xfe00 ` -512 First x,y coord. y1 = 0x0060 ` 96 x2 = 0xffe0 ` -32 Second x,y coord. y2 = 0x0060 ` 96 print x1 ` Before. print y1 print x2 print y2 MakeInt16( x1 ) x1 = outint MakeInt16( y1 ) y1 = outint MakeInt16( x2 ) x2 = outint MakeInt16( y2 ) y2 = outint print x1 ` After. print y1 print x2 print y2 do loop end function MakeInt16( inword as word ) if (inword and 0x8000) outint = inword or 0xffff0000 else outint=inword endif endfunction |