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
6
extern
Addr
entity_model_Signpost_ROM_END;
7
extern
Addr
entity_model_Signpost_ROM_START;
8
#endif
9
10
extern
Gfx
Entity_Signpost_Render
[];
11
12
void
entity_Signpost_idle
(
Entity
* entity) {
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)) {
18
entity->
flags
|=
ENTITY_FLAG_SHOWS_INSPECT_PROMPT
;
19
if
((playerStatus->
animFlags
&
PA_FLAG_INTERACT_PROMPT_AVAILABLE
) && (entity->
collisionFlags
&
ENTITY_COLLISION_PLAYER_TOUCH_WALL
)) {
20
entity_start_script
(entity);
21
}
22
}
else
{
23
entity->
flags
&= ~ENTITY_FLAG_SHOWS_INSPECT_PROMPT;
24
playerStatus->
interactingWithID
=
NO_COLLIDER
;
25
}
26
}
27
28
EntityScript
Entity_Signpost_Script
= {
29
es_SetCallback
(
entity_Signpost_idle
, 0)
30
es_End
31
};
32
33
EntityModelScript
Entity_Signpost_RenderScript
=
STANDARD_ENTITY_MODEL_SCRIPT
(
Entity_Signpost_Render
,
RENDER_MODE_SURFACE_OPA
);
34
35
EntityBlueprint
Entity_Signpost
= {
36
.
flags
=
ENTITY_FLAG_CIRCULAR_SHADOW
|
ENTITY_FLAG_400
|
ENTITY_FLAG_FIXED_SHADOW_SIZE
,
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
};
Entity_Signpost
EntityBlueprint Entity_Signpost
Definition
Signpost.c:35
entity_Signpost_idle
void entity_Signpost_idle(Entity *entity)
Definition
Signpost.c:12
Entity_Signpost_Render
Gfx Entity_Signpost_Render[]
Definition
Signpost.c:99
Entity_Signpost_RenderScript
EntityModelScript Entity_Signpost_RenderScript
Definition
Signpost.c:33
Entity_Signpost_Script
EntityScript Entity_Signpost_Script
Definition
Signpost.c:28
Vec3f::z
f32 z
Definition
common_structs.h:102
PlayerStatus::animFlags
u32 animFlags
Definition
common_structs.h:1981
PlayerStatus::pos
Vec3f pos
Definition
common_structs.h:1995
Vec3f::x
f32 x
Definition
common_structs.h:100
PlayerStatus::interactingWithID
s16 interactingWithID
Definition
common_structs.h:2032
Vec3f::y
f32 y
Definition
common_structs.h:101
PlayerStatus
Definition
common_structs.h:1979
clamp_angle
#define clamp_angle
Definition
effect_shims.h:54
atan2
#define atan2
Definition
effect_shims.h:57
entity.h
EntityModelScript
s32 EntityModelScript[]
Definition
entity.h:7
STANDARD_ENTITY_MODEL_SCRIPT
#define STANDARD_ENTITY_MODEL_SCRIPT(gfx, renderMode)
Definition
entity.h:56
es_SetCallback
#define es_SetCallback(func, time)
Definition
entity.h:38
EntityScript
s32 EntityScript[]
Definition
entity.h:6
es_End
#define es_End
Definition
entity.h:35
SignpostData
Definition
entity.h:249
ENTITY_TYPE_SIGNPOST
@ ENTITY_TYPE_SIGNPOST
Definition
enums.h:2588
PA_FLAG_INTERACT_PROMPT_AVAILABLE
@ PA_FLAG_INTERACT_PROMPT_AVAILABLE
! prompt
Definition
enums.h:3095
PA_FLAG_USING_WATT
@ PA_FLAG_USING_WATT
Definition
enums.h:3090
ENTITY_COLLISION_PLAYER_TOUCH_WALL
@ ENTITY_COLLISION_PLAYER_TOUCH_WALL
Definition
enums.h:2651
ENTITY_COLLISION_PLAYER_TOUCH_FLOOR
@ ENTITY_COLLISION_PLAYER_TOUCH_FLOOR
Definition
enums.h:2648
RENDER_MODE_SURFACE_OPA
@ RENDER_MODE_SURFACE_OPA
Definition
enums.h:3264
ENTITY_FLAG_400
@ ENTITY_FLAG_400
Definition
enums.h:2623
ENTITY_FLAG_FIXED_SHADOW_SIZE
@ ENTITY_FLAG_FIXED_SHADOW_SIZE
Definition
enums.h:2622
ENTITY_FLAG_SHOWS_INSPECT_PROMPT
@ ENTITY_FLAG_SHOWS_INSPECT_PROMPT
Definition
enums.h:2625
ENTITY_FLAG_CIRCULAR_SHADOW
@ ENTITY_FLAG_CIRCULAR_SHADOW
Definition
enums.h:2624
fabsf
f32 fabsf(f32 f)
entity_start_script
s32 entity_start_script(Entity *entity)
Definition
entity.c:560
NO_COLLIDER
#define NO_COLLIDER
Definition
macros.h:156
EntityBlueprint
Definition
common_structs.h:507
EntityBlueprint::flags
u16 flags
Definition
common_structs.h:508
Entity
Definition
common_structs.h:550
Entity::flags
s32 flags
Definition
common_structs.h:551
Entity::pos
Vec3f pos
Definition
common_structs.h:574
Entity::collisionFlags
u8 collisionFlags
Definition
common_structs.h:554
Entity::rot
Vec3f rot
Definition
common_structs.h:576
Addr
u8 Addr[]
Linker symbol address, as in ld_addrs.h.
Definition
types.h:16
gPlayerStatus
PlayerStatus gPlayerStatus
Definition
77480.c:39
src
entity
Signpost.c
Generated by
1.10.0