Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
ArrowSign.c File Reference

Go to the source code of this file.

Functions

void entity_ArrowSign_setupGfx (s32 entityIndex)
 
void entity_ArrowSign_idle (void)
 
void entity_ArrowSign_init (Entity *entity)
 
s32 entity_ArrowSign_handle_collision (Entity *entity)
 

Variables

Gfx Entity_ArrowSign_Render []
 
Gfx Entity_ArrowSign_RenderRotatedSign []
 
Mtx Entity_ArrowSign_mtxSign
 
EntityScript Entity_ArrowSign_Script
 
EntityModelScript Entity_ArrowSign_RenderScript = STANDARD_ENTITY_MODEL_SCRIPT(Entity_ArrowSign_Render, RENDER_MODE_SURFACE_OPA)
 
EntityBlueprint Entity_ArrowSign
 

Function Documentation

◆ entity_ArrowSign_setupGfx()

void entity_ArrowSign_setupGfx ( s32 entityIndex)

Definition at line 9 of file ArrowSign.c.

9 {
10 Gfx* gfxPos = gMainGfxPos;
11 Entity* entity = get_entity_by_index(entityIndex);
12 ArrowSignData* data = entity->dataBuf.arrowSign;
13 Matrix4f sp18;
14 Matrix4f sp58;
15 Gfx* gfx;
16
17 guMtxL2F(sp18, ENTITY_ADDR(entity, Mtx*, &Entity_ArrowSign_mtxSign));
18 guRotateF(sp58, clamp_angle(data->angle - 90.0f), 0.0f, 0.0f, 1.0f);
19 guMtxCatF(sp58, sp18, sp18);
21
22 gSPMatrix(gfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
24 gSPDisplayList(gfxPos++, gfx);
25 gSPPopMatrix(gfxPos++, G_MTX_MODELVIEW);
26 gMainGfxPos = gfxPos;
27}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
struct ArrowSignData * arrowSign
#define guRotateF
#define guMtxF2L
#define guMtxCatF
#define clamp_angle
#define ENTITY_ADDR(entity, type, data)
Definition entity.h:64
Entity * get_entity_by_index(s32 index)
Definition entity.c:530
Gfx Entity_ArrowSign_RenderRotatedSign[]
Definition ArrowSign.c:57
Mtx Entity_ArrowSign_mtxSign
Definition ArrowSign.c:32
EntityData dataBuf
Gfx * gMainGfxPos
Definition cam_main.c:15
u16 gMatrixListPos
Definition main_loop.c:45
DisplayContext * gDisplayContext
Definition cam_main.c:16

Referenced by entity_ArrowSign_init().

◆ entity_ArrowSign_idle()

void entity_ArrowSign_idle ( void )

Definition at line 29 of file ArrowSign.c.

29 {
30}

◆ entity_ArrowSign_init()

void entity_ArrowSign_init ( Entity * entity)

Definition at line 32 of file ArrowSign.c.

32 {
33 f32 angle = CreateEntityVarArgBuffer[0];
34 ArrowSignData* data = entity->dataBuf.arrowSign;
35
36 data->angle = angle;
37 data->unk_08 = angle;
39}
s32 CreateEntityVarArgBuffer[]
Definition entity.c:35
void entity_ArrowSign_setupGfx(s32 entityIndex)
Definition ArrowSign.c:9
void(* renderSetupFunc)(s32)

◆ entity_ArrowSign_handle_collision()

s32 entity_ArrowSign_handle_collision ( Entity * entity)

Definition at line 41 of file ArrowSign.c.

41 {
44 entity_start_script(entity);
45 }
46}
@ PA_FLAG_USING_WATT
Definition enums.h:3090
@ ENTITY_COLLISION_PLAYER_TOUCH_WALL
Definition enums.h:2651
s32 entity_start_script(Entity *entity)
Definition entity.c:560
u8 collisionFlags
PlayerStatus gPlayerStatus
Definition 77480.c:39

Variable Documentation

◆ Entity_ArrowSign_Render

