Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
dusty_hammer.c
Go to the documentation of this file.
1#include "common.h"
2#include "script_api/battle.h"
3#include "entity.h"
4#include "ld_addrs.h"
5#include "sprite/player.h"
6#include "include_asset.h"
7
8#define NAMESPACE battle_item_dusty_hammer
9
12
13static s32 _pad = 0; // XXX
14
15#include "battle/move/item/dusty_hammer.png.h"
16INCLUDE_IMG("battle/move/item/dusty_hammer.png", battle_item_dusty_hammer_png);
17INCLUDE_PAL("battle/move/item/dusty_hammer.pal", battle_item_dusty_hammer_pal);
18
19Vtx N(DustyHammerVtx)[] = {
20 { .v = {{ -16, -16, 0 }, FALSE, { 0, 0 }, { 0, 0, 0, 255 }}},
21 { .v = {{ 15, -16, 0 }, FALSE, { 1024, 0 }, { 0, 0, 0, 255 }}},
22 { .v = {{ 15, 15, 0 }, FALSE, { 1024, 1024 }, { 0, 0, 0, 255 }}},
23 { .v = {{ -16, 15, 0 }, FALSE, { 0, 1024 }, { 0, 0, 0, 255 }}},
24};
25
26Gfx N(DustyHammerGfx)[] = {
27 gsDPPipeSync(),
28 gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
29 gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
30 gsDPSetTexturePersp(G_TP_PERSP),
31 gsDPSetTextureDetail(G_TD_CLAMP),
32 gsDPSetTextureLOD(G_TL_TILE),
33 gsDPSetTextureLUT(G_TT_NONE),
34 gsDPSetTextureFilter(G_TF_AVERAGE),
35 gsDPSetTextureConvert(G_TC_FILT),
36 gsDPSetTextureLUT(G_TT_RGBA16),
37 gsDPLoadTLUT_pal16(0, battle_item_dusty_hammer_pal),
38 gsDPLoadTextureTile_4b(battle_item_dusty_hammer_png, G_IM_FMT_CI, battle_item_dusty_hammer_png_width, battle_item_dusty_hammer_png_height, 0, 0, battle_item_dusty_hammer_png_width - 1, battle_item_dusty_hammer_png_height - 1, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD),
39 gsSPClearGeometryMode(G_LIGHTING),
40 gsSPClearGeometryMode(G_SHADING_SMOOTH),
41 gsSPVertex(N(DustyHammerVtx), ARRAY_COUNT(N(DustyHammerVtx)), 0),
42 gsSP1Triangle(0, 1, 2, 0),
43 gsSP1Triangle(0, 2, 3, 0),
44 gsDPPipeSync(),
45 gsSPEndDisplayList(),
46};
47
48EntityModelScript N(EMS_DustyHammer) = STANDARD_ENTITY_MODEL_SCRIPT(N(DustyHammerGfx), RENDER_MODE_ALPHATEST);
49
50EvtScript N(EVS_UseItem) = {
51 SetConst(LVarA, ITEM_DUSTY_HAMMER)
52 ExecWait(N(UseItemWithEffect))
53 Call(UseBattleCamPreset, BTL_CAM_VIEW_ENEMIES)
54 Call(MoveBattleCamOver, 15)
55 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Throw)
57 Wait(3)
58 Call(CreateVirtualEntity, LVarA, Ref(N(EMS_DustyHammer)))
59 SetF(LVar0, Float(1.0))
60 Call(MultiplyByActorScale, LVar0)
62 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
63 Set(LVar3, 20)
64 Set(LVar4, 42)
65 Set(LVar5, 5)
66 Call(MultiplyVec3ByActorScale, LVar3, LVar4, LVar5)
71 Call(InitTargetIterator)
72 Call(SetGoalToTarget, ACTOR_SELF)
73 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
74 Thread
75 Set(LVar0, 0)
76 Loop(18)
77 Add(LVar0, -60)
79 Wait(1)
83 Add(LVar2, 5)
85 Call(GetItemPower, ITEM_DUSTY_HAMMER, LVar3, LVar4)
86 Call(ApplyShrinkFromOwner, LVar3)
88 Add(LVar0, 40)
89 Add(LVar1, 10)
92 ExecWait(N(PlayerGoHome))
93 Return
94 End
95};
Bytecode EvtScript[]
s32 EntityModelScript[]
Definition entity.h:7
#define STANDARD_ENTITY_MODEL_SCRIPT(gfx, renderMode)
Definition entity.h:56
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3575
@ BTL_CAM_VIEW_ENEMIES
Definition enums.h:4825
@ SOUND_THROW
Definition enums.h:1311
@ RENDER_MODE_ALPHATEST
Definition enums.h:3276
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ DAMAGE_TYPE_IGNORE_DEFENSE
Definition enums.h:2877
@ DAMAGE_TYPE_NO_CONTACT
Definition enums.h:2878
#define INCLUDE_PAL(FILENAME, SYMBOLNAME)
#define INCLUDE_IMG(FILENAME, SYMBOLNAME)
ApiStatus PlaySound(Evt *script, b32 isInitialCall)
ApiStatus CreateVirtualEntity(Evt *script, b32 isInitialCall)
ApiStatus SetVirtualEntityPosition(Evt *script, b32 isInitialCall)
ApiStatus SetVirtualEntityJumpGravity(Evt *script, b32 isInitialCall)
ApiStatus SetVirtualEntityScale(Evt *script, b32 isInitialCall)
ApiStatus DeleteVirtualEntity(Evt *script, b32 isInitialCall)
ApiStatus GetItemPower(Evt *script, b32 isInitialCall)
ApiStatus VirtualEntityJumpTo(Evt *script, b32 isInitialCall)
ApiStatus SetVirtualEntityRotation(Evt *script, b32 isInitialCall)
#define Ref(sym)
Address/pointer constant.
Definition macros.h:60
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:365
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define Add(VAR, INT_VALUE)
Definition macros.h:376
#define EndLoop
Marks the end of a loop.
Definition macros.h:248
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define Float(DOUBLE)
Definition macros.h:51
#define LVar5
Definition macros.h:153
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
Definition macros.h:475
#define Thread
Marks the start of a thread block.
Definition macros.h:544
#define EndThread
Marks the end of a thread block.
Definition macros.h:547
#define SetF(VAR, FLOAT_VALUE)
Sets the given variable to a given value, but supports Floats.
Definition macros.h:373
#define LVar2
Definition macros.h:150
#define LVar1
Definition macros.h:149
#define LVarA
Definition macros.h:158
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define LVar9
Definition macros.h:157
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:576
#define Loop(TIMES)
Marks the beginning of a loop.
Definition macros.h:245
#define LVar4
Definition macros.h:152
#define LVar3
Definition macros.h:151
#define LVar0
Definition macros.h:148
#define SetConst(VAR, CONST)
Sets the given variable to a given value, skipping the evt_get_variable call.
Definition macros.h:370
#define Return
Kills the current EVT thread.
Definition macros.h:217