1#pragma helper_mask_gpr 0x30
2#pragma helper_mask_fpr 0x1000
3#pragma name_counter 604
5#include "shot_utils.hpp"
10#include "dataalloc.hpp"
12#include "dranmapfield.hpp"
13#include "dun/gameloop.hpp"
18#include "monstorunit.hpp"
22#include "userstatus.hpp"
24SHOT_COLLISION_RESULT checkCollision(
float *hit_position,
float *position,
float *movement, s32 target_mode,
float radius) {
25 sceVu0FVECTOR destination;
30 int polygon_count = setCollisionData(NowDngMap, polygons, position, 20.0f, 1.5f);
32 if (polygon_count >= 256) {
33 printf(fishing_err_format, polygon_count);
36 destination[0] = position[0] + movement[0];
37 destination[1] = position[1] + movement[1];
38 destination[2] = position[2] + movement[2];
40 if (target_mode != 2) {
41 sceVu0FVECTOR player_position;
43 sceVu0CopyVector(player_position, CharaMain.
pos);
44 player_position[1] += CharaHeight(UserStatus);
46 if (DistVector(player_position, destination) <= radius + 6.0f) {
47 sceVu0CopyVector(hit_position, player_position);
48 return SHOT_COLLISION_PLAYER;
52 if (target_mode != 1) {
53 for (
int monster_no = 0; monster_no < 16; monster_no++) {
58 if (monster_no >= 0 && monster_no < 17) {
66 for (
int sphere_no = 0; sphere_no < 16; sphere_no++) {
67 if (NowMonstorUnit->
effect[monster_no].
timer[sphere_no] != 0 && DistVector(NowMonstorUnit->
effect[monster_no].
position[sphere_no], position) <= radius + NowMonstorUnit->
effect[monster_no].
radius[sphere_no]) {
68 sceVu0CopyVector(hit_position, NowMonstorUnit->
effect[monster_no].
position[sphere_no]);
69 return SHOT_COLLISION_MONSTER;
75 int hit = CheckHit(polygons, polygon_count, position, destination, hit_position, 1, 4);
78 CCPoly *poly = &polygons[hit];
81 if (field_no > 0 && field_no < 13) {
84 if (field_set->
state[field_no - 1] >= 2) {
89 return SHOT_COLLISION_MAP;
92 sceVu0CopyVector(hit_position, position);
93 return SHOT_COLLISION_NONE;
96void set3DCellModel(
float *world,
char *texture_name,
float size, s32 x, s32 y, s32 width, s32 height, u8 blend) {
97 sceVu0IVECTOR top_left;
98 sceVu0IVECTOR top_right;
99 sceVu0IVECTOR bottom_left;
100 sceVu0IVECTOR bottom_right;
101 CTexture *texture = TexManager.GetTexture(texture_name, -1);
106 if (MGRotTransPers3DSprite(top_left, bottom_right, world, size, size / 2.0f, 0) == 1) {
107 top_right[0] = bottom_right[0];
108 top_right[1] = top_left[1];
109 top_right[2] = top_left[2];
110 bottom_left[0] = top_left[0];
111 bottom_left[1] = bottom_right[1];
112 bottom_left[2] = bottom_right[2];
113 set3DSprite(Vif1Packet, texture,
CRect_i_(x, y, width, height), top_left, top_right, bottom_left, bottom_right, blend);
MONSTOR_EFFECT_STATE effect[16]
CDataAlloc2< 1 > * WorkBuffer__2
sceVu0FVECTOR position[16]