Gfx Entity_ArrowSign_Render[]
extern

Definition at line 81 of file ArrowSign.c.

81 {
82 gsSPDisplayList(Entity_ArrowSign_RenderPole__),
83 gsSPEndDisplayList(),
84};
Gfx Entity_ArrowSign_RenderPole__[]
Definition ArrowSign.c:76

◆ Entity_ArrowSign_RenderRotatedSign

Gfx Entity_ArrowSign_RenderRotatedSign[]
extern

Definition at line 57 of file ArrowSign.c.

57 {
58 gsDPPipeSync(),
59 gsDPSetCycleType(G_CYC_1CYCLE),
60 gsDPSetRenderMode(G_RM_AA_ZB_TEX_EDGE, G_RM_AA_ZB_TEX_EDGE2),
61 gsSPDisplayList(Entity_ArrowSign_LoadTexture),
62 gsSPClearGeometryMode(G_LIGHTING | G_SHADING_SMOOTH),
63 gsSPSetGeometryMode(G_CULL_BACK),
64 gsSPVertex(Entity_ArrowSign_vtxSign, 4, 0),
65 gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
66 gsSPEndDisplayList(),
67};
Vtx Entity_ArrowSign_vtxSign[]
Definition ArrowSign.c:4
Gfx Entity_ArrowSign_LoadTexture[]
Definition ArrowSign.c:19

Referenced by entity_ArrowSign_setupGfx().

◆ Entity_ArrowSign_mtxSign

Mtx Entity_ArrowSign_mtxSign
extern

Definition at line 32 of file ArrowSign.c.

Referenced by entity_ArrowSign_setupGfx().

◆ Entity_ArrowSign_Script

EntityScript Entity_ArrowSign_Script
Initial value:
= {
}
#define es_SetCallback(func, time)
Definition entity.h:38
#define es_End
Definition entity.h:35
void entity_ArrowSign_idle(void)
Definition ArrowSign.c:29

Definition at line 48 of file ArrowSign.c.

◆ Entity_ArrowSign_RenderScript

◆ Entity_ArrowSign

EntityBlueprint Entity_ArrowSign
Initial value:
= {
.typeDataSize = sizeof(ArrowSignData),
.renderCommandList = Entity_ArrowSign_RenderScript,
.modelAnimationNodes = 0,
.updateEntityScript = Entity_ArrowSign_Script,
.fpHandleCollision = entity_ArrowSign_handle_collision,
{ .dma = ENTITY_ROM(ArrowSign) },
.aabbSize = { 18, 50, 10 }
}
#define ENTITY_ROM(name)
Definition entity.h:65
@ ENTITY_TYPE_RED_ARROW_SIGNS
Definition enums.h:2589
@ ENTITY_FLAG_400
Definition enums.h:2623
@ ENTITY_FLAG_FIXED_SHADOW_SIZE
Definition enums.h:2622
@ ENTITY_FLAG_CIRCULAR_SHADOW
Definition enums.h:2624
EntityScript Entity_ArrowSign_Script
Definition ArrowSign.c:48
void entity_ArrowSign_init(Entity *entity)
Definition ArrowSign.c:32
EntityModelScript Entity_ArrowSign_RenderScript
Definition ArrowSign.c:53
s32 entity_ArrowSign_handle_collision(Entity *entity)
Definition ArrowSign.c:41

Definition at line 55 of file ArrowSign.c.

55 {
57 .typeDataSize = sizeof(ArrowSignData),
58 .renderCommandList = Entity_ArrowSign_RenderScript,
59 .modelAnimationNodes = 0,
60 .fpInit = entity_ArrowSign_init,
61 .updateEntityScript = Entity_ArrowSign_Script,
62 .fpHandleCollision = entity_ArrowSign_handle_collision,
63 { .dma = ENTITY_ROM(ArrowSign) },
64 .entityType = ENTITY_TYPE_RED_ARROW_SIGNS,
65 .aabbSize = { 18, 50, 10 }
66};