1#include "collisiondata.hpp"
7#include "debugfont.hpp"
8#include "dngmessageman.hpp"
9#include "dun/gameloop.hpp"
10#include "dungeoneventman.hpp"
16#include "mainselect.hpp"
22#include "userstatus.hpp"
28int DebugInfoCode[15] = {DEBUG_INFO_MINIMAP_VIEW, DEBUG_INFO_COLLISION, DEBUG_INFO_BGM_PLAY, DEBUG_INFO_PARAMETER, DEBUG_INFO_VIEW_INFO, DEBUG_INFO_ULTRA_MAN, DEBUG_INFO_RELOAD_ENEMY, DEBUG_INFO_ITEM_PUT_ZONE, DEBUG_INFO_LIGHT_MODE, DEBUG_INFO_FLOOR_ATRA_GET, DEBUG_INFO_EVENT_TEST, DEBUG_INFO_SET_STATUS, DEBUG_INFO_SE_PLAY, DEBUG_INFO_SET_CHR_KEY, -1};
34char *DebugInfoMsg[15] = {
35 DebugInfoMsgMiniMapView, DebugInfoMsgCollision, DebugInfoMsgBgmPlay, DebugInfoMsgParameter,
36 DebugInfoMsgViewInfo, DebugInfoMsgUltraMan, DebugInfoMsgReloadEnemy, DebugInfoMsgItemPutZone,
37 DebugInfoMsgLightMode, DebugInfoMsgFloorAtraGet, DebugInfoMsgEventTest, DebugInfoMsgSetStatus,
38 DebugInfoMsgSePlay, DebugInfoMsgSetChrKey, NULL,
45int DebugInfoNowCursor;
62void DebugInfomationDraw() {
63 if (DebugStatus[0] != 1) {
64 if (DebugStatus[4] != 0) {
67 sceVu0FVECTOR cam_pos;
68 sceVu0FVECTOR cam_ref;
86 DbgMsg.
length = sprintf(DbgMsg.
text,
" ---Infomation---\n");
87 sceVu0CopyVector(pos, CharaMain.
pos);
89 NowCamera__3->
GetPos(cam_pos);
90 NowCamera__3->
GetRef(cam_ref);
94 tile_x = (int) ((pos[0] - 80.0f) / 160.0f) * 160;
95 local_x = pos[0] - tile_x - 160.0f;
97 tile_z = (int) ((pos[2] - 80.0f) / 160.0f) * 160;
98 local_z = pos[2] - tile_z - 160.0f;
99 cam_local_x = cam_pos[0] - tile_x - 160.0f;
100 cam_local_y = cam_pos[1];
101 cam_local_z = cam_pos[2] - tile_z - 160.0f;
102 ref_local_x = cam_ref[0] - tile_x - 160.0f;
103 ref_local_y = cam_ref[1];
104 ref_local_z = cam_ref[2] - tile_z - 160.0f;
105 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length],
"gpos %.2f/ %.2f/ %.2f\n", pos[0], pos[1], pos[2]);
106 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length],
"lpos %.2f/ %.2f/ %.2f\n", local_x, local_y, local_z);
107 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length],
"rot %.2f/ %.2f/ %.2f\n", rot[0], rot[1], rot[2]);
109 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length],
"cpos %.2f/ %.2f/ %.2f\n", cam_pos[0], cam_pos[1], cam_pos[2]);
110 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length],
"cref %.2f/ %.2f/ %.2f\n", cam_ref[0], cam_ref[1], cam_ref[2]);
111 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length],
"lcpos %.2f/ %.2f/ %.2f\n", cam_local_x, cam_local_y, cam_local_z);
112 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length],
"lcref %.2f/ %.2f/ %.2f\n", ref_local_x, ref_local_y, ref_local_z);
113 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length],
"Angle = %.3f\n", angle);
114 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length],
"Dist = %.3f\n", distance);
115 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length],
"Height = %.3f\n", height);
117 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length],
"WeaponList Ver 2000/%d\n", VERSION_VOL);
121 if (event_data != NULL) {
126 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length],
"EventID = %d\n", event_count);
128 MGFillBox(
CRect_i_(0x200, 0x280, 0x1000, 0x780), 8, 8, 8, 0x60);
130 MGFillBox(
CRect_i_(0x200, 0x280, 0x1000, 0x700), 8, 8, 8, 0x60);
139 char *on_off_names[2] = {
"OFF",
"ON"};
140 char *main_sub_names[2] = {
"MAIN",
"SUB"};
141 char *condition_names[6] = {
"RESET",
"STONE",
"BIN2",
"POISON",
"CURSE",
"NEBA2"};
142 char *power_names[3] = {
"HUMAN ",
"SUPERMAN",
"ULTRAMAN"};
145 for (
int i = 0; DebugInfoMsg[i] != NULL; i++) {
146 if (DebugInfoNowCursor == i) {
152 switch (DebugInfoCode[i]) {
153 case DEBUG_INFO_NONE:
156 case DEBUG_INFO_UNK_28:
157 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length], DebugInfoMsg[i], DebugStatus[8]);
159 case DEBUG_INFO_BGM_PLAY:
160 if (DebugStatus[9] == -1) {
161 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length], DebugInfoMsg[i],
"OFF");
163 sprintf(bgm_text,
"%d", DebugStatus[9] + 1);
164 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length], DebugInfoMsg[i], bgm_text);
168 case DEBUG_INFO_PARAMETER:
169 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length], DebugInfoMsg[i], on_off_names[DebugStatus[10]]);
171 case DEBUG_INFO_COLLISION:
172 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length], DebugInfoMsg[i], on_off_names[DebugStatus[5]]);
174 case DEBUG_INFO_VIEW_INFO:
175 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length], DebugInfoMsg[i], on_off_names[DebugStatus[4]]);
177 case DEBUG_INFO_ITEM_PUT_ZONE:
178 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length], DebugInfoMsg[i], on_off_names[DebugStatus[6]]);
180 case DEBUG_INFO_MINIMAP_VIEW:
181 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length], DebugInfoMsg[i], on_off_names[DebugStatus[3]]);
183 case DEBUG_INFO_ULTRA_MAN:
184 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length], DebugInfoMsg[i], power_names[DebugStatus[20]]);
186 case DEBUG_INFO_RELOAD_ENEMY:
187 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length], DebugInfoMsg[i], DebugStatus[14], DebugStatus[15]);
189 case DEBUG_INFO_FLOOR_ATRA_GET:
192 case DEBUG_INFO_LIGHT_MODE:
193 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length], DebugInfoMsg[i], main_sub_names[DebugStatus[16]]);
195 case DEBUG_INFO_EVENT_TEST:
196 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length], DebugInfoMsg[i], DebugStatus[11]);
198 case DEBUG_INFO_SET_STATUS:
199 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length], DebugInfoMsg[i], condition_names[DebugStatus[17]]);
201 case DEBUG_INFO_SE_PLAY:
202 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length], DebugInfoMsg[i], DebugStatus[18]);
204 case DEBUG_INFO_SET_CHR_KEY:
205 DbgMsg.
length += sprintf(&DbgMsg.
text[DbgMsg.
length], DebugInfoMsg[i], DebugStatus[19]);
211 MGFillBox(
CRect_i_(0x200, 0x280, 0x1000, 0x780), 8, 8, 8, 0x60);
213 MGFillBox(
CRect_i_(0x200, 0x280, 0x1000, 0x700), 8, 8, 8, 0x60);
225void DebugInfomationInit() {
234 DebugStatus[8] = 150;
237 DebugStatus[11] = 100;
239 DebugStatus[13] = 16;
241 DebugStatus[15] = 16;
244 DebugStatus[18] = 400;
255 for (i = 0; i < 96; i++) {
269static inline void ClearMapEvent(
CDungeonMap *map) {
272 for (i = 0; i < 48; i++) {
277 for (i = 0; i < 24; i++) {
285 for (i = 0; i < 8; i++) {
291 for (i = 0; i < 4; i++) {
303int DebugInfomationIF() {
306 if (GamePad.
Down(PAD_R3)) {
310 return DEBUG_INFO_CLOSE;
313 if (GamePad.
Down(PAD_TRIANGLE)) {
314 switch (DebugInfoCode[DebugInfoNowCursor]) {
315 case DEBUG_INFO_EVENT_TEST:
320 return DEBUG_INFO_UNK_28;
324 if (GamePad.
Down(PAD_CIRCLE)) {
325 switch (DebugInfoCode[DebugInfoNowCursor]) {
326 case DEBUG_INFO_UNK_28:
330 return DEBUG_INFO_UNK_28;
331 case DEBUG_INFO_UNK_3C:
335 return DEBUG_INFO_UNK_3C;
336 case DEBUG_INFO_RELOAD_ENEMY:
340 return DEBUG_INFO_RELOAD_ENEMY;
341 case DEBUG_INFO_FLOOR_ATRA_GET:
345 return DEBUG_INFO_FLOOR_ATRA_GET;
346 case DEBUG_INFO_EVENT_TEST:
351 return DEBUG_INFO_EVENT_TEST;
352 case DEBUG_INFO_SET_STATUS:
356 return DEBUG_INFO_SET_STATUS;
357 case DEBUG_INFO_SE_PLAY:
358 SndSePlay(DebugStatus[18], -1, 0);
360 case DEBUG_INFO_SET_CHR_KEY:
364 ClearEventData(NowEventMan);
365 printf(
"trap num = %d\n", NowDngMap->
SetCharaDoor(DebugStatus[19]));
366 ClearMapEvent(NowDngMap);
372 return DEBUG_INFO_SET_CHR_KEY;
376 for (line_count = 0; DebugInfoCode[line_count] != -1; line_count++) {
379 switch (DebugStatus[2]) {
381 if (GamePad.
Down(PAD_DOWN)) {
382 if (DebugInfoNowCursor == line_count - 1) {
383 DebugInfoNowCursor = 0;
385 DebugInfoNowCursor++;
389 if (GamePad.
Down(PAD_UP)) {
390 if (DebugInfoNowCursor == 0) {
391 DebugInfoNowCursor = line_count - 1;
393 DebugInfoNowCursor--;
397 if (GamePad.
Down(PAD_RIGHT)) {
398 switch (DebugInfoCode[DebugInfoNowCursor]) {
399 case DEBUG_INFO_MINIMAP_VIEW:
400 if (DebugStatus[3] == 0) {
407 case DEBUG_INFO_COLLISION:
408 if (DebugStatus[5] == 0) {
415 case DEBUG_INFO_ITEM_PUT_ZONE:
416 if (DebugStatus[6] == 0) {
423 case DEBUG_INFO_VIEW_INFO:
424 if (DebugStatus[4] == 0) {
431 case DEBUG_INFO_PARAMETER:
432 if (DebugStatus[10] == 0) {
439 case DEBUG_INFO_ULTRA_MAN:
440 if (DebugStatus[20] == 2) {
447 case DEBUG_INFO_RELOAD_ENEMY:
448 if (DebugStatus[14] < 4) {
455 case DEBUG_INFO_BGM_PLAY:
458 if (DebugStatus[9] != -1) {
459 SndBgmLoad(DebugStatus[9] * 10 + 100);
466 case DEBUG_INFO_EVENT_TEST:
469 case DEBUG_INFO_LIGHT_MODE:
470 if (DebugStatus[16] == 0) {
477 case DEBUG_INFO_SET_STATUS:
478 if (DebugStatus[17] == 5) {
485 case DEBUG_INFO_SE_PLAY:
488 case DEBUG_INFO_SET_CHR_KEY:
489 if (DebugStatus[19] >= 5) {
499 if (GamePad.
Down(PAD_LEFT)) {
500 switch (DebugInfoCode[DebugInfoNowCursor]) {
501 case DEBUG_INFO_MINIMAP_VIEW:
502 if (DebugStatus[3] == 0) {
509 case DEBUG_INFO_COLLISION:
510 if (DebugStatus[5] == 0) {
517 case DEBUG_INFO_ITEM_PUT_ZONE:
518 if (DebugStatus[6] == 0) {
525 case DEBUG_INFO_VIEW_INFO:
526 if (DebugStatus[4] == 0) {
533 case DEBUG_INFO_PARAMETER:
534 if (DebugStatus[10] == 0) {
541 case DEBUG_INFO_ULTRA_MAN:
542 if (DebugStatus[20] == 0) {
549 case DEBUG_INFO_RELOAD_ENEMY:
550 if (DebugStatus[14] > 0) {
557 case DEBUG_INFO_BGM_PLAY:
558 if (DebugStatus[9] > -1) {
562 if (DebugStatus[9] != -1) {
563 SndBgmLoad(DebugStatus[9] * 10 + 100);
570 case DEBUG_INFO_EVENT_TEST:
571 if (DebugStatus[11] > 0) {
576 case DEBUG_INFO_LIGHT_MODE:
577 if (DebugStatus[16] == 0) {
584 case DEBUG_INFO_SET_STATUS:
585 if (DebugStatus[17] == 0) {
592 case DEBUG_INFO_SE_PLAY:
595 case DEBUG_INFO_SET_CHR_KEY:
596 if (DebugStatus[19] <= 0) {
606 if (GamePad.
Down(PAD_L1)) {
607 switch (DebugInfoCode[DebugInfoNowCursor]) {
608 case DEBUG_INFO_EVENT_TEST:
609 if (DebugStatus[11] > 0) {
610 DebugStatus[11] -= 10;
613 if (DebugStatus[11] < 0) {
618 case DEBUG_INFO_RELOAD_ENEMY:
619 if (DebugStatus[15] > 0) {
622 DebugStatus[15] = 16;
626 case DEBUG_INFO_SE_PLAY:
627 if (DebugStatus[18] > 0) {
628 DebugStatus[18] -= 10;
631 if (DebugStatus[18] < 0) {
639 if (GamePad.
Down(PAD_R1)) {
640 switch (DebugInfoCode[DebugInfoNowCursor]) {
641 case DEBUG_INFO_EVENT_TEST:
642 DebugStatus[11] += 10;
644 case DEBUG_INFO_RELOAD_ENEMY:
645 if (DebugStatus[15] < 16) {
652 case DEBUG_INFO_SE_PLAY:
653 DebugStatus[18] += 10;
661 return DEBUG_INFO_NONE;
668int center_us[7] = {0xCE, 0x125, 0x101, 0x100, 0x87, 0x57, 0x101};
673int center_fr[7] = {0xCD, 0x113, 0xF8, 0xF8, 0xB2, 0x59, 0xFF};
678int center_gr[7] = {0xFE, 0x103, 0x13D, 0xFD, 0x78, 0x38, 0xFF};
683int center_it[7] = {0xCC, 0x129, 0xF3, 0xFF, 0xFA, 0x75, 0xF9};
688int center_sp[7] = {0xCE, 0x12C, 0xF2, 0xFA, 0x7C, 0xBA, 0xFA};
693int *center_ptr[7] = {center_sp, center_us, center_us, center_fr, center_gr, center_it, center_sp};
695void StartMessageDraw(
CTexture *texture,
int dungeon,
int floor,
int ura,
int alpha) {
696 int *centers = center_ptr[LanguageCode];
697 int x = centers[dungeon] + 0x82;
700 set2DSprite(Vif1Packet, texture,
CRect_i_(0x82, 0xAA, 0x17C, 0x32),
CRect_i_(0, 0, 0x17C, 0x32), alpha);
704 if (dungeon == DUNGEON_GALLERY_OF_TIME) {
705 floor = BtGetFloorLevel(floor - 1);
710 digit_x = floor % 10 * 0x26;
711 set2DSprite(Vif1Packet, texture,
CRect_i_(x, 0xAA, 0x26, 0x32),
CRect_i_(digit_x, 0x32, 0x26, 0x32), alpha);
714 if (floor >= 10 && floor < 100) {
716 digit_x = floor / 10 * 0x26;
717 set2DSprite(Vif1Packet, texture,
CRect_i_(x, 0xAA, 0x26, 0x32),
CRect_i_(digit_x, 0x32, 0x26, 0x32), alpha);
718 digit_x = floor % 10 * 0x26;
719 set2DSprite(Vif1Packet, texture,
CRect_i_(x + 0x26, 0xAA, 0x26, 0x32),
CRect_i_(digit_x, 0x32, 0x26, 0x32), alpha);
723 int digit = floor / 100;
725 digit_x = digit * 0x26;
726 floor -= digit * 100;
727 set2DSprite(Vif1Packet, texture,
CRect_i_(x - 0x39, 0xAA, 0x26, 0x32),
CRect_i_(digit_x, 0x32, 0x26, 0x32), alpha);
728 digit_x = floor / 10 * 0x26;
729 set2DSprite(Vif1Packet, texture,
CRect_i_(x - 0x13, 0xAA, 0x26, 0x32),
CRect_i_(digit_x, 0x32, 0x26, 0x32), alpha);
730 digit_x = floor % 10 * 0x26;
731 set2DSprite(Vif1Packet, texture,
CRect_i_(x + 0x13, 0xAA, 0x26, 0x32),
CRect_i_(digit_x, 0x32, 0x26, 0x32), alpha);
735 set2DSprite(Vif1Packet, texture,
CRect_i_(0x10E, 0xE6, 0x64, 0x32),
CRect_i_(0x114, 0x7C, 0x64, 0x32), alpha);
740 set2DSprite(Vif1Packet, texture,
CRect_i_(0xC8, 0xE6, 0xF0, 0x32),
CRect_i_(0, 0x7C, 0xF0, 0x32), alpha);
752void ClearGateKeyStack() {
753 for (
int i = 0; i < 32; i++) {
754 gateKeyStack[i] = -1;
758int SetGateKeyStack(
int item) {
764 for (
int i = 0; i < 32; i++) {
765 if (item == gateKeyStack[i]) {
770 for (
int i = 0; i < 32; i++) {
771 if (gateKeyStack[i] == -1) {
772 gateKeyStack[i] = item;
787char *NameExchg(
char *name,
int language) {
789 strcpy(nameblock, LanguageStr[LanguageCode]);
791 strcpy(nameblock, LanguageStr[language][1]);
793 strcat(nameblock, name);
797int CCollisionData::Set(
float *position,
int damage,
int life,
float radius,
float scale_rate,
int target_mask,
int kind,
int flags,
int attribute) {
798 for (
int i = 0; i < 96; i++) {
801 sceVu0CopyVector(
hit[i].pos, position);
842 sceVu0FVECTOR user_position;
843 sceVu0FVECTOR hit_position;
844 sceVu0CopyVector(user_position, position);
845 user_position[1] = 0.0f;
847 float user_bottom = position[1];
848 user_top = user_bottom + height;
850 for (
int i = 0; i < 96; i++) {
851 if (
active[i] == 0 || (mask &
hit[i].target_mask) == 0 ||
hit[i].phase !=
hit[i].ready_phase) {
855 sceVu0CopyVector(hit_position,
hit[i].pos);
856 hit_position[1] = 0.0f;
858 if (DistVector(user_position, hit_position) >
hit[i].radius) {
866 if (!(hit_top < user_top) && hit_bottom < user_top) {
870 if (!(hit_top < user_bottom) && hit_bottom < user_bottom) {
874 if (hit_top <= user_top && !(hit_bottom <= user_bottom)) {
878 if (!(hit_top < user_top) && hit_bottom < user_bottom) {
int CheckHitUser(float *position, int mask, float height)
int Set(float *position, int damage, int life, float radius, float scale_rate, int target_mask, int kind, int flags, int attribute)
void SetKickBack(float *origin, float speed, float decay, int mode)
CDungeonEventData event[96]
void SetupEvent(CDungeonMap *map, int mode)
CDungeonEventData * SearchDataSlotPos(float *position)
ROOM_LINK_RESULT room_link[4]
int SetCharaDoor(int chara_no)
virtual void GetRotation(float *out_rotation)
s32 res_limit_zone_current
sceVu0FVECTOR knockback_origin