Program compiling issues

Hello people,

Suddenly and out of nowhere, my program decided to assign random values to integers causing problems. Not only that, a state machine/switch case crashes the game IF I added more cases... While being in case 1 ! Right now I can't even add more lines of code or else the game crashes on boot.

What is causing this ? Im using a vanilla SaturnOrbit, with my app ranging from 220kb ~230kb. I haven't made any changes to the environment or anything else, just fine tuning my game and normal programming.

It's really frustrating. Am I running out of space or what ?
Please, HELP! :frown2:
 
No Signed integers whatsoever. I managed to fix the crash in the state machine just now, by changing switch case handle from static int to static Uint8. The crash then decided to hop to ANOTHER unrelated state machine as a result. WTF ?

I usually use this code as a template, do you see anything wrong with it ?

Code:
void PlayerAttack()
{
int logicswitch = 1;
//----------------
	switch(logicswitch)
    {
//----------------
	case	1://Feed the integers values
        P1 = 10 , P2 = 11;
        if (Attackfinished == 2) logicswitch ++;
        break;
//----------------	
	case	2://whatever next happens here
        
        blabla = 1;
        logicswitch ++
        break;
//----------------
	case	3: //End

        break;
//----------------
		default:

			break;
	}
//----------------
}

I noticed that for some reason, the switch handle refused to move to another case if I use int instead of a static int. Any idea why ?

Anyway, will trace it to the bone tomorrow, it's already getting late.
 
Mmmmm. You use a Single int if I'm not wrong the compiler translate this to an Uint32.
My advice, use reserved words from the compiler like Uint32,16,8 etc.

P1, P2, Attackfinished, blabla are statics? 'cause aren't definied inside the function?

At line 16 you are missing a semicolon ;

Keep working :ridinghorse:
 
FacundoARG said:
Mmmmm. You use a Single int if I'm not wrong the compiler translate this to an Uint32.
My advice, use reserved words from the compiler like Uint32,16,8 etc.

P1, P2, Attackfinished, blabla are statics? 'cause aren't definied inside the function?

At line 16 you are missing a semicolon ;

Keep working :ridinghorse:

The complier translate the single integer into a Uint32 ? Hmm...

P1, P2, Attackfinished are define outside and used as an extern int actually, blabla was an example I just used to show what I usually do. Same for the missing semicolon at line 16, as I said this is a template and if I would compiled I woulda get an error stating a missing semicolon and fix it.

Will work on this now and see to where it leads.

However, this reminds me of a nasty thing that happened a few weeks ago where changing a simple int resulted in the whole screen having this Pink or green hue for some reason even when turning of the whole VDP2 functions off and even removing it. I made sure that it's not my Saturn going bad and tried my app on a different consoles all with the same result but somehow managed to disappear once I reverted to the original code and reworked the algorithm differently. But still that shouldn't happen at all because there was no complier errors or crashing in the app.

Guess there's a lot of experimenting to do still...

EDIT : Holy*!&@# your advice actually worked !
Thank you ! Does that mean I should only use reserved words from now on ?
 
Yes, it's better if you use reserved words. For example, you are wasting memory in your code using an Int (Uint32) because you have only 3 values in your switch-case. The correct type is Uint8 (255 posible values)

I'm glad to help you.
 
Back
Top