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
3
API_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
}
ApiStatus_DONE2
#define ApiStatus_DONE2
Definition
evt.h:118
Bytecode
s32 Bytecode
Definition
evt.h:7
evt_set_variable
s32 evt_set_variable(Evt *script, Bytecode var, s32 value)
Definition
evt.c:1847
EncounterStatus::encounterList
Encounter * encounterList[24]
Definition
npc.h:392
EncounterStatus::numEncounters
s8 numEncounters
Definition
npc.h:384
Encounter::enemy
Enemy * enemy[16]
Definition
npc.h:352
Encounter::count
s32 count
Definition
npc.h:351
gCurrentEncounter
EncounterStatus gCurrentEncounter
Definition
encounter.c:176
Encounter
Definition
npc.h:350
EncounterStatus
Definition
npc.h:365
src
world
common
util
GetDefeatedEnemyCount.inc.c
Generated by
1.10.0