GadgetUK Posted December 1, 2012 Share Posted December 1, 2012 Hi, Am I missunderstanding what tgi_clear does? I thought it just cleared the back buffer? I've found that if I have a call to tgi_clear in my init() code, and then have it my screen drawing routine at the start I cannot output sprites? If I just leave the instance in the init() code it then outputs sprites, but obviously I am not clearing the back buffer so I just end up blitting images over existing back buffer. Quote Link to comment Share on other sites More sharing options...
GadgetUK Posted December 1, 2012 Author Share Posted December 1, 2012 I am wondering if this is related to collision detection or something? Or perhaps a bug in the latest snapshot build? Quote Link to comment Share on other sites More sharing options...
+karri Posted December 1, 2012 Share Posted December 1, 2012 I checked all the sprites in the tgi-driver. They did not have space for collision detection in them so perhaps the sprite itself got corrupted in same cases. Now I added a collision byte to all places where sprites are used. This should take care of problems. Quote Link to comment Share on other sites More sharing options...
GadgetUK Posted December 1, 2012 Author Share Posted December 1, 2012 I think I am going to have to wait for the next snapshot or something... I've reverted to the Feb 2012 official release of CC65 and the same problem exists in the older version, and I gave myself more headaches having to include <stddef.h> prior to 6502.h (luckily someone had the problem here on another thread), and then it couldnt find the constants for BPP_4 because for some reason _suzy.h wasnt included somewhere where it was in snapshot build I had been using, then I couldnt include it because the underscore character isn't the standard underscore from whatever characterset windows uses - took me a while to work out why the hell it wouldnt include lol (ended up copying and pasting the actual file name into VS window). I went into SVN and started doing a checkout - it died after 2 minutes =/ Starting to think the Lynx doesnt want me coding on it lol Quote Link to comment Share on other sites More sharing options...
GadgetUK Posted December 1, 2012 Author Share Posted December 1, 2012 (edited) Is it possible this is a C stack problem? I've got a switch statement in main(void) basically, to run the procedure related to the 'mode' I am in - eg. title_screen(), game(), game_over(). Just wondering if the constant calls to a procedure and then falling back into main is doing something related to sprite handling? Edited December 1, 2012 by GadgetUK Quote Link to comment Share on other sites More sharing options...
GadgetUK Posted December 1, 2012 Author Share Posted December 1, 2012 (edited) I checked all the sprites in the tgi-driver. They did not have space for collision detection in them so perhaps the sprite itself got corrupted in same cases. Now I added a collision byte to all places where sprites are used. This should take care of problems. What exactly do I need in order to test the code you've done today? I had a look at SVN and it seems to be the source of CC65 and I really dont want to have to setup yet another make file and project to compile the actual development tools lol. Is there a compiled lib file or something I can download from somewhere? EDIT: This gets stranger... This is how i've got the code at the moment:- //clear //tgi_clear(); //draw sprites tgi_sprite(&titlesprite); tgi_setcolor(COLOR_WHITE); tgi_outtextxy(30, 48, "TITLE SCREEN"); //update display tgi_updatedisplay(); If I uncomment out the tgi_clear() the sprite doesnt appear, only the text does. If I comment out the tgi_outtextxy then the sprite doesnt appear? EDIT: Ignore what I said about _suzy btw, I think I was spelling it wrong or something stupid. Edited December 1, 2012 by GadgetUK Quote Link to comment Share on other sites More sharing options...
+karri Posted December 1, 2012 Share Posted December 1, 2012 (edited) This sounds as you would compile with the wrong configuration file. You should use "-C lynx-coll.cfg" in case you run collision detection. It is also a good idea to add "-m game.map" to generate the memory map for closer examination. Or you could zip the sources and send them to me... Edited December 1, 2012 by karri Quote Link to comment Share on other sites More sharing options...
LX.NET Posted December 1, 2012 Share Posted December 1, 2012 (edited) What exactly do I need in order to test the code you've done today? I had a look at SVN and it seems to be the source of CC65 and I really dont want to have to setup yet another make file and project to compile the actual development tools lol. Is there a compiled lib file or something I can download from somewhere? EDIT: This gets stranger... This is how i've got the code at the moment:- //clear //tgi_clear(); //draw sprites tgi_sprite(&titlesprite); tgi_setcolor(COLOR_WHITE); tgi_outtextxy(30, 48, "TITLE SCREEN"); //update display tgi_updatedisplay(); If I uncomment out the tgi_clear() the sprite doesnt appear, only the text does. If I comment out the tgi_outtextxy then the sprite doesnt appear? EDIT: Ignore what I said about _suzy btw, I think I was spelling it wrong or something stupid. You do a wait for the TGI to finish drawing, right? With a loop on tgi_busy(). Also, for your sprites being messed up as you reported earlier in another thread: I noticed that you used the LITERAL constant. Do you generate your sprite data with sprpck.exe with the literal switch? Normally for sprites you would use the packed format, because well ... it's packed and smaller. Unless there are special reason to use a literal (I used a literal sprite for the hero in TLA, so I could edit the sprite data easily and give him flipflops, a crown and deathstar pixels). Edited December 1, 2012 by LX.NET Quote Link to comment Share on other sites More sharing options...
GadgetUK Posted December 2, 2012 Author Share Posted December 2, 2012 It's only a test project and the code is now all over the place as ive commented out various bits, moved stuff back into the main proc etc. I've tried adding while tgi_busy while loops all over the place, before a clear, before sprite etc, it seems to make no difference at all. http://www.c5software.co.uk/downloads/Starter.zip I am starting to think its a make issue. Quote Link to comment Share on other sites More sharing options...
+karri Posted December 2, 2012 Share Posted December 2, 2012 Hi GadgetUK, I checked your sources and for a reason I cannot explain the system does not work if the sprites are defined without scaling. This may be a Handy bug also. In any case, please use the sprites with REHV instead of RENONE. sprite_simple titlesprite = { BPP_4 | TYPE_NORMAL, PACKED | REHV, 0x01, 0x0000, &titlescreen, 0, 0, 256, 256 }; The only other bug I found was that you should use " instead of <> for local includes. like #include <joystick.h> #include "constants.h" #include <stdlib.h> -- Karri Quote Link to comment Share on other sites More sharing options...
GadgetUK Posted December 2, 2012 Author Share Posted December 2, 2012 Thanks!! I will give it a go now! Quote Link to comment Share on other sites More sharing options...
GadgetUK Posted December 2, 2012 Author Share Posted December 2, 2012 Thank you ever so much for your patience!! I've had a few moron moments at the start of this development =/... I've just worked out something else that was causing me problems... I had been struggling to output a second sprite (target) and the reason is I was passing the bitmap instead of the sprite to tgi_sprite... doh... In addition i've implemented my sprites like this now, using the existing struct (type REHV) and it works a treat! Took me a min to work out the scaling is 0 to 255 but this is great. SCB_REHV titlesprite = { BPP_4 | TYPE_NORMAL, PACKED | REHV, 0x01, 0x0000, &titlescreen[0], 0, 0, 0xFF, 0xFF }; The level of my development skills are a LONG way below the likes of yourself, LX.NET and Sage etc, so please bare with me =) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.