Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
CheckMagikoopaCastTarget.inc.c
Go to the documentation of this file.
1#include "battle/battle.h"
2
3API_CALLABLE(N(CheckMagikoopaCastTarget)) {
4 Bytecode* args = script->ptrReadPos;
5 Actor* actor;
6
7 s32 actorID = evt_get_variable(script, *args++);
8
9 if (actorID == ACTOR_SELF) {
10 actorID = script->owner1.enemyID;
11 }
12
13 actor = get_actor(actorID);
14
15 switch (actor->actorType) {
16 case ACTOR_TYPE_MAGIKOOPA:
17 case ACTOR_TYPE_FLYING_MAGIKOOPA:
18 case ACTOR_TYPE_MAGICLONE:
19 case ACTOR_TYPE_FLYING_MAGICLONE:
20 case ACTOR_TYPE_RED_MAGIKOOPA:
21 case ACTOR_TYPE_FLYING_RED_MAGIKOOPA:
22 case ACTOR_TYPE_GREEN_MAGIKOOPA:
23 case ACTOR_TYPE_FLYING_GREEN_MAGIKOOPA:
24 case ACTOR_TYPE_YELLOW_MAGIKOOPA:
25 case ACTOR_TYPE_FLYING_YELLOW_MAGIKOOPA:
26 case ACTOR_TYPE_GRAY_MAGIKOOPA:
27 case ACTOR_TYPE_FLYING_GRAY_MAGIKOOPA:
28 case ACTOR_TYPE_WHITE_MAGIKOOPA:
29 case ACTOR_TYPE_FLYING_WHITE_MAGIKOOPA:
30 case ACTOR_TYPE_UNUSED_5B:
31 case ACTOR_TYPE_UNUSED_5C:
32 case ACTOR_TYPE_UNUSED_5D:
33 case ACTOR_TYPE_UNUSED_5E:
34 case ACTOR_TYPE_UNUSED_5F:
35 case ACTOR_TYPE_UNUSED_60:
36 case ACTOR_TYPE_UNUSED_61:
37 case ACTOR_TYPE_UNUSED_62:
38 case ACTOR_TYPE_UNUSED_63:
39 case ACTOR_TYPE_UNUSED_64:
40 evt_set_variable(script, *args++, -1);
41 break;
42
43 case ACTOR_TYPE_DRY_BONES:
44 if (actor->state.varTable[AVAR_DryBones_Collapsed] == 1) {
45 evt_set_variable(script, *args++, -1);
46 break;
47 }
48 default:
49 evt_set_variable(script, *args++, 0);
50 }
51
52 return ApiStatus_DONE2;
53}
ActorState state
@ ACTOR_SELF
Definition enums.h:2084
#define ApiStatus_DONE2
Definition evt.h:118
s32 Bytecode
Definition evt.h:7
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1690
s32 evt_set_variable(Evt *script, Bytecode var, s32 value)
Definition evt.c:1847
Actor * get_actor(s32 actorID)
Definition actor_api.c:155
@ AVAR_DryBones_Collapsed
Definition battle.h:100