Path: chuka.playstation.co.uk!news From: yaroze@theburrow.co.uk (Barry & Robert Swan) Newsgroups: scee.yaroze.beginners Subject: Re: Collision Detection!.....(Joy) Date: Thu, 24 Jun 1999 23:05:10 GMT Organization: PlayStation Net Yaroze (SCEE) Lines: 43 Message-ID: <3772b870.14958289@www.netyaroze-europe.com> References: <7kdntq$4fj13@chuka.playstation.co.uk> <376d3500.12938268@www.netyaroze-europe.com> <7kqf2d$qpv1@chuka.playstation.co.uk> <7kruf5$qpv9@chuka.playstation.co.uk> NNTP-Posting-Host: pF8s07a01.client.global.net.uk X-Newsreader: Forte Free Agent 1.11/32.235 in the example I was assuming that the 4bit sprite you were using had colour 0 as the only one you didnt want to be represented by a 1 in the 1bit mask. lets look at converting a 4bit pixel to 1bit. if 4bit pixel = 0 then 1bit = 0, " 4bit " = 1 then 1bit = 1, " 4bit " = 2 then 1bit = 1, " 4bit " = 3 then 1bit = 1, " 4bit " = 4 then 1bit = 1, " 4bit " = 5 then 1bit = 1, etc.. an easier check for all that is (if 4bit pixel & 0xf) which will mask of the 4bits from (in my example) an 8bit u_char. However, it returns a value of 1-15 for a 'coloured' pixel, so by using the NOT function twice, it converrts any non zero value to 1 (which is what we want for the 1bit mask). The shifting at the end is merely to set the correct bit of the mask. Ie for the first pixel, you dont want to shift at all, for the second pixel you want to shift by one etc,etc... if you do the example on paper it might help clarify things. Then again, maybe not :) My thanks to the wierd guy at Sony who left a !! in some code that we looked at, and made us wonder what the hell he was doing...! Rob On Thu, 24 Jun 1999 00:35:42 +0100, "Scott Ward" wrote: >Moving away from this subject slightly maybe somebody could explain this to >me: > >>maskPointer |= !!(imageData & 0x0f) << maskBit; >>maskPointer |= !!(imageData & 0xf0) << (maskBit+1); > >Rob Swan wrote this, can someone please tell me what the '!!' part means?