Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - BIG PROBLEM!!

BIG PROBLEM!!

Discuss topics that apply across the products, such as the PocketC language, or development in general

Postby md_lasalle on Wed Jan 22, 2003 2:22 am

Hi, my problem is simple but the solution...i didn't found one yet

I'm creating a game (Zelda type of game) that uses a scratch buffer of 320x320...
For my collision detection with the trees,houses and everything i couldn't use a mask cause creating another 320x320 buffer for the mask used too much memory and program crashed, instead i created a little function that gets the pixel color in front of my caracter depending on the direction he's looking at...
GetPixel(hero_x,hero_y);
If the pixel is 255(black) he does not move, else he moves
my Function works great but something strange happens when the hero_y gets around 220... only when i go up, the hero doesn't move even if all the pixel are white!! I've tested it with a white 160x160 image for my map... the hero is always stock at the same place, like if they were invisible objects! but what strange is that in this bottom part of the 320x320 buffer, even if pixels are black he walks, and when im in the upper side of the buffer everything works great...

If someone wants my source code NO PROBLEM at all just e-mail me...
I'll give any credit to the person who helps me...
md_lasalle
 
Posts: 74
Joined: Fri Dec 20, 2002 12:26 am
Location: Canada

Postby jstadolnik on Wed Jan 22, 2003 2:55 am

Are you running on a Sony OS4 device or one of the new OS5 devices?

If you are using the former, read through the caveats listed in the Sony() function. Basically it says that some graphics functions, GetPixel included, don't work quite right in 320x320 hi-res mode. This is because I sparingly use the Sony graphics API's in order to keep the size of the library down.

What's happening is that GetPixel always works as if the screen is still 160x160 even if the resolution is 320x320. GetPixel actually returns the upper-left corner pixel value for the given location.

For example, if you do GetPixel(140,120), you are actually reading the hi-res pixel (280,240).

So the trick should be to halve the coordinate values you feed to GetPixel when in Sony hi-res mode.

GetPixel should however work as expected on hi-res OS5 devices.

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby md_lasalle on Wed Jan 22, 2003 2:48 pm

I'm not using a sony device... i only use a palm m130...
i always do a getpixel in a buffer of 320x320... but whats on the screen is always 160x160

do you think that GetPixel doesnt work properly in a 320x320 buffer?
md_lasalle
 
Posts: 74
Joined: Fri Dec 20, 2002 12:26 am
Location: Canada

Postby jstadolnik on Wed Jan 22, 2003 3:44 pm

If this 320x320 buffer is the draw buffer and GetPixel() is not working beyond say a Y coordinate of 200 then this is definitely a PalmOS bug. All GetPixel() does is execute a palmOS API function called WinGetPixel() and return its result.

I suspect that the WinGetPixel call is using an UInt16 (unsigned 16 bit integer) in it's window offset calculation. If this assumption is correct, then WinGetPixel can at best handle scratch buffers of 65k bytes in size (2^16 = 65536).

Assuming that you are using an 8 bit color mode, which means 1 byte per pixel... if you divide 65536 by 320 (the width of your buffer) you get 204... which would be max Y coordinate possible before things get wacky. Sounds about right doesn't it? [:0]

So I'd say that you've stumbled onto a palmOS limitation/bug with the WinGetPixel API. If it's any consolation, you'd have the same problem regardless of what development platform you use because this is a palmOS issue. Though I have an idea for a fix involving an internal "hack"...

Out of curiosity, what happens on the PalmOS Simulator?

Joe



The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby md_lasalle on Wed Jan 22, 2003 3:57 pm

I didn't try the simulator... i tried it directly on the Palm

what is the little "hack" you're talking about?
'cause i really need this because this is my only way to make my collision detection... ya know... because i can't use masks, or perhaps you know a solution for me to get masks working...
md_lasalle
 
Posts: 74
Joined: Fri Dec 20, 2002 12:26 am
Location: Canada

Postby jstadolnik on Wed Jan 22, 2003 4:25 pm

It would involve me making the library override the default WinGetPixel call with my own version using the same technique that standard "hacks" employ.

I'm not aware of any "hack" (as in X-master & such) applications that currently patch this problem.

Have you looked at the BmpBackColl and BmpBmpColl functions?

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby md_lasalle on Wed Jan 22, 2003 4:35 pm

if i use BmpRectColl(int x1, int y1, int mask_index1, int x2, int y2, int mask_index2) first set second set

is the mask_index1 would be a mask for my caracter?

and why is there 2 sets of x1,y1??
md_lasalle
 
Posts: 74
Joined: Fri Dec 20, 2002 12:26 am
Location: Canada

Postby jstadolnik on Wed Jan 22, 2003 5:05 pm

This function uses the mask indexes to extract the width and height of the two bitmaps. Then it uses this information along with the provided coordinates (x1,y1,x2, & y2) to determine if the two rectangles overlap, if so a collision is returned. No bit collision checks occur with this function.

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby md_lasalle on Thu Jan 23, 2003 4:16 pm

I solved my problem by changing the depth from 8 to 5...
and i got a lot more heap memory this way... thanks anyway Joe...
md_lasalle
 
Posts: 74
Joined: Fri Dec 20, 2002 12:26 am
Location: Canada

Postby jstadolnik on Thu Jan 23, 2003 6:30 pm

Yeah, 4 bit graphics is really the way to go for games. The graphics draw faster too due to fewer bits being pushed around.

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron