Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
Signpost.c
Go to the documentation of this file.
1#include "common.h"
2#include "ld_addrs.h"
3#include "entity.h"
4
5#if VERSION_JP // TODO remove once segments are split
6extern Addr entity_model_Signpost_ROM_END;
7extern Addr entity_model_Signpost_ROM_START;
8#endif
9
10extern Gfx Entity_Signpost_Render[];
11
13 PlayerStatus* playerStatus = &gPlayerStatus;
14 f32 val = fabsf(clamp_angle(180.0f - entity->rot.y) - clamp_angle(atan2(entity->pos.x, entity->pos.z,
15 playerStatus->pos.x, playerStatus->pos.z)));
16
17 if (!(playerStatus->animFlags & PA_FLAG_USING_WATT) && !(entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) && (val <= 40.0f || val >= 320.0f)) {
20 entity_start_script(entity);
21 }
22 } else {
23 entity->flags &= ~ENTITY_FLAG_SHOWS_INSPECT_PROMPT;
24 playerStatus->interactingWithID = NO_COLLIDER;
25 }
26}
27
32
34
37 .typeDataSize = sizeof(SignpostData),
38 .renderCommandList = Entity_Signpost_RenderScript,
39 .modelAnimationNodes = NULL,
40 .fpInit = NULL,
41 .updateEntityScript = Entity_Signpost_Script,
42 .fpHandleCollision = NULL,
43 {{ entity_model_Signpost_ROM_START, entity_model_Signpost_ROM_END }},
44 .entityType = ENTITY_TYPE_SIGNPOST,
45 .aabbSize = { 40, 50, 20 }
46};
EntityBlueprint Entity_Signpost
Definition Signpost.c:35
void entity_Signpost_idle(Entity *entity)
Definition Signpost.c:12
Gfx Entity_Signpost_Render[]
Definition Signpost.c:99
EntityModelScript Entity_Signpost_RenderScript
Definition Signpost.c:33
EntityScript Entity_Signpost_Script
Definition Signpost.c:28
#define clamp_angle
#define atan2
s32 EntityModelScript[]
Definition entity.h:7
#define STANDARD_ENTITY_MODEL_SCRIPT(gfx, renderMode)
Definition entity.h:56
#define es_SetCallback(func, time)
Definition entity.h:38
s32 EntityScript[]
Definition entity.h:6
#define es_End
Definition entity.h:35
@ ENTITY_TYPE_SIGNPOST
Definition enums.h:2588
@ PA_FLAG_INTERACT_PROMPT_AVAILABLE
! prompt
Definition enums.h:3095
@ PA_FLAG_USING_WATT
Definition enums.h:3090
@ ENTITY_COLLISION_PLAYER_TOUCH_WALL
Definition enums.h:2651
@ ENTITY_COLLISION_PLAYER_TOUCH_FLOOR
Definition enums.h:2648
@ RENDER_MODE_SURFACE_OPA
Definition enums.h:3264
@ 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_CIRCULAR_SHADOW
Definition enums.h:2624
f32 fabsf(f32 f)
s32 entity_start_script(Entity *entity)
Definition entity.c:560
#define NO_COLLIDER
Definition macros.h:156
u8 collisionFlags
u8 Addr[]
Linker symbol address, as in ld_addrs.h.
Definition types.h:16
PlayerStatus gPlayerStatus
Definition 77480.c:39