Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
StashVars.inc.c
Go to the documentation of this file.
1#include "common.h"
2#include "npc.h"
3
4// remove this and uncomment other when all data from all maps that use this are migrated to C
5extern s32** N(varStash);
6
7API_CALLABLE(N(StashVars)) {
8 //static s32** varTable = NULL;
9 s32 i;
10
11 if (N(varStash) == NULL) {
12 N(varStash) = heap_malloc(sizeof(script->varTable));
13
14 for (i = 0; i < ARRAY_COUNT(script->varTable); i++) {
15 N(varStash)[i] = (s32*) script->varTable[i];
16 }
17 } else {
18 for (i = 0; i < ARRAY_COUNT(script->varTable); i++) {
19 script->varTable[i] = (s32) N(varStash)[i];
20 }
21
22 heap_free(N(varStash));
23 N(varStash) = NULL;
24 }
25
26 return ApiStatus_DONE2;
27}
#define ApiStatus_DONE2
Definition evt.h:118
s32 heap_free(void *ptr)
Definition heap.c:42
void * heap_malloc(s32 size)
Definition heap.c:34
#define ARRAY_COUNT(arr)
Definition macros.h:40