npc : Fix NPC_STACK_SIZE qui était trop gros pour fx

This commit is contained in:
attilavs2 2024-08-01 18:34:36 +02:00
parent 5cc9216155
commit a8ff55c1cf
2 changed files with 7 additions and 3 deletions

View file

@ -22,6 +22,9 @@
/* The size of the player */ /* The size of the player */
#define P_WIDTH 16 #define P_WIDTH 16
#define P_HEIGHT 16 #define P_HEIGHT 16
/*Max number of dynamic NPCs.*/
#define NPC_STACK_SIZE 256
#else #else
/* The tile size */ /* The tile size */
#define T_HEIGHT 8 #define T_HEIGHT 8
@ -32,6 +35,9 @@
/* The player size */ /* The player size */
#define P_WIDTH 8 #define P_WIDTH 8
#define P_HEIGHT 8 #define P_HEIGHT 8
/*Max number of "dynamic" NPCs. We are starved for static ram on fx !*/
#define NPC_STACK_SIZE 32
#endif #endif
/* SPEED should NOT be 8 or bigger: it may cause bugs when handling /* SPEED should NOT be 8 or bigger: it may cause bugs when handling

View file

@ -16,13 +16,11 @@ extern bopti_image_t tiny_npc_female;
extern bopti_image_t tiny_npc_milkman; extern bopti_image_t tiny_npc_milkman;
extern bopti_image_t tiny_npc_police; extern bopti_image_t tiny_npc_police;
#define NPC_STACK_SIZE 256
NPC npc_stack[NPC_STACK_SIZE]; NPC npc_stack[NPC_STACK_SIZE];
uint32_t npc_count; uint32_t npc_count;
NPC *npc_create() { NPC *npc_create() {
if(npc_count == 256) if(npc_count == NPC_STACK_SIZE)
return NULL; return NULL;
return &npc_stack[npc_count++]; return &npc_stack[npc_count++];