Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / My loader's not working... :(

Author
Message
Mister Fuzzy
13
Years of Service
User Offline
Joined: 27th Feb 2011
Location: XNA
Posted: 5th Nov 2011 02:50
Okay, first off I must say thanks to those who helped me get this far anyway (such as mireben & bigglesworth), but after some extensive trial-and-error, testing, algorithm-writing, brain-toasting and reading documentation; I finished! But it doesn't work. Not satisfactorily, at least. My plan was to load a 24-bit bitmap and write it into memory as a MemBlock, but something went awry. I still seem to have the same problem as before: 16-bit and 32-bit computers both show the loaded tiles differently, and completely wrong! I want the loader to work with both depths, but I can't even get it to work with one! What am I doing wrong?!? BTW: Before you look at the code, note that my system is (going to be) a multi-layer platformer engine. PRINT_SCREEN (void) doesn't do anything yet. Just use PRINT_LAYER ( int Layer ). ) The engine is supposed to extract a BLUE value from the plotter map (IMAGE.bmp), and use whatever value it finds as the tile number to print.

Tunnel vision yet? Have a carrot!

Attachments

Login to view attachments
Mister Fuzzy
13
Years of Service
User Offline
Joined: 27th Feb 2011
Location: XNA
Posted: 6th Nov 2011 18:18
Ah! Hehe... Okay, so ONE problem was fixed... Kind of a stupidity moment: I was trying to check the 0-based XPOS to a 1-based image-made-memblock width value. Oops!

But that still doesn't answer the question of why the memblock is created differently in 16 bit mode! Are the memblocks created to reflect the displayed image or to reflect the actual file? If it reflects the displayed image, how can I get it to read the raw file and not the modified output image??

Tunnel vision yet? Have a carrot!
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 6th Nov 2011 18:56 Edited at: 6th Nov 2011 19:09
I tried your program and the main problem is that your indexing is off by one. If you only correct this line in the PRINT_LAYER function:



to this:



then the displayed image reflects the arrangement on your map. At least I can recognize the pattern all right.

I'm not sure that this is the only problem because to be honest, the program is confusing (for example I had no idea what the "layer" would mean and there are quite a number of global variables) and I had time only for a quick check.

I just wanted to write when I noticed your post above, I'm not sure though if you spotted the same problem or a different one.

Another error I noticed in the CHECK_X and CHECK_Y functions, but these are at present not used anywhere:



You can't do this in C++. The compiler even issues warnings for these lines. You have to write all conditions separately and connect them with "logical and" or "logical or" operators.



I the PRINT_TILE function, erase this line:



It's not needed at all. It's enough to set the frame of the animated sprite and paste it. Also, you do not need to load the image from which you create the animated sprite because the dbCreateAnimatedSprite will load it from the file anyway.

When you zip a project to post it on the forum, please do not include the huge ncb file and the Debug directory. These are generated by the compiler, so they can be regenerated any time and they are not needed to open the project in Visual Studio. They only increase the download size.

I hope this helps somewhat. From tomorrow I don't have internet connection for at least two weeks, so I won't be able to answer more questions for a while.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 6th Nov 2011 19:06
P.S. Having never used memblocks yet myself, I'm not familiar with their structure or whether there is any difference between computers. I tested the program on 64-bit Windows 7.
Mister Fuzzy
13
Years of Service
User Offline
Joined: 27th Feb 2011
Location: XNA
Posted: 9th Nov 2011 02:55 Edited at: 9th Nov 2011 03:01
Yeah, as I said in my second post, I did notice the errors with my X-position indexing...

Quote: "I the PRINT_TILE function, erase this line:
It's not needed at all."


Yes, I am aware that it is not needed for pasting to work: I am using this to allow for dbSpriteCollision() to be used when I get to writing the player's motion and collision code.

As for CHECK_X and CHECK_Y, I've removed the need for those entirely in a later revision. I'm kinda suprised that X > Y > Z doesn't work: It has worked fine for me... Oh well. I guess I won't use it anymore anyway.

Quote: "because to be honest, the program is confusing (for example I had no idea what the "layer" would mean and there are quite a number of global variables)"


Yes... I know my code is REALLY messy... I should have noted that seemingly useless global variables such as "layer" WILL be used, but have not been fully utilized yet. You may have noted that there were three base functions: PRINT_TILE, PRINT_LAYER, and PRINT_SCREEN. Print tile does exactly what you'd expect it to. It prints a tile. PRINT_LAYER prints a 2D array of tiles to make a map. PRINT_SCREEN does nothing for now, but will eventually print a 3D array of layers to form a multi-layered platformer level where the user can swap between layers. Dividing the code was an attempt to keep the code clean, but as you can see that ideal failed miserably.

Thanks for the response, mireben!

Tunnel vision yet? Have a carrot!

Login to post a reply

Server time is: 2024-10-02 21:37:36
Your offset time is: 2024-10-02 21:37:36