10#include "message_ids.h"
14#include "sprite/player.h"
16#define MAX_ITEM_ENTITIES 256
74 {{{ -12, 0, 0 }, 0, { 0x2300, 0x2300 }, { 0, 0, 0, 255 }}},
75 {{{ 11, 0, 0 }, 0, { 0x2000, 0x2300 }, { 0, 0, 0, 255 }}},
76 {{{ 11, 23, 0 }, 0, { 0x2000, 0x2000 }, { 0, 0, 0, 255 }}},
77 {{{ -12, 23, 0 }, 0, { 0x2300, 0x2000 }, { 0, 0, 0, 255 }}},
81 {{{ -16, 0, 0 }, 0, { 0x2400, 0x2400 }, { 0, 0, 0, 255 }}},
82 {{{ 15, 0, 0 }, 0, { 0x2000, 0x2400 }, { 0, 0, 0, 255 }}},
83 {{{ 15, 31, 0 }, 0, { 0x2000, 0x2000 }, { 0, 0, 0, 255 }}},
84 {{{ -16, 31, 0 }, 0, { 0x2400, 0x2000 }, { 0, 0, 0, 255 }}},
89 gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
90 gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
91 gsDPSetTexturePersp(G_TP_PERSP),
92 gsDPSetTextureDetail(G_TD_CLAMP),
93 gsDPSetTextureLOD(G_TL_TILE),
94 gsDPSetTextureLUT(G_TT_NONE),
95 gsDPSetTextureFilter(G_TF_BILERP),
96 gsDPSetTextureConvert(G_TC_FILT),
97 gsDPSetTextureLUT(G_TT_RGBA16),
102 gsSPClearGeometryMode(G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH),
104 gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
106 gsSPEndDisplayList(),
110 gsSPClearGeometryMode(G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH),
112 gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
114 gsSPEndDisplayList(),
133 switch (*readPos++) {
186 guRotateF(sp98, angle, 0.0f, 1.0f, 0.0f);
193 gSPClearGeometryMode(
gMainGfxPos++, G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH);
194 gSPSetGeometryMode(
gMainGfxPos++, G_ZBUFFER | G_SHADE | G_LIGHTING | G_SHADING_SMOOTH);
196 gSPTexture(
gMainGfxPos++, -1, -1, 0, G_TX_RENDERTILE, G_ON);
236 item->
flags &= ~ITEM_ENTITY_FLAG_HIDDEN;
239 shadow->
flags &= ~ENTITY_FLAG_HIDDEN;
324 if (entry->
id == -1) {
329 nuPiReadRom((s32)icon_ROM_START + raster, entry->
data, size);
334 *
pos = (u16)(*
pos) | (i << 16);
339 cond = entry->
id == raster;
344 *
pos = (u16)(*
pos) | (i << 16);
358 if (entry->
id == -1) {
362 nuPiReadRom((s32)icon_ROM_START + palette, entry->
data, 0x20);
367 *
pos = (u16)(*
pos) | (i << 16);
371 }
else if (entry->
id == palette) {
375 *
pos = (u16)(*
pos) | (i << 16);
390s32
make_item_entity(s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode, s32 pickupDelay, s32 angle, s32 pickupFlagIndex) {
401 if (pickupFlagIndex > 0) {
402 switch (itemSpawnMode) {
470 item->
flags &= ~ITEM_ENTITY_RESIZABLE;
650 y = item->
pos.
y + 12.0f;
658 shadow->
rot.
y = 0.0f;
670 if (item->
itemID == ITEM_COIN) {
675 if (item->
itemID == ITEM_STAR_PIECE) {
676 item->
flags &= ~ITEM_ENTITY_FLAG_JUST_SPAWNED;
687 return make_item_entity(itemID, x, y, z, itemSpawnMode, pickupDelay, -1, pickupVar);
755 posY = item->
pos.
y + 12.0f;
759 shadow->
pos.
x = posX;
760 shadow->
pos.
y = posY;
761 shadow->
pos.
z = posZ;
764 shadow->
rot.
y = 0.0f;
769 if (item->
itemID == ITEM_COIN) {
826 f32 x, y, z, hitDepth;
836 if (item != NULL && item->
flags != 0) {
837 if (item->
itemID == ITEM_COIN) {
887 y = item->
pos.
y + 12.0f;
896 shadow->
rot.
y = 0.0f;
913 Matrix4f mtxTranslate, mtxRotY, mtxScale;
921 alpha = (item->
alpha * alpha) / 255;
927 alpha = (alpha * (255 - a)) / 255;
937 if (item->
itemID == ITEM_COIN || item->
itemID == ITEM_STAR_POINT || item->
itemID == ITEM_HEART) {
943 guRotateF(mtxRotY, rot, 0.0f, 1.0f, 0.0f);
948 guMtxCatF(mtxRotY, mtxTranslate, mtxTranslate);
949 guMtxF2L(mtxTranslate, &mtxTransform);
954 G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
961 gSPClearGeometryMode(
gMainGfxPos++, G_CULL_BOTH | G_LIGHTING);
966 gDPSetRenderMode(
gMainGfxPos++, AA_EN | IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL | G_RM_PASS,
967 AA_EN | IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL |
968 GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA));
970 gDPSetRenderMode(
gMainGfxPos++, AA_EN | IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL |
971 GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA),
972 AA_EN | IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL |
973 GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA));
975 gDPSetPrimColor(
gMainGfxPos++, 0, 0, 255, 255, 255, alpha);
983 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_8b, 2, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR |
984 G_TX_CLAMP, 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
986 gDPLoadTile(
gMainGfxPos++, G_TX_LOADTILE, 0, 0, 0x002E, 0x005C);
988 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_4b, 2, 0x0000, 1, 0, G_TX_NOMIRROR | G_TX_CLAMP, 8,
989 G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
990 gDPSetTileSize(
gMainGfxPos++, 1, 0x0400, 0x0400, 0x045C, 0x045C);
991 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_4b, 2, 0x0000, G_TX_RENDERTILE, 1,
992 G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
993 gDPSetTile(
gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 4, 0x0100, 2, 0, G_TX_NOMIRROR | G_TX_WRAP,
994 G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
1004 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_8b, 2, 0x0000, G_TX_LOADTILE, 0,
1005 G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
1007 gDPLoadTile(
gMainGfxPos++, G_TX_LOADTILE, 0, 0, 0x002E, 0x005C);
1009 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_4b, 2, 0x0000, G_TX_RENDERTILE, 0,
1010 G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
1011 gDPSetTileSize(
gMainGfxPos++, G_TX_RENDERTILE, 0x0400, 0x0400, 0x045C, 0x045C);
1018 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_8b, 2, 0x0000, G_TX_LOADTILE, 0,
1019 G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
1021 gDPLoadTile(
gMainGfxPos++, G_TX_LOADTILE, 0, 0, 0x003E, 0x007C);
1023 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_4b, 2, 0x0000, 1, 0, G_TX_NOMIRROR | G_TX_CLAMP,
1024 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
1025 gDPSetTileSize(
gMainGfxPos++, 1, 0x0400, 0x0400, 0x047C, 0x047C);
1026 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_4b, 2, 0x0000, G_TX_RENDERTILE, 1,
1027 G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
1028 gDPSetTile(
gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 4, 0x0100, 2, 0, G_TX_NOMIRROR | G_TX_WRAP,
1029 G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
1030 gDPSetTileSize(
gMainGfxPos++, 2, 0, 0, 0x00FC, 0);
1038 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_8b, 2, 0x0000, G_TX_LOADTILE, 0,
1039 G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
1041 gDPLoadTile(
gMainGfxPos++, G_TX_LOADTILE, 0, 0, 0x003E, 0x007C);
1043 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_4b, 2, 0x0000, G_TX_RENDERTILE, 0,
1044 G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
1045 gDPSetTileSize(
gMainGfxPos++, G_TX_RENDERTILE, 0x0400, 0x0400, 0x047C, 0x047C);
1052 if (item->
itemID == ITEM_COIN) {
1097 if (item != NULL && item->
flags != 0) {
1133 if ((item->
flags != 0)) {
1142 if (item->
itemID == ITEM_COIN || item->
itemID == ITEM_STAR_POINT || item->
itemID == ITEM_HEART) {
1149 guRotateF(sp98, rotX, 0.0f, 1.0f, 0.0f);
1170 alpha = item->
alpha * alpha / 255;
1174 alpha = alpha * (255 - a1) / 255;
1178 gDPSetRenderMode(
gMainGfxPos++, AA_EN | IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL | G_RM_PASS,
1179 AA_EN | IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL | GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA));
1181 gDPSetRenderMode(
gMainGfxPos++, AA_EN | IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL | GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA),
1182 AA_EN | IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL | GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA));
1184 gDPSetPrimColor(
gMainGfxPos++, 0, 0, 255, 255, 255, alpha);
1193 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_8b, 2, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
1195 gDPLoadTile(
gMainGfxPos++, G_TX_LOADTILE, 0, 0, 0x002E, 0x005C);
1197 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_4b, 2, 0x0000, 1, 0, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
1198 gDPSetTileSize(
gMainGfxPos++, 1, 0x0400, 0x0400, 0x045C, 0x045C);
1199 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_4b, 2, 0x0000, G_TX_RENDERTILE, 1, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
1200 gDPSetTile(
gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 4, 0x0100, 2, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
1201 gDPSetTileSize(
gMainGfxPos++, 2, 0, 0, 0x00FC, 0);
1209 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_8b, 2, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
1211 gDPLoadTile(
gMainGfxPos++, G_TX_LOADTILE, 0, 0, 0x002E, 0x005C);
1213 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_4b, 2, 0x0000, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
1214 gDPSetTileSize(
gMainGfxPos++, G_TX_RENDERTILE, 0x0400, 0x0400, 0x045C, 0x045C);
1221 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_8b, 2, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
1223 gDPLoadTile(
gMainGfxPos++, G_TX_LOADTILE, 0, 0, 0x003E, 0x007C);
1225 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_4b, 2, 0x0000, 1, 0, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
1226 gDPSetTileSize(
gMainGfxPos++, 1, 0x0400, 0x0400, 0x047C, 0x047C);
1227 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_4b, 2, 0x0000, G_TX_RENDERTILE, 1, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
1228 gDPSetTile(
gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 4, 0x0100, 2, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
1229 gDPSetTileSize(
gMainGfxPos++, 2, 0, 0, 0x00FC, 0);
1237 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_8b, 2, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
1239 gDPLoadTile(
gMainGfxPos++, G_TX_LOADTILE, 0, 0, 0x003E, 0x007C);
1241 gDPSetTile(
gMainGfxPos++, G_IM_FMT_CI, G_IM_SIZ_4b, 2, 0x0000, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, 8, G_TX_NOLOD);
1242 gDPSetTileSize(
gMainGfxPos++, G_TX_RENDERTILE, 0x0400, 0x0400, 0x047C, 0x047C);
1312 item->
flags &= ~ITEM_ENTITY_FLAG_FULLSIZE;
1316 item->
flags &= ~ITEM_ENTITY_RESIZABLE;
1328 f32 itemPickupRadius;
1329 f32 itemX, itemY, itemZ;
1330 f32 hammerX, hammerZ;
1331 f32 playerX, playerY, playerZ;
1332 f32 playerHalfHeight;
1333 f32 playerHalfRadius;
1334 f32 spriteFacingAngle;
1342 f32 hammerHitboxHeight;
1343 f32 itemHitboxHeight;
1345 f32 tmpYTopThreshold;
1348 item->
flags &= ~ITEM_ENTITY_FLAG_AUTO_COLLECT;
1364 tmpFourteen = 14.0f;
1369 hammerRadius = tmpFourteen;
1370 tmpYTopThreshold = 18.0f;
1371 itemHitboxHeight = 27.0f;
1373 hitDetected = item->
flags;
1378 hammerHitboxHeight = tmpYTopThreshold;
1391 && item->
itemID != ITEM_COIN)
1400 hitDetected = FALSE;
1401 playerX = playerStatus->
pos.
x;
1402 playerY = playerStatus->
pos.
y;
1403 playerZ = playerStatus->
pos.
z;
1408 if (spriteFacingAngle < 180.0f) {
1431 itemX = item->
pos.
x;
1432 itemY = item->
pos.
y;
1433 itemZ = item->
pos.
z;
1435 itemPickupRadius = 13.5f;
1438 dx = itemX - playerX;
1439 dz = itemZ - playerZ;
1442 if (!(playerHalfRadius + itemPickupRadius <= dist)
1443 && !(itemY + itemHitboxHeight < playerY)
1444 && !(playerY + playerHalfHeight < itemY))
1451 dx = itemX - hammerX;
1452 dz = itemZ - hammerZ;
1455 if (!(hammerRadius + itemPickupRadius <= dist)
1456 && !(itemY + itemHitboxHeight < hammerY)
1457 && !(hammerY + hammerHitboxHeight < itemY))
1470 item->
flags &= ~ITEM_ENTITY_FLAG_JUST_SPAWNED;
1477 item->
flags &= ~ITEM_ENTITY_FLAG_JUST_SPAWNED;
1500 if (item->
flags == 0) {
1520 dx = item->
pos.
x - x;
1521 dz = item->
pos.
y - y;
1522 dy = item->
pos.
z - z;
1544 item->
flags &= ~flags;
1589 f32 outX, outY, outZ, outDepth;
1590 f32 theta, sinAngle, cosAngle;
1608 switch (item->
state) {
1613 ASSERT(physData != NULL);
1629 if (item_is_consumable(item->
itemID) || item_is_key(item->
itemID)) {
1641 case ITEM_FLOWER_POINT:
1651 case ITEM_KOOPA_FORTRESS_KEY:
1658 case ITEM_STAR_POINT:
1669 case ITEM_HEART_POINT:
1672 case ITEM_STAR_PIECE:
1679 case ITEM_HEART_PIECE:
1690 temp = (temp / 1000.0f) + 1.5;
1694 physData->
velX = temp * sinAngle;
1695 physData->
velZ = -temp * cosAngle;
1698 temp = (temp / 1000.0f) + 2.0;
1702 physData->
velX = temp * sinAngle;
1703 physData->
velZ = -temp * cosAngle;
1708 temp = 1.5f + (0.6 * (item->
spawnAngle / 360));
1715 physData->
velX = temp * sinAngle;
1716 physData->
velZ = -temp * cosAngle;
1736 physData->
velX = 0.0f;
1737 physData->
velZ = 0.0f;
1742 physData->
velX = 0.0f;
1743 physData->
velZ = 0.0f;
1749 physData->
velX = 0.0f;
1750 physData->
velZ = 0.0f;
1824 if (hit && outDepth < temp) {
1825 item->
pos.
y = outY - temp;
1834 && (physData->
velX != 0.0f || physData->
velZ != 0.0f)
1855 physData->
velX = sinAngle * 2.0;
1856 physData->
velZ = cosAngle * -2.0;
1881 if (outY < outDepth + 0.0f) {
1895 physData->
velX = 0.0f;
1896 physData->
velZ = 0.0f;
1899 if (item_is_badge(item->
itemID)) {
1901 }
else if (item_is_consumable(item->
itemID) || item_is_key(item->
itemID)) {
1911 case ITEM_KOOPA_FORTRESS_KEY:
1914 case ITEM_HEART_PIECE:
1917 case ITEM_STAR_POINT:
1920 case ITEM_HEART_POINT:
1923 case ITEM_STAR_PIECE:
1926 case ITEM_FLOWER_POINT:
1935 if (item->
pos.
y < -2000.0f) {
1950 fx_small_gold_sparkle(0, item->
pos.
x, item->
pos.
y + 16.0f, item->
pos.
z, 1.0f, 0);
1952 if (item_is_consumable(item->
itemID) || item_is_key(item->
itemID) || item_is_badge(item->
itemID)) {
1954 }
else if (item->
itemID == ITEM_STAR_PIECE) {
1968 playerData->
curHP++;
1975 case ITEM_FLOWER_POINT:
1980 playerData->
curFP++;
1988 playerData->
coins++;
1989 if (playerData->
coins > 999) {
1990 playerData->
coins = 999;
1998 case ITEM_KOOPA_FORTRESS_KEY:
2001 case ITEM_STAR_POINT:
2008 case ITEM_HEART_POINT:
2054 item->
flags &= ~ITEM_ENTITY_FLAG_HIDDEN;
2114 switch (item->
state) {
2139 }
else if (item->
itemID == ITEM_COIN) {
2154 if (playerData->
invItems[i] == ITEM_NONE) {
2169 if (playerData->
keyItems[i] == ITEM_NONE) {
2184 if (playerData->
badges[i] == ITEM_NONE) {
2197 if (item->
itemID == ITEM_STAR_PIECE) {
2204 if (item->
itemID == ITEM_LUCKY_STAR) {
2208 if (item->
itemID >= ITEM_HAMMER && item->
itemID <= ITEM_ULTRA_HAMMER) {
2212 if (item->
itemID >= ITEM_BOOTS && item->
itemID <= ITEM_ULTRA_BOOTS) {
2235 || (item->
itemID == ITEM_STAR_PIECE)
2247 fx_got_item_outline(
2261 || (item->
itemID == ITEM_STAR_PIECE)
2273 || (item->
itemID == ITEM_STAR_PIECE)
2278 item->
flags &= ~ITEM_ENTITY_FLAG_HIDDEN;
2285 if (item->
itemID != ITEM_STAR_PIECE && item->
itemID != ITEM_COIN) {
2341 msgID = MSG_Menus_Tutorial_GotItem;
2343 if (item->
itemID == ITEM_STAR_PIECE) {
2344 msgID = MSG_Menus_Tutorial_GotStarPiece;
2376 menu->
enabled[numEntries] = TRUE;
2382 if (playerData->
invItems[i] != ITEM_NONE) {
2386 menu->
enabled[numEntries] = TRUE;
2430 playerStatus->
pos.
x,
2432 playerStatus->
pos.
z, 3, 0, 0
2489#define HT_VAR1 height
2503 switch (item->
state) {
2508 itemMsg = MSG_Menus_0058;
2510 itemMsg = MSG_Menus_005A;
2514 itemMsg = MSG_Menus_005D;
2517 itemMsg = MSG_Menus_005E;
2520 itemMsg = MSG_Menus_005C;
2526 item->
itemID != ITEM_STAR_PIECE &&
2533 posX = 160 - width / 2;
2537 itemMsg = MSG_Menus_0059;
2539 itemMsg = MSG_Menus_005B;
2543 itemMsg = MSG_Menus_005D;
2546 itemMsg = MSG_Menus_005E;
2549 itemMsg = MSG_Menus_005C;
2554 posX = 160 - width / 2;
2568 && item->
itemID != ITEM_STAR_PIECE)
2579 if (item->
itemID != ITEM_STAR_PIECE && item->
itemID != ITEM_COIN) {
2585 posX = 160 - width / 2;
2596 posX = 160 - width / 2;
2603#define X_PICKUP_ITEM_1 12
2604#define X_PICKUP_ITEM_2 36
2605#define X_PICKUP_THREW 36
2606#define Y_PICKUP_ITEM_1 12
2607#define Y_PICKUP_ITEM_2 12
2608#define Y_PICKUP_THREW 12
2610#define X_PICKUP_ITEM_1 15
2611#define X_PICKUP_ITEM_2 40
2612#define X_PICKUP_THREW 40
2613#define Y_PICKUP_ITEM_1 offsetY
2614#define Y_PICKUP_ITEM_2 offsetY
2615#define Y_PICKUP_THREW 4
2623 switch (item->
state) {
2630 itemMsg = MSG_Menus_0058;
2632 itemMsg = MSG_Menus_005A;
2637 itemMsg = MSG_Menus_005D;
2640 itemMsg = MSG_Menus_005E;
2643 itemMsg = MSG_Menus_005C;
2647 itemMsg = MSG_Menus_0059;
2649 itemMsg = MSG_Menus_005B;
2653 itemMsg = MSG_Menus_005D;
2656 itemMsg = MSG_Menus_005E;
2659 itemMsg = MSG_Menus_005C;
2671 || item->
itemID == ITEM_STAR_PIECE
2702 switch (item->
state) {
void create_standard_popup_menu(PopupMenu *popup)
s8 enableCollisionOverlapsCheck
AnimID trueAnimation
Encoding back-facing sprite.
struct ItemEntityPhysicsData * physicsData
Vec3f playerGroundTraceAngles
#define sfx_play_sound_at_position
#define queue_render_task
#define npc_raycast_down_sides
#define mdl_get_shroud_tint_params
struct GotItemOutlineFXData * gotItemOutline
#define ASSERT(condition)
@ ITEM_PICKUP_STATE_HIDE_TOO_MANY
@ ITEM_PICKUP_STATE_AWAIT_TUTORIAL
@ ITEM_PICKUP_STATE_SHOW_THREW_AWAY
@ ITEM_PICKUP_STATE_SHOW_GOT_ITEM
@ ITEM_PICKUP_STATE_HIDE_THREW_AWAY
@ ITEM_PICKUP_STATE_CHECK_TUTORIALS
@ ITEM_PICKUP_STATE_SHOW_TOO_MANY
@ ITEM_PICKUP_STATE_THROW_AWAY_DONE
@ ITEM_PICKUP_STATE_AWAIT_THROW_AWAY
@ ITEM_PICKUP_STATE_HIDE_GOT_ITEM
@ ITEM_PICKUP_STATE_SHOW_TUTORIAL
@ ITEM_PICKUP_STATE_AWAIT_VALID_STATE
@ ITEM_ENTITY_FLAG_DONE_FALLING
@ ITEM_ENTITY_FLAG_NO_MOTION
@ ITEM_ENTITY_FLAG_800000
@ ITEM_ENTITY_FLAG_CANT_COLLECT
@ ITEM_ENTITY_FLAG_NO_GRAVITY
@ ITEM_ENTITY_FLAG_SAVE_ON_RECEIPT
@ ITEM_ENTITY_FLAG_HIDING
@ ITEM_ENTITY_FLAG_ODD_SPAWN_PARITY
@ ITEM_ENTITY_FLAG_4000000
@ ITEM_ENTITY_FLAG_ANGLE_RELATIVE_VELOCITY
@ ITEM_ENTITY_FLAG_FULLSIZE
@ ITEM_ENTITY_FLAG_HIDDEN
@ ITEM_ENTITY_FLAG_400000
@ ITEM_ENTITY_FLAG_TRANSPARENT
@ ITEM_ENTITY_FLAG_SAVE_ON_TOUCH
@ ITEM_ENTITY_FLAG_TOSS_LOWER
@ ITEM_ENTITY_FLAG_JUST_SPAWNED
@ ITEM_ENTITY_FLAG_TOSS_HIGHER
@ ITEM_ENTITY_FLAG_SAVE_ON_INIT
@ ITEM_ENTITY_FLAG_2000000
@ ITEM_ENTITY_FLAG_NEVER_VANISH
@ ITEM_ENTITY_FLAG_AUTO_COLLECT
@ ITEM_ENTITY_FLAG_INVISIBLE
@ POPUP_MENU_THROW_AWAY_ITEM
@ ITEM_PHYSICS_STATE_TOUCH
@ ITEM_PHYSICS_STATE_INIT
@ ITEM_PHYSICS_STATE_DEAD
@ ITEM_PHYSICS_STATE_PICKUP
@ ITEM_PHYSICS_STATE_ALIVE
@ ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS_SMALL
@ ITEM_SPAWN_MODE_FIXED_NEVER_VANISH
@ ITEM_SPAWN_MODE_FIXED_SPAWN_ALWAYS
@ ITEM_SPAWN_MODE_TOSS_FADE3
@ ITEM_SPAWN_MODE_DECORATION
@ ITEM_SPAWN_MODE_INVISIBLE
@ ITEM_SPAWN_MODE_ITEM_BLOCK_ITEM
@ ITEM_SPAWN_MODE_FALL_SPAWN_ONCE
@ ITEM_SPAWN_MODE_FIXED_SPAWN_ALWAYS_NEVER_VANISH
@ ITEM_SPAWN_MODE_TOSS_FADE1
@ ITEM_SPAWN_MODE_TOSS_SPAWN_ONCE
@ ITEM_SPAWN_MODE_ITEM_BLOCK_SPAWN_ALWAYS
@ ITEM_SPAWN_MODE_BATTLE_REWARD
@ ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS
@ ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS_NEVER_VANISH
@ ITEM_SPAWN_MODE_TOSS_SPAWN_ONCE_NEVER_VANISH
@ ITEM_SPAWN_MODE_TOSS_NEVER_VANISH
@ ITEM_SPAWN_MODE_TOSS_FADE2
@ ITEM_SPAWN_MODE_TOSS_HIGHER_NEVER_VANISH
@ ITEM_SPAWN_MODE_FALL_NEVER_VANISH
@ ITEM_SPAWN_MODE_UNKNOWN_1B
@ ITEM_SPAWN_MODE_FALL_SPAWN_ALWAYS
@ ITEM_SPAWN_MODE_ITEM_BLOCK_COIN
@ ITEM_SPAWN_MODE_ITEM_BLOCK_BADGE
@ ENCOUNTER_TRIGGER_CONVERSATION
@ ITEM_TYPE_FLAG_CONSUMABLE
@ ITEM_TYPE_FLAG_WORLD_USABLE
@ ITEM_TYPE_FLAG_ENTITY_FULLSIZE
@ WINDOW_FLAG_INITIAL_ANIMATION
@ COLLIDER_FLAG_IGNORE_NPC
@ RENDER_TASK_FLAG_REFLECT_FLOOR
@ ITEM_PICKUP_FLAG_UNKNOWN
@ ITEM_PICKUP_FLAG_NO_ANIMS
@ ITEM_PICKUP_FLAG_3_STAR_PIECES
@ ITEM_PICKUP_FLAG_UNIQUE
@ ITEM_PICKUP_FLAG_NO_SOUND
@ ITEM_PICKUP_FLAG_1_COIN
@ SOUND_STAR_PIECE_BOUNCE
@ RENDER_MODE_SURFACE_XLU_LAYER1
@ ACTION_STATE_USE_MUNCHLESIA
Set by the jan_09 squishy flower entity; throws the player in the air.
@ ACTION_STATE_LAUNCH
Shy Guy Toybox jack-in-the-boxes.
@ ACTION_STATE_USE_TWEESTER
@ ACTION_STATE_USE_SPINNING_FLOWER
@ ENCOUNTER_STATE_NEUTRAL
@ GLOBAL_OVERRIDES_CANT_PICK_UP_ITEMS
@ GLOBAL_OVERRIDES_PREV_400
@ GLOBAL_OVERRIDES_DISABLE_BATTLES
@ GLOBAL_OVERRIDES_PREV_800
s32 create_worker_world(WorldArgs, WorldArgs)
s32 evt_get_variable(Evt *script, Bytecode var)
s32 is_player_dismounted(void)
b32 npc_raycast_down_around(s32, f32 *, f32 *, f32 *, f32 *, f32, f32)
void msg_printer_set_origin_pos(MessagePrintState *msgPrintState, s32 x, s32 y)
void hide_popup_menu(void)
void basic_hidden_window_update(s32 windowIndex, s32 *flags, s32 *posX, s32 *posY, s32 *posZ, f32 *scaleX, f32 *scaleY, f32 *rotX, f32 *rotY, f32 *rotZ, s32 *darkening, s32 *opacity)
void set_standard_shadow_scale(Shadow *shadow, f32 scale)
void set_window_update(s32 panelID, s32)
void partner_disable_input(void)
s32 npc_test_move_complex_with_slipping(s32, f32 *, f32 *, f32 *, f32, f32, f32, f32)
void suggest_player_anim_always_forward(AnimID anim)
void sort_consumables(void)
Bubbles up player inventory items such that all ITEM_NONE values are at the bottom.
void decrement_status_bar_disabled(void)
s32 imgfx_appendGfx_component(s32, ImgFXTexture *, u32, Matrix4f)
void func_801491E4(Matrix4f mtx, s32, s32, s32, s32, s32 alpha)
s32 disable_player_input(void)
Shadow * get_shadow_by_index(s32 index)
s32 resume_all_group(s32 groupFlags)
void basic_window_update(s32 windowIndex, s32 *flags, s32 *posX, s32 *posY, s32 *posZ, f32 *scaleX, f32 *scaleY, f32 *rotX, f32 *rotY, f32 *rotZ, s32 *darkening, s32 *opacity)
s32 evt_set_variable(Evt *script, Bytecode var, s32 value)
s32 enable_player_input(void)
void destroy_popup_menu(void)
s32 is_starting_conversation(void)
b32 npc_test_move_simple_with_slipping(s32, f32 *, f32 *, f32 *, f32, f32, f32, f32)
void set_action_state(s32 actionState)
MessagePrintState * msg_get_printer_for_msg(s32 msgID, s32 *a1)
b32 npc_raycast_up(s32, f32 *, f32 *, f32 *, f32 *)
s32 create_shadow_type(s32 type, f32 x, f32 y, f32 z)
void set_message_text_var(s32 msgID, s32 index)
void set_window_properties(s32 panelID, s32 posX, s32 posY, s32 width, s32 height, u8, void *drawContents, void *drawContentsArg, s8 parent)
s32 does_script_exist(s32 id)
s32 get_time_freeze_mode(void)
void set_time_freeze_mode(s32)
Time freeze modes: 0: none 1: NPCs move, can't be interacted with 2: NPCs don't move,...
s32 create_worker_frontUI(void(*updateFunc)(void), void(*drawFunc)(void))
void add_vec2D_polar(f32 *x, f32 *y, f32 r, f32 theta)
f32 get_clamped_angle_diff(f32, f32)
void * heap_malloc(s32 size)
void increment_status_bar_disabled(void)
s32 get_msg_lines(s32 messageID)
void hud_element_set_script(s32 id, HudScript *anim)
void hud_element_draw_next(s32 id)
void hud_element_set_render_pos(s32 id, s32 x, s32 y)
s32 hud_element_create(HudScript *anim)
Creates a new HUD element and returns its ID.
void hud_element_set_flags(s32 id, s32 flags)
Turns on the given flags.
void hud_element_free(s32 id)
s32 add_item(s32 itemID)
Add itemID to player inventory and return inventory slot in which it was placed.
void draw_content_pickup_item_desc(ItemEntity *item, s32 posX, s32 posY)
void reveal_item_entity(ItemEntity *item)
void set_item_entity_flags(s32 index, s32 flags)
void clear_item_entity_data(void)
BSS PopupMenu ItemPickupMenu
void init_item_entity_list(void)
s16 PickupMessageWindowYOffsets[]
u8 * gHudElementCacheBuffer
BSS s16 CoinSparkleCenterY
#define MAX_ITEM_ENTITIES
void update_item_entity_pickup(ItemEntity *)
void item_entity_load(ItemEntity *item)
BSS s16 CoinSparkleCenterZ
HudCacheEntry * gHudElementCacheTablePalette
void update_item_entity_collectable(ItemEntity *)
SparkleScript SparkleScript_Coin
b32 is_picking_up_item(void)
BSS s32 pad_ItemEntity[3]
BSS s32 ItemEntityAlternatingSpawn
void set_current_item_entity_render_group(s32 group)
void clear_item_entity_flags(s32 index, s32 flags)
ItemEntity * get_item_entity(s32 itemEntityIndex)
void appendGfx_item_entity(void *)
s32 * gHudElementCacheSize
s32 make_item_entity_nodelay(s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode, s32 pickupVar)
HudCacheEntry * gHudElementCacheTableRaster
s32 test_item_player_collision(ItemEntity *)
BSS s16 ItemSpawnWithinPlayerPickupDelay
void draw_item_entities(void)
s32 * gItemEntityScripts[]
s32 test_item_entity_position(f32 x, f32 y, f32 z, f32 dist)
void draw_content_cant_carry_more(ItemEntity *item, s32 posX, s32 posY)
void draw_ui_item_entity_collectable(ItemEntity *)
void draw_content_pickup_item_header(ItemEntity *item, s32 posX, s32 posY)
void draw_ui_item_entity_no_pickup(ItemEntity *)
BSS EffectInstance * ItemPickupGotOutline
void draw_ui_item_entities(void)
BSS ItemEntity ** gCurrentItemEntities
BSS s16 CoinSparkleCenterX
void remove_item_entity_by_index(s32 index)
BSS s32 UnusedItemPhysicsScriptID
void func_801363A0(ItemEntity *)
void update_item_entity_no_pickup(ItemEntity *)
void draw_ui_item_entity_stationary(ItemEntity *)
void item_entity_update(ItemEntity *)
s32 make_item_entity_at_player(s32 itemID, s32 category, s32 pickupMsgFlags)
BSS ItemEntity * BattleItemEntities[256]
void update_item_entities(void)
void func_80133A94(s32 idx, s32 itemID)
BSS s32 ItemPickupStateDelay
void auto_collect_item_entity(s32 index)
void draw_coin_sparkles(ItemEntity *item)
BSS s32 ItemEntityRenderGroup
s32 make_item_entity(s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode, s32 pickupDelay, s32 angle, s32 pickupFlagIndex)
s16 PickupHeaderWindowHeight[]
BSS b32 GotItemTutorialClosed
s32 sparkle_script_step(ItemEntity *item)
s32 make_item_entity_delayed(s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode, s32 pickupDelay, s32 pickupVar)
s32 get_current_item_entity_render_group(void)
BSS MessagePrintState * GotItemTutorialPrinter
void remove_item_entity_by_reference(ItemEntity *entity)
void render_item_entities(void)
void sparkle_script_update(ItemEntity *item)
void sparkle_script_init(ItemEntity *item, SparkleScript *script)
void update_item_entity_stationary(ItemEntity *)
BSS ItemEntity * WorldItemEntities[256]
void set_item_entity_position(s32 itemEntityIndex, f32 x, f32 y, f32 z)
void hide_item_entity(ItemEntity *item)
@ ITEM_SCRIPT_OP_RandomRestart
@ ITEM_SCRIPT_OP_SetImage
EncounterStatus gCurrentEncounter
void partner_enable_input(void)
void sfx_play_sound(s32 soundID)
@ GF_Tutorial_GotStarPiece
#define EVT_GAME_FLAG_CUTOFF
#define EVT_INDEX_OF_GAME_FLAG(v)
void(* appendGfx)(void *)
PartnerStatus gPartnerStatus
GameStatus * gGameStatusPtr
SpriteShadingProfile * gSpriteShadingProfile
PlayerStatus gPlayerStatus
DisplayContext * gDisplayContext
s32 set_global_flag(s32 index)
s32 get_global_flag(s32 index)