1#include "itembombeffect.hpp"
6#include "collisiondata.hpp"
7#include "dun/gameloop.hpp"
11#include "shot_freefuncs.hpp"
14#include "userstatus.hpp"
23int checkItemUsed(
int slot) {
32 water_now = UserStatus->
water_now[character];
33 water_max = UserStatus->
water_max[character];
34 hp = UserStatus->
hp[character];
35 max_hp = UserStatus->
max_hp[character];
36 condition = UserStatus->
ailments[character];
46 case ITEM_REGULAR_WATER:
47 case ITEM_TASTY_WATER:
48 case ITEM_PREMIUM_WATER:
49 if (!(0.2f + water_now < water_max)) {
54 case ITEM_ANTIDOTE_DRINK:
55 if ((condition & AILMENT_POISON) == 0) {
61 if ((condition & AILMENT_GOO) == 0) {
66 case ITEM_MIGHTY_HEALING:
67 if ((condition & (AILMENT_FREEZE | AILMENT_POISON | AILMENT_CURSE | AILMENT_GOO)) == 0) {
73 case ITEM_PREMIUM_CHICKEN:
75 case ITEM_MELLOW_BANANA:
97 if (item == ITEM_MELLOW_BANANA) {
103 item -= ITEM_ATTACH_START;
109 s16 life = ITEM_LIST[item].
vol;
115 s16 drink = (&ITEM_LIST[item].
vol)[vol_index];
120 if ((ITEM_LIST[item].kind_flags & 1) != 0) {
121 if ((ITEM_LIST[item].use_flags & 0x1000) != 0) {
122 BtSetStatusErr(AILMENT_STAMINA);
123 SndSePlay(SE_POWER_UP, -1, 0);
126 if ((ITEM_LIST[item].use_flags & 0x20000) != 0 && (UserStatus->
ailments[character] & AILMENT_GOO) != 0) {
127 UserStatus->
ailments[character] = 0;
130 if ((ITEM_LIST[item].use_flags & 0x8000) != 0 && (UserStatus->
ailments[character] & AILMENT_POISON) != 0) {
131 UserStatus->
ailments[character] = 0;
134 if ((ITEM_LIST[item].use_flags & 0x3C000) != 0 && (UserStatus->
ailments[character] != 0 || UserStatus->
ailments[character] != AILMENT_STAMINA)) {
135 UserStatus->
ailments[character] = 0;
147int SetBombEffect(
float *position,
int owner,
int damage,
float scale) {
148 int collision_slot = -1;
150 for (
int bomb = 0; bomb < 3; bomb++) {
151 if (NowBombEffect[bomb].CheckBomb() != 0) {
155 NowBombEffect[bomb].
SetBomb(position, scale);
156 SndSePlay(SE_EXPLOSION, -1, 0);
157 collision_slot = NowColData->
Set(position, damage, (
int) (45.0f * scale), 20.0f * scale, 0.0f, owner, 3, 0, 0);
159 if (collision_slot != -1) {
167 sceVu0CopyVector(wave->
position, position);
180 return collision_slot;
191 static int uvTable[4][2] = {
197 sceVu0FVECTOR camera_position;
198 sceVu0FVECTOR direction;
205 camera->
GetPos(camera_position);
211 MGSetGsALPHA(&alpha);
213 zbuffer.bits.zmsk = 1;
214 MGSetGsZBUF(&zbuffer);
216 for (
int i = 0; i < 5; i++) {
227 int u = uvTable[cell][0] << 6;
228 int v = uvTable[cell][1] << 6;
229 direction[0] = camera_position[0] -
positions[i][0];
230 float *up = &direction[1];
232 direction[2] = camera_position[2] -
positions[i][2];
233 sceVu0Normalize(direction, direction);
234 direction[0] *= i * 5.0f +
phases[i] * 2.0f;
235 direction[2] *= i * 5.0f +
phases[i] * 2.0f;
236 world[0] = direction[0] +
positions[i][0];
238 world[2] = direction[2] +
positions[i][2];
243 if (MGRotTransPers3DSprite(top_left, bottom_right, world, size, size / 2.0f, 0) != 1) {
247 top_right[0] = bottom_right[0];
248 top_right[1] = top_left[1];
249 top_right[2] = top_left[2];
250 top_right[3] = top_left[3];
251 bottom_left[0] = top_left[0];
252 bottom_left[1] = bottom_right[1];
253 bottom_left[2] = bottom_right[2];
254 bottom_left[3] = bottom_right[3];
256 set3DSprite(Vif1Packet, TexManager.GetTexture(
"bomb_ex", -1), source, top_left, top_right, bottom_left, bottom_right, (u8)
alphas[i]);
271 for (
int puff = 0; puff < 5; puff++) {
332 for (
int puff = 0; puff < 5; puff++) {
333 sceVu0CopyVector(
positions[puff], position);
354 for (
int puff = 0; puff < 5; puff++) {
371 for (
int puff = 0; puff < 5; puff++) {
384 sceVu0FVECTOR corner0;
385 sceVu0FVECTOR corner1;
386 sceVu0FVECTOR corner2;
387 sceVu0FVECTOR corner3;
392 sceVu0FVECTOR camera_position;
393 sceVu0FVECTOR direction;
399 camera->
GetPos(camera_position);
400 direction[0] = camera_position[0] -
position[0];
401 float *up = &direction[1];
403 direction[2] = camera_position[2] -
position[2];
404 sceVu0Normalize(direction, direction);
405 direction[0] *= 10.0f;
406 direction[2] *= 10.0f;
408 sceVu0CopyVector(corner0,
position);
411 sceVu0CopyVector(corner1,
position);
414 sceVu0CopyVector(corner2,
position);
417 sceVu0CopyVector(corner3,
position);
421 if (MGRotTransPers(screen0, corner0, 0) == 0) {
425 if (MGRotTransPers(screen1, corner1, 0) == 0) {
429 if (MGRotTransPers(screen2, corner2, 0) == 0) {
433 if (MGRotTransPers(screen3, corner3, 0) == 0) {
442 MGSetGsALPHA(&blend);
444 zbuffer.bits.zmsk = 1;
445 MGSetGsZBUF(&zbuffer);
446 CRect_i_ source(0x80, 0, 0x40, 0x40);
447 set3DSprite(Vif1Packet, TexManager.GetTexture(
"bomb_ex", -1), source, screen0, screen1, screen2, screen3, (u8)
alpha);
464 const float half_pi = HALF_PI;
466 if (
phase < half_pi) {
468 float envelope = sinf(
phase);
469 alpha = 160.0f * envelope;
473 if (
phase >= half_pi) {
int Set(float *position, int damage, int life, float radius, float scale_rate, int target_mask, int kind, int flags, int attribute)
void SetBomb(float *position, float scale)
sceVu0FVECTOR positions[5]
void Draw(CCamera *camera)
void Draw(CCamera *camera)
void AddDrink(int chara_no, s16 amount, float ratio)
void AddNowLife(int chara_no, s16 amount, float ratio)