Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
Plants2.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects.h"
3#include "entity.h"
4#include "animation_script.h"
5#include "ld_addrs.h"
6#include "sprite/player.h"
7
16
18
40
48
56
58 f32 xOffset, zOffset, angle;
59
60 angle = DEG_TO_RAD(clamp_angle(entity->rot.y));
61 xOffset = -26.0 * cos_rad(angle);
62 zOffset = 6.0 * sin_rad(angle);
63 fx_stars_burst(0, entity->pos.x + xOffset, entity->pos.y + 62.0f, entity->pos.z + zOffset, clamp_angle(entity->rot.y - 90.0), 54.0f, 2);
64}
65
68
70 if (data->numCoins < 3) {
71 f32 xOffset, zOffset, angle;
72
73 angle = DEG_TO_RAD(clamp_angle(entity->rot.y));
74 xOffset = -26.0 * cos_rad(angle);
75 zOffset = 6.0 * sin_rad(angle);
76
77 if (rand_int(32) > 16) {
78 f32 facingAngle = entity->rot.y - 110.0f + (data->numCoins % 3) * 30;
79 data->numCoins++;
80 make_item_entity(ITEM_COIN,
81 entity->pos.x + xOffset,
82 entity->pos.y + 62.0f,
83 entity->pos.z + zOffset,
85 facingAngle, 0);
86 }
87 }
88}
89
91 make_item_entity_nodelay(ITEM_COIN, entity->pos.x, entity->pos.y + 30.0f, entity->pos.z,
93}
94
96 PlayerStatus* playerStatus = &gPlayerStatus;
97
99 Entity* resetMunchlesia;
102 resetMunchlesia = get_entity_by_index(entity->dataBuf.munchlesia->unk_00);
104 exec_entity_commandlist(resetMunchlesia);
105 }
106}
107
113
115 MunchlesiaData* data = entity->dataBuf.munchlesia;
116 data->unk_18 = fabs(dist2D(entity->pos.x, entity->pos.z, gPlayerStatus.pos.x, gPlayerStatus.pos.z) * 0.25);
117 data->unk_14 = atan2(gPlayerStatus.pos.x, gPlayerStatus.pos.z, entity->pos.x, entity->pos.z);
118}
119
128
130 return create_entity(EntityBlueprint, (s32)entity->pos.x, (s32)entity->pos.y, (s32)entity->pos.z, (s32)entity->rot.y);
131}
132
137
141
147
152 gPlayerStatus.flags &= ~PS_FLAG_ACTION_STATE_CHANGED;
153 suggest_player_anim_always_forward(ANIM_MarioW2_FlailArms);
154}
155
159
164
168
172
178
180 MunchlesiaData* data = entity->dataBuf.munchlesia;
181 data->unk_0C = gPlayerStatus.pos.y;
182 data->unk_10 = 0;
183}
184
186 MunchlesiaData* data = entity->dataBuf.munchlesia;
187 gPlayerStatus.pos.y = data->unk_0C + (sin_rad(DEG_TO_RAD(data->unk_10)) * 3.0f);
188
189 data->unk_10 += 24.0f;
190 if (data->unk_10 > 360.0f) {
191 data->unk_10 -= 360.0f;
192 }
193 if (data->unk_10 == 96.0f) {
195 }
196}
197
207
229
238
250
261
270
279
290
302
311
320
321DmaEntry Entity_MunchlesiaReset_dma[] = { ENTITY_ROM(MunchlesiaReset_gfx), ENTITY_ROM(MunchlesiaReset_anim) };
322DmaEntry Entity_MunchlesiaGrab_dma[] = { ENTITY_ROM(MunchlesiaGrab_gfx), ENTITY_ROM(MunchlesiaGrab_anim) };
323DmaEntry Entity_MunchlesiaEnvelop_dma[] = { ENTITY_ROM(MunchlesiaEnvelop_gfx), ENTITY_ROM(MunchlesiaEnvelop_anim) };
324DmaEntry Entity_MunchlesiaBeginChew_dma[] = { ENTITY_ROM(MunchlesiaBeginChew_gfx), ENTITY_ROM(MunchlesiaBeginChew_anim) };
325DmaEntry Entity_MunchlesiaChewing_dma[] = { ENTITY_ROM(MunchlesiaChewing_gfx), ENTITY_ROM(MunchlesiaChewing_anim) };
326DmaEntry Entity_MunchlesiaSpitOut_dma[] = { ENTITY_ROM(MunchlesiaSpitOut_gfx), ENTITY_ROM(MunchlesiaSpitOut_anim) };
327DmaEntry Entity_MunchlesiaReset1_dma[] = { ENTITY_ROM(MunchlesiaReset1_gfx), ENTITY_ROM(MunchlesiaReset1_anim) };
328DmaEntry Entity_BellbellPlant_dma[] = { ENTITY_ROM(BellbellPlant_gfx), ENTITY_ROM(BellbellPlant_anim) };
329DmaEntry Entity_TrumpetPlant_dma[] = { ENTITY_ROM(TrumpetPlant_gfx), ENTITY_ROM(TrumpetPlant_anim) };
330
333 .typeDataSize = 0,
334 .renderCommandList = Entity_BellbellPlant_AnimationIdle,
335 .modelAnimationNodes = Entity_BellbellPlant_Mesh,
336 .fpInit = NULL,
337 .updateEntityScript = Entity_BellbellPlant_Script,
338 .fpHandleCollision = NULL,
339 { .dmaList = Entity_BellbellPlant_dma },
340 .entityType = ENTITY_TYPE_BELLBELL_PLANT,
341 .aabbSize = { 30, 40, 30 }
342};
343
346 .typeDataSize = sizeof(TrumpetPlantData),
347 .renderCommandList = Entity_TrumpetPlant_AnimationIdle,
348 .modelAnimationNodes = Entity_TrumpetPlant_Mesh,
349 .fpInit = NULL,
350 .updateEntityScript = Entity_TrumpetPlant_Script,
351 .fpHandleCollision = NULL,
352 { .dmaList = Entity_TrumpetPlant_dma },
353 .entityType = ENTITY_TYPE_TRUMPET_PLANT,
354 .aabbSize = { 30, 40, 30 }
355};
356
359 .typeDataSize = sizeof(MunchlesiaData),
360 .renderCommandList = Entity_RenderNone_Script,
361 .modelAnimationNodes = 0,
362 .fpInit = entity_Munchlesia_init,
363 .updateEntityScript = Entity_Munchlesia_Script,
364 .fpHandleCollision = NULL,
365 { .dmaList = NULL },
366 .entityType = ENTITY_TYPE_MUNCHLESIA,
367 .aabbSize = { 45, 20, 45 }
368};
369
372 .typeDataSize = sizeof(MunchlesiaData),
373 .renderCommandList = Entity_MunchlesiaReset_AnimationIdle,
374 .modelAnimationNodes = Entity_MunchlesiaReset_Mesh,
375 .fpInit = NULL,
376 .updateEntityScript = Entity_MunchlesiaReset_Script,
377 .fpHandleCollision = NULL,
378 { .dmaList = Entity_MunchlesiaReset_dma },
379 .entityType = ENTITY_TYPE_RESET_MUNCHLESIA,
380 .aabbSize = { 40, 20, 40 }
381};
382
385 .typeDataSize = sizeof(MunchlesiaData),
386 .renderCommandList = Entity_MunchlesiaGrab_Animation,
387 .modelAnimationNodes = Entity_MunchlesiaGrab_Mesh,
388 .fpInit = NULL,
389 .updateEntityScript = Entity_MunchlesiaGrab_Script,
390 .fpHandleCollision = NULL,
391 { .dmaList = Entity_MunchlesiaGrab_dma },
392 .entityType = ENTITY_TYPE_MUNCHLESIA_GRAB,
393 .aabbSize = { 40, 20, 40 }
394};
395
398 .typeDataSize = sizeof(MunchlesiaData),
399 .renderCommandList = Entity_MunchlesiaEnvelop_Animation,
400 .modelAnimationNodes = Entity_MunchlesiaEnvelop_Mesh,
401 .fpInit = NULL,
402 .updateEntityScript = Entity_MunchlesiaEnvelop_Script,
403 .fpHandleCollision = NULL,
404 { .dmaList = Entity_MunchlesiaEnvelop_dma },
405 .entityType = ENTITY_TYPE_MUNCHLESIA_ENVELOP,
406 .aabbSize = { 40, 20, 40 }
407};
408
411 .typeDataSize = sizeof(MunchlesiaData),
412 .renderCommandList = Entity_MunchlesiaBeginChew_Animation,
413 .modelAnimationNodes = Entity_MunchlesiaBeginChew_Mesh,
414 .fpInit = NULL,
415 .updateEntityScript = Entity_MunchlesiaBeginChew_Script,
416 .fpHandleCollision = NULL,
417 { .dmaList = Entity_MunchlesiaBeginChew_dma },
419 .aabbSize = { 40, 20, 40 }
420};
421
424 .typeDataSize = sizeof(MunchlesiaData),
425 .renderCommandList = Entity_MunchlesiaChewing_Animation,
426 .modelAnimationNodes = Entity_MunchlesiaChewing_Mesh,
428 .updateEntityScript = Entity_MunchlesiaChewing_Script,
429 .fpHandleCollision = NULL,
430 { .dmaList = Entity_MunchlesiaChewing_dma },
431 .entityType = ENTITY_TYPE_MUNCHLESIA_CHEWING,
432 .aabbSize = { 40, 20, 40 }
433};
434
437 .typeDataSize = sizeof(MunchlesiaData),
438 .renderCommandList = Entity_MunchlesiaSpitOut_Animation,
439 .modelAnimationNodes = Entity_MunchlesiaSpitOut_Mesh,
440 .fpInit = NULL,
441 .updateEntityScript = Entity_MunchlesiaSpitOut_Script,
442 .fpHandleCollision = NULL,
443 { .dmaList = Entity_MunchlesiaSpitOut_dma },
445 .aabbSize = { 40, 20, 40 }
446};
447
450 .typeDataSize = sizeof(MunchlesiaData),
451 .renderCommandList = Entity_MunchlesiaReset1_Animation,
452 .modelAnimationNodes = Entity_MunchlesiaReset1_Mesh,
453 .fpInit = NULL,
454 .updateEntityScript = Entity_MunchlesiaReset1_Script,
455 .fpHandleCollision = NULL,
456 { .dmaList = Entity_MunchlesiaReset1_dma },
457 .entityType = ENTITY_TYPE_MUNCHLESIA_RESET1,
458 .aabbSize = { 40, 20, 40 }
459};
460
463 .typeDataSize = sizeof(MunchlesiaData),
464 .renderCommandList = Entity_MunchlesiaReset_AnimationIdle,
465 .modelAnimationNodes = Entity_MunchlesiaReset_Mesh,
466 .fpInit = NULL,
467 .updateEntityScript = Entity_MunchlesiaReset2_Script,
468 .fpHandleCollision = NULL,
469 { .dmaList = Entity_MunchlesiaReset_dma },
470 .entityType = ENTITY_TYPE_MUNCHLESIA_RESET2,
471 .aabbSize = { 40, 20, 40 }
472};
void func_802BC050_E2E980(Entity *entity)
Definition Plants2.c:95
EntityModelScript Entity_RenderNone_Script
Definition Shadow.c:73
void entity_TrumpetPlant_idle(Entity *entity)
Definition Plants2.c:49
EntityScript Entity_MunchlesiaSpitOut_Script
Definition Plants2.c:291
void func_802BC2B4_E2EBE4(Entity *entity)
Definition Plants2.c:148
EntityScript Entity_MunchlesiaReset2_Script
Definition Plants2.c:312
EntityBlueprint Entity_MunchlesiaReset2
Definition Plants2.c:461
void entity_TrumpetPlant_spawn_coin(Entity *entity)
Definition Plants2.c:66
AnimScript Entity_MunchlesiaReset_AnimationReset
AnimScript Entity_TrumpetPlant_AnimationIdle
EntityScript Entity_MunchlesiaReset1_Script
Definition Plants2.c:303
AnimScript Entity_MunchlesiaChewing_Animation
DmaEntry Entity_MunchlesiaSpitOut_dma[]
Definition Plants2.c:326
void func_802BC308_E2EC38(Entity *entity)
Definition Plants2.c:156
StaticAnimatorNode * Entity_TrumpetPlant_Mesh[]
DmaEntry Entity_MunchlesiaBeginChew_dma[]
Definition Plants2.c:324
AnimScript Entity_MunchlesiaGrab_Animation
void entity_BellbellPlant_idle(Entity *entity)
Definition Plants2.c:41
AnimScript Entity_MunchlesiaBeginChew_Animation
void func_802BC274_E2EBA4(Entity *entity)
Definition Plants2.c:142
DmaEntry Entity_MunchlesiaChewing_dma[]
Definition Plants2.c:325
StaticAnimatorNode * Entity_MunchlesiaEnvelop_Mesh[]
StaticAnimatorNode * Entity_MunchlesiaReset1_Mesh[]
void entity_Munchlesia_create_child_reset1(Entity *entity)
Definition Plants2.c:165
EntityBlueprint Entity_Munchlesia
Definition Plants2.c:357
EntityBlueprint Entity_MunchlesiaReset
Definition Plants2.c:370
StaticAnimatorNode * Entity_MunchlesiaReset_Mesh[]
EntityScript Entity_BellbellPlant_Script
Definition Plants2.c:198
AnimScript Entity_MunchlesiaSpitOut_Animation
EntityScript Entity_MunchlesiaChewing_Script
Definition Plants2.c:280
void entity_Munchlesia_create_child_reset2(Entity *entity)
Definition Plants2.c:169
EntityScript Entity_TrumpetPlant_Script
Definition Plants2.c:208
DmaEntry Entity_MunchlesiaReset_dma[]
Definition Plants2.c:321
EntityBlueprint Entity_MunchlesiaSpitOut
Definition Plants2.c:435
AnimScript Entity_BellbellPlant_AnimationIdle
AnimScript Entity_MunchlesiaReset1_Animation
DmaEntry Entity_TrumpetPlant_dma[]
Definition Plants2.c:329
EntityBlueprint Entity_MunchlesiaEnvelop
Definition Plants2.c:396
EntityBlueprint Entity_BellbellPlant
Definition Plants2.c:331
AnimScript Entity_MunchlesiaReset_AnimationIdle
EntityScript Entity_Munchlesia_Script
Definition Plants2.c:230
void func_802BC220_E2EB50(Entity *entity)
Definition Plants2.c:133
void func_802BC250_E2EB80(Entity *entity)
Definition Plants2.c:138
EntityScript Entity_MunchlesiaBeginChew_Script
Definition Plants2.c:271
AnimScript Entity_BellbellPlant_AnimationUse
DmaEntry Entity_MunchlesiaReset1_dma[]
Definition Plants2.c:327
EntityScript Entity_MunchlesiaEnvelop_Script
Definition Plants2.c:262
EntityBlueprint Entity_MunchlesiaGrab
Definition Plants2.c:383
void func_802BC32C_E2EC5C(Entity *entity)
Definition Plants2.c:160
DmaEntry Entity_MunchlesiaGrab_dma[]
Definition Plants2.c:322
EntityScript Entity_MunchlesiaReset_Script
Definition Plants2.c:239
void func_802BC0F0_E2EA20(Entity *entity)
Definition Plants2.c:114
EntityBlueprint Entity_TrumpetPlant
Definition Plants2.c:344
EntityBlueprint Entity_MunchlesiaBeginChew
Definition Plants2.c:409
AnimScript Entity_TrumpetPlant_AnimationUse
StaticAnimatorNode * Entity_MunchlesiaBeginChew_Mesh[]
void entity_MunchlesiaChewing_init(Entity *entity)
Definition Plants2.c:179
DmaEntry Entity_MunchlesiaEnvelop_dma[]
Definition Plants2.c:323
DmaEntry Entity_BellbellPlant_dma[]
Definition Plants2.c:328
EntityBlueprint Entity_MunchlesiaReset1
Definition Plants2.c:448
StaticAnimatorNode * Entity_MunchlesiaGrab_Mesh[]
void entity_TrumpetPlant_create_effect(Entity *entity)
Definition Plants2.c:57
AnimScript Entity_MunchlesiaEnvelop_Animation
void func_802BC0B8_E2E9E8(Entity *entity)
Definition Plants2.c:108
void func_802BC3E4_E2ED14(Entity *entity)
Definition Plants2.c:185
StaticAnimatorNode * Entity_MunchlesiaChewing_Mesh[]
EntityBlueprint Entity_MunchlesiaChewing
Definition Plants2.c:422
s32 entity_Munchlesia_create_child(Entity *entity, EntityBlueprint *EntityBlueprint)
Definition Plants2.c:129
StaticAnimatorNode * Entity_MunchlesiaSpitOut_Mesh[]
void func_802BC3A0_E2ECD0(void)
Definition Plants2.c:173
StaticAnimatorNode * Entity_BellbellPlant_Mesh[]
EntityScript Entity_MunchlesiaGrab_Script
Definition Plants2.c:251
void entity_Munchlesia_init(Entity *entity)
Definition Plants2.c:90
void func_802BC17C_E2EAAC(Entity *entity)
Definition Plants2.c:120
s16 AnimScript[]
struct TrumpetPlantData * trumpetPlant
struct MunchlesiaData * munchlesia
#define rand_int
#define clamp_angle
#define atan2
s32 EntityModelScript[]
Definition entity.h:7
#define es_Call(func)
Definition entity.h:37
#define es_Restart
Definition entity.h:40
#define es_SetCallback(func, time)
Definition entity.h:38
#define es_SetFlags(flags)
Definition entity.h:43
#define ENTITY_ROM(name)
Definition entity.h:65
#define es_Label(labelId)
Definition entity.h:41
#define es_Goto(labelId)
Definition entity.h:39
s32 EntityScript[]
Definition entity.h:6
#define es_End
Definition entity.h:35
#define es_PlaySound(soundId)
Definition entity.h:45
#define es_ClearFlags(flags)
Definition entity.h:44
@ ITEM_SPAWN_MODE_FIXED_SPAWN_ALWAYS_NEVER_VANISH
Definition enums.h:2310
@ ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS
Definition enums.h:2294
@ ENTITY_TYPE_TRUMPET_PLANT
Definition enums.h:2591
@ ENTITY_TYPE_MUNCHLESIA_ENVELOP
Definition enums.h:2603
@ ENTITY_TYPE_BELLBELL_PLANT
Definition enums.h:2590
@ ENTITY_TYPE_MUNCHLESIA_CHEWING
Definition enums.h:2605
@ ENTITY_TYPE_MUNCHLESIA_BEGIN_CHEW
Definition enums.h:2604
@ ENTITY_TYPE_MUNCHLESIA_RESET2
Definition enums.h:2608
@ ENTITY_TYPE_MUNCHLESIA_GRAB
Definition enums.h:2602
@ ENTITY_TYPE_MUNCHLESIA_SPIT_OUT
Definition enums.h:2606
@ ENTITY_TYPE_RESET_MUNCHLESIA
Definition enums.h:2601
@ ENTITY_TYPE_MUNCHLESIA_RESET1
Definition enums.h:2607
@ ENTITY_TYPE_MUNCHLESIA
Definition enums.h:2592
@ PA_FLAG_INTERRUPT_USE_PARTNER
forces actions with bow, parakarry, watt, and lakilester to end (sushie not tested)
Definition enums.h:3093
@ PA_FLAG_INTERACT_PROMPT_AVAILABLE
! prompt
Definition enums.h:3095
@ ENTITY_COLLISION_PLAYER_HAMMER
Definition enums.h:2654
@ ENTITY_COLLISION_PLAYER_TOUCH_WALL
Definition enums.h:2651
@ ENTITY_COLLISION_PLAYER_TOUCH_FLOOR
Definition enums.h:2648
@ SOUND_PLANTS_TRUMPET
Definition enums.h:729
@ SOUND_MUNCHLESIA_SPIT
Definition enums.h:1217
@ SOUND_PLANTS_BELL
Definition enums.h:727
@ SOUND_MUNCHLESIA_SUCTION
Definition enums.h:1447
@ SOUND_MUNCHLESIA_CHEW
Definition enums.h:1216
@ ENTITY_FLAG_HAS_ANIMATED_MODEL
Definition enums.h:2616
@ ENTITY_FLAG_400
Definition enums.h:2623
@ ENTITY_FLAG_FIXED_SHADOW_SIZE
Definition enums.h:2622
@ ENTITY_FLAG_SHOWS_INSPECT_PROMPT
Definition enums.h:2625
@ ENTITY_FLAG_HIDDEN
Definition enums.h:2613
@ ENTITY_FLAG_PENDING_INSTANCE_DELETE
Definition enums.h:2642
@ ENTITY_FLAG_DISABLE_COLLISION
Definition enums.h:2618
@ ENTITY_FLAG_CIRCULAR_SHADOW
Definition enums.h:2624
@ ACTION_STATE_USE_MUNCHLESIA
Set by the jan_09 squishy flower entity; throws the player in the air.
Definition enums.h:2458
@ ACTION_STATE_USE_SPRING
Definition enums.h:2466
@ CAM_DEFAULT
Definition enums.h:1800
Entity * get_entity_by_index(s32 index)
Definition entity.c:530
void play_model_animation(s32, s16 *)
Definition animator.c:1101
f64 fabs(f64 f)
void suggest_player_anim_always_forward(AnimID anim)
Definition 77480.c:913
s32 disable_player_input(void)
Definition 77480.c:990
f32 cos_rad(f32 x)
Definition 43F0.c:717
s32 make_item_entity_nodelay(s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode, s32 pickupVar)
s32 enable_player_input(void)
Definition 77480.c:998
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
Definition 43F0.c:670
void enable_player_shadow(void)
Definition 77480.c:964
s32 make_item_entity(s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode, s32 pickupDelay, s32 angle, s32 pickupVar)
void set_action_state(s32 actionState)
Definition 7E9D0.c:209
void enable_partner_ai(void)
Definition partners.c:2390
void exec_entity_commandlist(Entity *entity)
Definition entity.c:313
void subtract_hp(s32 amt)
Definition inventory.c:2192
f32 sin_rad(f32 x)
Definition 43F0.c:713
void add_vec2D_polar(f32 *x, f32 *y, f32 r, f32 theta)
Definition 43F0.c:685
void func_800EF300(void)
Definition partners.c:2382
s32 create_entity(EntityBlueprint *bp,...)
Definition entity.c:1195
void disable_player_shadow(void)
Definition 77480.c:968
void sfx_play_sound(s32 soundID)
Definition sfx.c:517
#define DEG_TO_RAD(deg)
Definition macros.h:134
Vec3f targetPos
s16 virtualModelIndex
EntityData dataBuf
u8 collisionFlags
Camera gCameras[4]
Definition cam_main.c:17
PlayerStatus gPlayerStatus
Definition 77480.c:39