Omnimaga
Calculator Community => Other Calc-Related Projects and Ideas => TI-Nspire => Topic started by: Spenceboy98 on May 20, 2013, 12:40:51 am
-
This is a port of my Prizm game Zombie Chase.
Here is some screenies:
(http://oi42.tinypic.com/e99cpd.jpg)
(http://oi41.tinypic.com/n4vzpc.jpg)
The problem is, is that it reboots the calc every time you exit.
This is the code it does when the while loop breaks:
free(screen);
return 0;
The screen variable is:
screen = (char*)malloc(SCREEN_BYTES_SIZE * sizeof(char));
I hope you can help so that I can get this uploaded for you to enjoy(or dislike :P).
-
I think it reboots after the return, possibly because you wrote data out of the malloc-ed memory somewhere earlier in the program, thus overwriting some informations needed by the OS.
-
Hi Spenceboy98,
A couple of tips I've learned that may be able to help:
1. After free; you can set your pointer to NULL:
free(screen);
screen = NULL;
return 0;
And so I suggest for every free to set the pointer to NULL. Because should you call free again on the same pointer, free(NULL) won't crash! See the C standard 7.20.3.2: http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1124.pdf
But that may be an indication that you are freeing the same memory twice.
2. Are you using an emulator or only transferring to your calculator? I only say because if you use an emulator; besides being faster you can add printf (amongst other things) to see the values of variables:
printf("Screen pointer is at address %p\n", screen);
3. Are you using anything for the graphics? That is entirely your choice; but nRGBLib (http://ourl.ca/14731) is really helpful! In there is a macro:
#define GetNewScreenBuffer() malloc(SCREEN_BYTES_SIZE)
(https://bitbucket.org/totorigolo/nrgblib/src/9a736d6ff9e432e7e1df2122c03d8b39c05d6dd2/src/include/nCOMMON.h?at=default)
And I am thinking you could use that instead of writing it yourself.
If you post your source code I'll take a look to see why the calculator reboots on exit. I've chased down a few of these now! :)
Have a great day!
-
Hi Spenceboy98,
A couple of tips I've learned that may be able to help:
1. After free; you can set your pointer to NULL:
free(screen);
screen = NULL;
return 0;
And so I suggest for every free to set the pointer to NULL. Because should you call free again on the same pointer, free(NULL) won't crash! See the C standard 7.20.3.2: http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1124.pdf
But that may be an indication that you are freeing the same memory twice.
2. Are you using an emulator or only transferring to your calculator? I only say because if you use an emulator; besides being faster you can add printf (amongst other things) to see the values of variables:
printf("Screen pointer is at address %p\n", screen);
3. Are you using anything for the graphics? That is entirely your choice; but nRGBLib (http://ourl.ca/14731) is really helpful! In there is a macro:
#define GetNewScreenBuffer() malloc(SCREEN_BYTES_SIZE)
(https://bitbucket.org/totorigolo/nrgblib/src/9a736d6ff9e432e7e1df2122c03d8b39c05d6dd2/src/include/nCOMMON.h?at=default)
And I am thinking you could use that instead of writing it yourself.
If you post your source code I'll take a look to see why the calculator reboots on exit. I've chased down a few of these now! :)
Have a great day!
I've tested it on both emulator and calc. I don't really want to post my source, but I'll pm you it, so that you can help.
-
*BUMP*
Working version thanks to ajorians(I had the background filling routine filling too much :P).
Screenies:
(http://i40.tinypic.com/ngvteg.png)
(http://i43.tinypic.com/1znwqyd.png)
Could someone test this on a CX and post some screenshots of those?
Download is attached.
-
*BUMP*
Could someone please test this on a CX? I'd like to see what it looks like. :P
Also, opinions are appreciated. :)
-
Hi Spenceboy98,
I just tested your program and I hit troubles with my CX :(
The first 2 screenshots are what it looked like to me.
Which is strange because I compiled your code and it looked fine (3rd screenshot). I still have the code and can send it. I am thinking that when I compiled and ran your code compared to this version it seems like the filesize increased a lot (4th screenshot; the version I got working is the smaller filesize).
Hope that helps. Holler if I can be of any more help. And have a great day!
-
You need either to use lcd_ingray or lcd_incolor according to is_cx :
http://hackspire.unsads.com/wiki/index.php/Libndls#Screen
-
How about now(attached)?
The reason it is bigger than what I showed is because I made it have the color FAIL, which made it a lot bigger. :P
-
*BUMP*
I needs some CX testers please. ;) :P
-
I've tipped people at TI-Planet about it ( http://tiplanet.org/forum/viewtopic.php?f=17&t=11982 ), hopefully this will provide more beta-testers :)
-
I've tipped people at TI-Planet about it ( http://tiplanet.org/forum/viewtopic.php?f=17&t=11982 ), hopefully this will provide more beta-testers :)
Thanks. I hope it will. :)
-
well, it works good on my nspire touchpad but the "points" of the "zombies" are too small
-
Looks nice, is it like Scipi/HOMER-16's computer zombie game? And yeah maybe the points could be a bit larger and there should be a bit of color.
-
Looks nice, is it like Scipi/HOMER-16's computer zombie game? And yeah maybe the points could be a bit larger and there should be a bit of color.
It should work on a CX, but no one has tested my most recent upload.
About the points, do you mean the amount taken off of the health when you get touched by a zombie?
-
I think DJ and Alexis meant that the dots that represents the zombies are a bit too small.
-
Hi Spenceboy98,
I just tested your build from May 24th on my Nspire CX and sadly I still see the 4 screens at the top with white the rest of the way down. I tested it also on my Nspire Touchpad where it looked alright. I hope somebody else is able to help you verify the problem I am seeing on the CX. Since you don't want to share the source code; I can post the graphic3.c/.h, utils.c/.h and the Makefile I used when testing your code. Maybe your version of those files differs than mine. I think this game is great and I'd like to see it working.
Levak: I used lcd_ingray before on a CX. I didn't see on http://hackspire.unsads.com/wiki/index.php/Libndls#Screen saying only when is_cx.
Well have a great day!
-
I think DJ and Alexis meant that the dots that represents the zombies are a bit too small.
yes is that
-
Yeah I meant the zombie sprites.
-
*necrobump*
I finally got around to getting it to work on the CX! :D (after over two years :P)
Made movements faster too! I eventually plan on adding coins to collect and some sort of score system. Enjoy! :D
https://www.cemetech.net/scripts/countdown.php?/nspire/games/ZombieChase.zip