Problems will blitimagescreen and memalloc ???
Hey all....well Sunday I started working on a Helicopter for PSP, thinking it was going to be a walk in the park...yeah right :P Although I have strong theory, putting it into practice has been another thing entirely....well not really...
I've run into a problem where everytime a certain function is run, it messes up the display, then when it's run again it fixes it...the situation so far is...
Everything was kind of working smooth, using an array of set buildings and blitimagetoscreen...if not a little slower then expected it would work for awhile, then freeze....I was about to post on that when I decided to switch from using arrays to linked lists, as then I could have a dynamic amount of buildings per level....well this was the first time i've ever used linked lists, so I read for a day, then came back today and insterted linked lists....
now, everything kinda works it's just everytime the function to creat a new building (a new node in the linked list) it screws up the display, then the next time a new building is created it works again...
here is the function...
The tutorial that I mainly followed was for c++ I guess, as it used a 'new' operator to create a node, instead of memalloc() and then a 'delete' operator instead of free();....(edit:reading some more I think those are java operators ??) the psp-sdk doesn't recognize those, so I looked up how to do it in c and it's to use memalloc...
srand(sceKernelLibcTime((void *) 0));
firstbuilding = malloc( sizeof(struct building) );
lastbuilding = firstbuilding;
lastbuilding->next = malloc( sizeof(struct building) );
lastbuilding->next->previous = lastbuilding;
lastbuilding = lastbuilding->next;
lastbuilding->next = NULL;
lastbuilding->curx = 480;
lastbuilding->cury = 272;
lastbuilding->buildwdth = random(40) + 30;
lastbuilding->buildhgth = random(200) + 35;
lastbuilding->offscreen = 0;
lastbuilding->movespeed = playerone.level;
Now, is the memory that memalloc is setting aside for the linked list somehow effecting the video memory ? and if so is there a way to limit this, or to specify a location that won't interfere with the display ??
I'll attach what I have so far as well, formated for 1.5's...