Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
GetDefeatedEnemyCount.inc.c
Go to the documentation of this file.
1#include "common.h"
2
3API_CALLABLE(N(GetDefeatedEnemyCount)) {
4 Bytecode* args = script->ptrReadPos;
5 EncounterStatus* encounterStatus = &gCurrentEncounter;
6 s32 enemyCount = 0;
7 s32 i, j;
8
9 for (i = 0; i < encounterStatus->numEncounters; i++) {
10 Encounter* temp = encounterStatus->encounterList[i];
11 if (temp == NULL) {
12 continue;
13 }
14 for (j = 0; j < temp->count; j++) {
15 if (temp->enemy[j] != NULL) {
16 enemyCount++;
17 }
18 }
19 }
20
21 evt_set_variable(script, *args++, enemyCount);
22 return ApiStatus_DONE2;
23}
#define ApiStatus_DONE2
Definition evt.h:118
s32 Bytecode
Definition evt.h:7
s32 evt_set_variable(Evt *script, Bytecode var, s32 value)
Definition evt.c:1847
Encounter * encounterList[24]
Definition npc.h:392
s8 numEncounters
Definition npc.h:384
Enemy * enemy[16]
Definition npc.h:352
s32 count
Definition npc.h:351
EncounterStatus gCurrentEncounter
Definition encounter.c:176