1#pragma helper_mask_gpr 0x30
2#pragma helper_mask_fpr 0x1000
3#include "shot_freefuncs.hpp"
13static int maxFloorTbl[7] = {15, 17, 18, 18, 15, 25, 100};
18static int defWeapon[6] = {ITEM_WEAPON_DAGGER_BROKEN, ITEM_WEAPON_WOODENSLINGSHOT_BROKEN, ITEM_WEAPON_MALLET_BROKEN, ITEM_WEAPON_GOLD_RING_BROKEN, ITEM_WEAPON_FIGHTING_STICK_BROKEN, ITEM_WEAPON_MACHINE_GUN_BROKEN};
27#include "btactstatus.hpp"
31#include "clothread.hpp"
33#include "dataalloc.hpp"
35#include "dranmapfield.hpp"
36#include "dun/gameloop.hpp"
37#include "dungeoneventman.hpp"
40#include "healeffect.hpp"
41#include "hitvalue.hpp"
42#include "mainselect.hpp"
44#include "menu_inventory.hpp"
46#include "monstorunit.hpp"
47#include "motionmodel.hpp"
52#include "userstatus.hpp"
95float statusAlarmCounter;
100u8 statusRGBColor_life[4];
105u8 statusRGBColor_weapon[4];
110u8 statusRGBColor_30[4];
115u8 statusRGBColor_15[4];
120u8 statusRGBColor_life_2[4];
125u8 statusRGBColor_weapon_2[4];
130u8 statusRGBColor_30_2[4];
135u8 statusRGBColor_15_2[4];
144void WaterSplash_Init() {
147 Water_Splash_actFlag = 0;
150 for (i = 0; i < 6; i++) {
151 WaterWaveLing[i].
life = 0;
154 WaterWaveLingWait = 0;
165int CheckHealingWater() {
167 float water_position[4];
169 float nearest_distance;
176 nearest_distance = 160.0f;
177 sceVu0CopyVector(position, CharaMain.
pos);
179 for (row = 0; row < 16; row++) {
180 for (column = 0; column < 16; column++) {
183 if (parts_no != -1) {
188 water_position[0] = 160.0f * column;
189 water_position[1] = water->
vertex[0][1];
190 water_position[2] = 160.0f * row;
192 float distance = DistVector(position, water_position);
194 if (distance < nearest_distance) {
195 nearest_water = water;
196 nearest_distance = distance;
197 water_x = water_position[0];
198 water_y = water_position[1];
199 water_z = water_position[2];
206 if (nearest_distance < 160.0f && position[0] >= water_x + nearest_water->
vertex[0][0] && position[0] < water_x + nearest_water->
vertex[3][0] && position[2] >= water_z + nearest_water->
vertex[0][2] && position[2] < water_z + nearest_water->
vertex[3][2] && position[1] < water_y) {
207 position[1] = water_y;
214 SndSePlay(SE_WATER_SPLASH, -1, 0);
215 Water_Splash_actFlag = 1;
222 sceVu0CopyVector(CheckWaterInfo.
dry_position, position);
256 sceVu0CopyVector(position, CharaMain.
pos);
259 column = (80.0f + position[0]) / 160.0f;
260 row = (80.0f + position[2]) / 160.0f;
267 part = &NowDngMap->
parts[parts_no];
271 if (part->heal_on == 0) {
275 sceVu0CopyVector(center, zone->pos);
276 center[0] += 160.0f * column;
277 center[2] += 160.0f * row;
278 sceVu0CopyVector(low, center);
279 sceVu0CopyVector(high, center);
280 low[0] -= zone->width / 2.0f;
281 low[2] -= zone->depth / 2.0f;
282 high[0] += zone->width / 2.0f;
283 high[2] += zone->depth / 2.0f;
285 if (position[0] >= low[0] && position[0] <= high[0] && position[2] >= low[2] && position[2] < high[2] && position[1] < center[1]) {
294 return zone->on ? hit : 0;
310 if (CheckHealZone() || CheckHealingWater()) {
311 if (healingSpeed <= 0) {
313 UserStatus->
AddDrink(chara, 0xFF, 255.0f);
320 if (HealEffect.
active == 0) {
324 if (!(now_hp == max_hp)) {
325 sceVu0CopyVector(position, CharaMain.
pos);
326 HealEffect.
Set(position);
327 SndSePlay(SE_CHARA_RECOVER, -1, 0);
328 healingSpeed_flg = 1;
330 }
else if (healingSpeed_flg) {
331 setUnitAmbientAnime(60.0f, 1.0f, 0.0f, 122.0f, 208.0f);
332 healingSpeed_flg = 0;
344void DrawWaterLing() {
362 ripple = TexManager.GetTexture(
"d00e01", -1);
369 MGSetGsALPHA(&alpha);
375 for (i = 0; i < 6; i++) {
376 if (WaterWaveLing[i].life > 0) {
377 radius = WaterWaveLing[i].
radius;
378 x = WaterWaveLing[i].
center[0];
381 y = WaterWaveLing[i].
center[1];
383 z = WaterWaveLing[i].
center[2];
387 corner[1][0] = right;
394 corner[3][0] = right;
400 for (j = 0; j < 4; j++) {
403 if (MGRotTransPers(screen[j], corner[j], 0) == 0) {
409 float fade = 2.8444445f * WaterWaveLing[i].
life;
410 set3DSprite(Vif1Packet, ripple,
CRect_i_(0, 64, 64, 64), screen[0], screen[1], screen[2], screen[3], fade);
426void StepWaterLing() {
432 if (WaterWaveLingWait >= 20) {
433 WaterWaveLingWait = 0;
435 for (i = 0; i < 6; i++) {
436 if (WaterWaveLing[i].life == 0) {
438 WaterWaveLing[i].
radius = 2.0f;
439 WaterWaveLing[i].
life = 45;
446 for (i = 0; i < 6; i++) {
447 if (WaterWaveLing[i].life > 0) {
448 WaterWaveLing[i].
radius += 0.2f;
449 WaterWaveLing[i].
life--;
462void BtBattleMusic_Excg(
float distance,
float *field_volume,
float *battle_volume);
464static inline int MonstorAliveCheck(
int no,
int alive) {
465 if (no >= 0 && no < 17) {
472float SetBattleStyle(
int map_no,
int preserve_bgm) {
473 float nearest = 10000;
474 sceVu0FVECTOR position;
475 sceVu0FVECTOR player;
477 float ambient_volume;
480 sceVu0CopyVector(player, CharaMain.
pos);
482 for (
int i = 0; i < 16; i++) {
487 alive = MonstorAliveCheck(i, alive);
493 NowMonstorUnit->
chara[i][0].GetPosition(position);
494 float distance = DistVector(player, position);
496 if (distance < nearest) {
503 int floors = maxFloorTbl[map_no];
507 BtBattleMusic_Excg(nearest, &bgm_volume, &ambient_volume);
509 if (ambient_volume > 0.0f) {
513 if (preserve_bgm == 0) {
514 SndSetBgmVolf(bgm_volume);
517 SndAmbientSetVolf(ambient_volume);
531int ValuePrint(
int x,
int y,
int value,
int palette,
unsigned char alpha) {
532 CTexture *texture = TexManager.GetTexture(
"stayframe", -1);
533 int source_y = palette * 12 + 0xB0;
534 int hundreds_shown = 0;
535 int digit = value / 100;
538 set2DSprite(Vif1Packet, texture,
CRect_i_(x, y, 12, 12),
CRect_i_(digit * 12, source_y, 12, 12), alpha);
539 value -= digit * 100;
545 set2DSprite(Vif1Packet, texture,
CRect_i_(x, y, 12, 12),
CRect_i_(digit * 12, source_y, 12, 12), alpha);
547 set2DSprite(Vif1Packet, texture,
CRect_i_(x + 12, y, 12, 12),
CRect_i_(digit * 12, source_y, 12, 12), alpha);
548 return hundreds_shown + 2;
558void BtStatusAlarmInit() {
559 statusAlarmRate = 128;
560 statusAlarmCounter = 0.0f;
562 statusRGBColor_life[0] = 0x40;
563 statusRGBColor_life[1] = 0xC1;
564 statusRGBColor_life[2] = 0x82;
565 statusRGBColor_life[3] = 0x80;
567 statusRGBColor_weapon[0] = 0xFF;
568 statusRGBColor_weapon[1] = 0x80;
569 statusRGBColor_weapon[2] = 0x00;
570 statusRGBColor_weapon[3] = 0x80;
572 statusRGBColor_30[0] = 0xFF;
573 statusRGBColor_30[1] = 0x00;
574 statusRGBColor_30[2] = 0xC6;
575 statusRGBColor_30[3] = 0x80;
577 statusRGBColor_15[0] = 0xFF;
578 statusRGBColor_15[1] = 0x00;
579 statusRGBColor_15[2] = 0x00;
580 statusRGBColor_15[3] = 0x80;
582 statusRGBColor_life_2[0] = 0x00;
583 statusRGBColor_life_2[1] = 0x81;
584 statusRGBColor_life_2[2] = 0xFF;
585 statusRGBColor_life_2[3] = 0x80;
587 statusRGBColor_weapon_2[0] = 0xFF;
588 statusRGBColor_weapon_2[1] = 0x20;
589 statusRGBColor_weapon_2[2] = 0x00;
590 statusRGBColor_weapon_2[3] = 0x80;
592 statusRGBColor_30_2[0] = 0x3F;
593 statusRGBColor_30_2[1] = 0x00;
594 statusRGBColor_30_2[2] = 0x31;
595 statusRGBColor_30_2[3] = 0x80;
597 statusRGBColor_15_2[0] = 0x3F;
598 statusRGBColor_15_2[1] = 0x00;
599 statusRGBColor_15_2[2] = 0x00;
600 statusRGBColor_15_2[3] = 0x80;
610void BtStatusAlarmAnime() {
611 statusAlarmCounter += 0.10471976f;
613 if (!(statusAlarmCounter < PI)) {
614 statusAlarmCounter -= PI;
617 statusAlarmRate = 192 - (int) (2.0f * (64.0f * sinf(statusAlarmCounter)));
618 statusRGBColor_15[3] = 192 - (int) (2.0f * (64.0f * sinf(statusAlarmCounter)));
628u8 *BtGetStatusPal(
int bar,
float max,
float value) {
631 if (!(value <= 0.2f * max)) {
633 color = statusRGBColor_life;
635 color = statusRGBColor_weapon;
641 if (value <= 0.3f * max && !(value <= 0.15f * max)) {
642 return statusRGBColor_30;
645 return statusRGBColor_15;
655u8 *BtGetStatusPal2(
int bar,
float max,
float value) {
658 if (!(value <= 0.2f * max)) {
660 color = statusRGBColor_life_2;
662 color = statusRGBColor_weapon_2;
668 if (value <= 0.3f * max && !(value <= 0.15f * max)) {
669 return statusRGBColor_30_2;
672 return statusRGBColor_15_2;
682void topStatusInfo(
int y,
int selected_item,
int floor) {
691 icons = TexManager.GetTexture(
"itempack", -1);
692 frame = TexManager.GetTexture(
"stayframe", -1);
695 float life = UserStatus->
hp[UserStatus->
cur_chara];
697 int length = (int) (0.74f * life_max);
703 cells = (length >> 2) + 1;
711 if (life <= 0.2f * life_max) {
712 alpha = statusAlarmRate;
715 upper = (
spRGBA *) BtGetStatusPal(0, life_max, life);
716 lower = (
spRGBA *) BtGetStatusPal2(0, life_max, life);
717 set2DSprite(Vif1Packet, icons,
CRect_i_(0x30, y, 4, 0x10),
CRect_i_(0x68, 0x70, 4, 0x10), alpha);
719 for (
int i = 0; i < cells - 2; i++) {
720 set2DSprite(Vif1Packet, icons,
CRect_i_(i * 4 + 0x34, y, 4, 0x10),
CRect_i_(0x6C, 0x70, 4, 0x10), alpha);
723 set2DSprite(Vif1Packet, icons,
CRect_i_((cells - 1) * 4 + 0x30, y, 4, 0x10),
CRect_i_(0x70, 0x70, 4, 0x10), alpha);
726 length = (int) (0.74f * life);
727 set2DSpriteC4(Vif1Packet,
CRect_i_(0x34, y + 5, length - 2, 6), upper, lower, upper, lower);
730 cells = (cells - 1) * 4 + 0x38;
731 cells += ValuePrint(cells, y + 7, (
int) life, 0, alpha) * 10;
732 set2DSprite(Vif1Packet, frame,
CRect_i_(cells, y + 7, 0xC, 0xC),
CRect_i_(0x78, 0xB0, 0xC, 0xC), alpha);
733 ValuePrint(cells + 10, y + 7, (
int) life_max, 0, alpha);
734 set2DSprite(Vif1Packet, icons,
CRect_i_(0x20, y, 0x10, 0x10),
CRect_i_(0x40, 0xA0, 0x10, 0x10), alpha);
740 float durability_max = ((
CUserStatus *) user)->chara_weapons[user->
cur_chara][slots[wielder]].durability;
741 float durability = ((
CUserStatus *) user)->chara_weapons[wielder][(s8) slots[wielder]].durability_f;
742 float bar = 1.4949495f * durability_max;
749 cells = (length >> 2) + 2;
757 if (durability <= 0.2f * durability_max) {
758 alpha = statusAlarmRate;
761 upper = (
spRGBA *) BtGetStatusPal(1, durability_max, durability);
762 lower = (
spRGBA *) BtGetStatusPal2(1, durability_max, durability);
763 set2DSprite(Vif1Packet, icons,
CRect_i_(0x30, y + 0x11, 4, 0x10),
CRect_i_(0x68, 0x70, 4, 0x10), alpha);
765 for (
int i = 0; i < cells - 2; i++) {
766 set2DSprite(Vif1Packet, icons,
CRect_i_(i * 4 + 0x34, y + 0x11, 4, 0x10),
CRect_i_(0x6C, 0x70, 4, 0x10), alpha);
769 set2DSprite(Vif1Packet, icons,
CRect_i_((cells - 1) * 4 + 0x30, y + 0x11, 4, 0x10),
CRect_i_(0x70, 0x70, 4, 0x10), alpha);
771 if (durability > 0.0f) {
772 length = (int) (1.4949495f * durability);
773 set2DSpriteC4(Vif1Packet,
CRect_i_(0x34, y + 0x16, length - 2, 6), upper, lower, upper, lower);
778 int exp_max = GetWeaponMaxExp(weapon);
780 MGFillBox(
CRect_i_(0x340, ((y + 0x1F) >> 1) * 16, (width - 1) * 16, 0x10), 0x40, 0x40, 0x40, alpha);
783 int filled = (int) ((
float) weapon->
experience * ((float) width / (
float) exp_max));
784 MGFillBox(
CRect_i_(0x340, ((y + 0x1F) >> 1) * 16, (filled - 1) * 16, 0x10), 0, 0xA2, 0xFF, alpha);
787 cells = (cells - 1) * 4 + 0x38;
788 int shown = (int) durability;
790 if (durability - (
float) shown > 0.0f) {
794 cells += ValuePrint(cells, y + 0x18, shown, 0, alpha) * 10;
795 set2DSprite(Vif1Packet, frame,
CRect_i_(cells, y + 0x18, 0xC, 0xC),
CRect_i_(0x78, 0xB0, 0xC, 0xC), alpha);
796 ValuePrint(cells + 10, y + 0x18, (
int) durability_max, 0, alpha);
797 set2DSprite(Vif1Packet, icons,
CRect_i_(0x20, y + 0x10, 0x10, 0x10),
CRect_i_(0x40, 0xB0, 0x10, 0x10), alpha);
804 if (water < 0.15f * water_max) {
805 alpha = statusAlarmRate;
808 set2DSprite(Vif1Packet, icons,
CRect_i_(0x20, y + 0x22, 0x12, 0x14),
CRect_i_(0x64, 0x84, 0x12, 0x14), alpha);
809 int drops = (int) water_max / 10;
811 for (cells = 0; cells < drops; cells++) {
812 set2DSprite(Vif1Packet, icons,
CRect_i_(cells * 0x12 + 0x32, y + 0x22, 0x12, 0x14),
CRect_i_(0x64, 0x98, 0x12, 0x14), alpha);
815 if ((
int) water_max % 10 != 0) {
816 set2DSprite(Vif1Packet, icons,
CRect_i_(drops * 0x12 + 0x32, y + 0x22, 0x12, 0x14),
CRect_i_(0x64, 0xAC, 0x18, 0x14), alpha);
819 int full_drops = (int) water / 10;
821 for (cells = 0; cells < full_drops; cells++) {
822 set2DSprite(Vif1Packet, icons,
CRect_i_(cells * 0x12 + 0x33, y + 0x22, 0x10, 0x14),
CRect_i_(0, 0x48, 0x10, 0x14), 0x50);
825 int leftover = (int) water % 10;
828 set2DSprite(Vif1Packet, icons,
CRect_i_(full_drops * 0x12 + 0x33, y + 0x22, 0x10, 0x14),
CRect_i_((3 - (
int) ((
float) leftover / 2.5f)) * 16, 0x48, 0x10, 0x14), 0x50);
833 static float popupYRate = -PI;
834 popupYRate += 0.20943952f;
836 if (!(popupYRate < PI)) {
837 popupYRate -= TWO_PI;
841 static float popupRGBRate = -PI;
842 popupRGBRate += SIXTEENTH_PI;
844 if (!(popupRGBRate < 0.0f)) {
850 for (
int i = 0; i < 3; i++) {
854 if (BtBySpeedFlag != 0 && pack->
quick_item_slot[i] == ITEM_UNUSED_156) {
855 glow = (int) (64.0f * sinf(popupRGBRate)) + 0x3F;
859 set2DSprite(Vif1Packet, icons,
CRect_i_(i * 40 + 0x126, y + 2, 0x24, 0x24),
CRect_i_(0x24, 0x5C, 0x24, 0x24), glow + 0x80);
862 set2DSprite(Vif1Packet, icons,
CRect_i_(i * 40 + 0x128, y + 4 + bob, 0x1F, 0x1F),
CRect_i_((i << 5) + 0x20, 0, 0x1F, 0x1F));
868 set2DSprite(Vif1Packet, frame,
CRect_i_(i * 40 + 0x12F, y + 0x17, 0xC, 0xC),
CRect_i_(tens * 12, 0xD4, 0xC, 0xC));
877 set2DSprite(Vif1Packet, icons,
CRect_i_(0x1FC, y, 0x66, 0x29),
CRect_i_(0x9A, 1, 0x66, 0x29));
879 if (BtUraDongeon != 0) {
880 set2DSprite(Vif1Packet, icons,
CRect_i_(0x23C, y, 0x26, 0x29),
CRect_i_(0xDA, 0x2B, 0x26, 0x29));
883 if (BtEquipMasuisyou != 0) {
884 set2DSprite(Vif1Packet, icons,
CRect_i_(0x1FE, y + 5, 0x20, 0x20),
CRect_i_(0, 0xA0, 0x20, 0x20));
887 if (BtEquipMap != 0) {
888 set2DSprite(Vif1Packet, icons,
CRect_i_(0x21E, y + 5, 0x20, 0x20),
CRect_i_(0x20, 0xA0, 0x20, 0x20));
891 int last_floor = maxFloorTbl[UserStatus->
cur_georama];
893 if (floor + 1 == last_floor) {
894 set2DSprite(Vif1Packet, frame,
CRect_i_(0x23C, y + 0x12, 0x26, 0x11),
CRect_i_(0x78, 0x9E, 0x26, 0x12));
898 if (floor + 1 >= 10) {
904 if (floor + 1 >= 10) {
906 set2DSprite(Vif1Packet, frame,
CRect_i_(x - 4, y + 0xA, 0xE, 0x11),
CRect_i_((floor + 1) / 10 * 12, 0x9E, 0xC, 0x12));
908 set2DSprite(Vif1Packet, frame,
CRect_i_(x - 4, y + 0x12, 0xE, 0x11),
CRect_i_((floor + 1) / 10 * 12, 0x9E, 0xC, 0x12));
913 set2DSprite(Vif1Packet, frame,
CRect_i_(x + 9, y + 0xA, 0xE, 0x11),
CRect_i_((floor + 1) % 10 * 12, 0x9E, 0xC, 0x12));
915 set2DSprite(Vif1Packet, frame,
CRect_i_(x + 9, y + 0x12, 0xE, 0x11),
CRect_i_((floor + 1) % 10 * 12, 0x9E, 0xC, 0x12));
921 set2DSprite(Vif1Packet, frame,
CRect_i_(selected_item + 0xFC, y, 0x10, 0x10),
CRect_i_(0x4A, 0x48, 0x10, 0x10));
922 set2DSprite(Vif1Packet, frame,
CRect_i_(selected_item + 0x113, y, 0x10, 0x10),
CRect_i_(0x5A, 0x48, 0x10, 0x10));
923 set2DSprite(Vif1Packet, frame,
CRect_i_(selected_item + 0xFC, y + 0x16, 0x10, 0x10),
CRect_i_(0x4A, 0x58, 0x10, 0x10));
924 set2DSprite(Vif1Packet, frame,
CRect_i_(selected_item + 0x113, y + 0x16, 0x10, 0x10),
CRect_i_(0x5A, 0x58, 0x10, 0x10));
930 set2DSprite(Vif1Packet, icons,
CRect_i_(0x18, 0x1AC, 0x2A, 0x1D),
CRect_i_(0x78, 0x37, 0x2A, 0x1D), alpha);
931 set2DSprite(Vif1Packet, icons,
CRect_i_(0x45, 0x1A8, 0x2B, 0x10),
CRect_i_(0xA2, 0x37, 0x2B, 0x10), alpha);
933 set2DSprite(Vif1Packet, icons,
CRect_i_(0x18, 0x18C, 0x2A, 0x1D),
CRect_i_(0x78, 0x37, 0x2A, 0x1D), alpha);
934 set2DSprite(Vif1Packet, icons,
CRect_i_(0x45, 0x188, 0x2B, 0x10),
CRect_i_(0xA2, 0x37, 0x2B, 0x10), alpha);
941 if (item == defWeapon[UserStatus->
cur_chara] + 1) {
945 if (item == defWeapon[UserStatus->
cur_chara]) {
950 set2DSprite(Vif1Packet, icons,
CRect_i_(0x1D, 0x1A4, 0x20, 0x20),
CRect_i_(u, v, 0x20, 0x20), alpha);
952 set2DSprite(Vif1Packet, icons,
CRect_i_(0x1D, 0x184, 0x20, 0x20),
CRect_i_(u, v, 0x20, 0x20), alpha);
963int StatusErrCheck(
int status) {
974int BtStatusErrColorSet() {
981 if (status & AILMENT_FREEZE) {
982 StatusColor[0] = 127.5f;
983 StatusColor[1] = 127.5f;
984 StatusColor[2] = 127.5f;
988 if (status & AILMENT_GOO) {
989 StatusColor[0] = 50.0f;
990 StatusColor[1] = 75.0f;
991 StatusColor[2] = 127.5f;
995 if (status & AILMENT_POISON) {
996 StatusColor[0] = 47.0f;
997 StatusColor[1] = 0.5f;
998 StatusColor[2] = 63.75f;
1002 if (status & AILMENT_STAMINA) {
1003 StatusColor[0] = 127.5f;
1004 StatusColor[1] = 80.0f;
1005 StatusColor[2] = 15.0f;
1024void BtStatusErrStep() {
1029 flags = status->
ailments[*cur_chara];
1033 if ((flags & AILMENT_POISON) && poison_counter >= 180) {
1034 int chara = *cur_chara;
1035 int max_hp = status->
max_hp[chara];
1036 int damage = 0.04 * max_hp;
1038 status->
AddNowLife((s8) *cur_chara, -damage, 10.0f);
1040 status->
AddNowLife((s8) chara, -damage, 10.0f);
1043 float position[4] = {0.0f, 0.0f, 0.0f, 1.0f};
1044 position[1] = CharaHeight(UserStatus);
1045 HitValueEntry(NowHitValue, position, damage, HIT_VALUE_PLAYER, CharaMain.
frame);
1048 if (poison_counter >= 180) {
1052 BtStatusErrColorSet();
1054#pragma name_counter 551
1065void BtSetStatusErr(
int status) {
1071 case AILMENT_FREEZE:
1072 UserStatus->
ailments[chara] |= status;
1073 UserStatus->
ailments[chara] &= ~(AILMENT_STAMINA | AILMENT_POISON | AILMENT_GOO);
1075 SndSePlay(SE_STATUS_AILMENT, -1, 0);
1078 case AILMENT_STAMINA:
1079 if (!(UserStatus->
ailments[chara] & AILMENT_FREEZE)) {
1080 UserStatus->
ailments[chara] |= status;
1086 case AILMENT_POISON:
1087 if (!(UserStatus->
ailments[chara] & (AILMENT_FREEZE | AILMENT_STAMINA))) {
1088 UserStatus->
ailments[chara] |= status;
1089 UserStatus->
ailments[chara] &= ~AILMENT_GOO;
1090 SndSePlay(SE_STATUS_AILMENT, -1, 0);
1096 UserStatus->
ailments[chara] |= status;
1097 SndSePlay(SE_STATUS_AILMENT, -1, 0);
1101 if (!(UserStatus->
ailments[chara] & (AILMENT_FREEZE | AILMENT_STAMINA | AILMENT_POISON))) {
1102 UserStatus->
ailments[chara] |= status;
1103 SndSePlay(SE_STATUS_AILMENT, -1, 0);
1117void BtStatusErrDraw(
int y) {
1118 CTexture *texture = TexManager.GetTexture(
"itempack", -1);
1119 int status_flags[5] = {AILMENT_FREEZE, AILMENT_STAMINA, AILMENT_POISON, AILMENT_CURSE, AILMENT_GOO};
1120 int icon_cells[5][2] = {
1129 for (
int icon = 4; icon >= 0; icon--) {
1130 if (status & status_flags[icon]) {
1131 set2DSprite(Vif1Packet, texture,
CRect_i_(430, y - 10, 62, 35),
CRect_i_(icon_cells[icon][0] * 62 + 132, icon_cells[icon][1] * 36 + 84, 62, 36));
1143void setItemToReserved(
char *page_name,
int x,
int y,
char *item_name,
int dsax,
int dsay) {
1151 sceVif1PkCnt(Vif1Packet, 0);
1152 sceVif1PkOpenDirectCode(Vif1Packet, 0);
1153 sceVif1PkOpenGifTag(Vif1Packet, *(u_long128 *) &GiftagAD);
1154 sceVif1PkAddGsAD(Vif1Packet, 0x3F, 0);
1155 sceVif1PkCloseGifTag(Vif1Packet);
1156 sceVif1PkCloseDirectCode(Vif1Packet);
1158 page = TexManager.GetTexture(page_name, -1);
1159 item = TexManager.GetTexture(item_name, -1);
1161 sbp = page->
tex0 & 0x3FFF;
1162 dbp = item->
tex0 & 0x3FFF;
1163 sbw = (page->
tex0 >> 14) & 0x3F;
1164 dbw = (item->
tex0 >> 14) & 0x3F;
1166 MoveImageTest(Vif1Packet, sbp, sbw, 0x13,
CRect_i_(x, y, 0x20, 0x20), dbp, dbw, 0x13, dsax, dsay, 0);
1168 sceVif1PkCnt(Vif1Packet, 0);
1169 sceVif1PkOpenDirectCode(Vif1Packet, 0);
1170 sceVif1PkOpenGifTag(Vif1Packet, *(u_long128 *) &GiftagAD);
1171 sceVif1PkAddGsAD(Vif1Packet, 0x3F, 0);
1172 sceVif1PkCloseGifTag(Vif1Packet);
1173 sceVif1PkCloseDirectCode(Vif1Packet);
1193void BtMapJumpCashClear() {
1194 BtCfgCash[0] =
'\0';
1215int BtMapJumpLoad(
char *map_name) {
1245 if (msg_no != BtSteebMsgNo) {
1246 BtSteebMesBuffer.
used = 0;
1247 u_char *mes = BtSteebMesBuffer.
base + BtSteebMesBuffer.
used * 16;
1250 sprintf(mes_path,
"dun/message/ww_mes/steve07_%d_%d.mes", msg_no - 5, LanguageCode);
1252 sprintf(mes_path,
"dun/message/ww_mes/steve0%d_%d.mes", msg_no + 1, LanguageCode);
1255 LoadFile(mes_path, mes, &mes_size);
1256 wait_now_loading_vsync();
1257 DngMesStb.
SetBuff((
short *) mes);
1258 BtSteebMesBuffer.Alloc((((mes_size >> 6) + 1) << 6) >> 4);
1259 BtSteebMesBuffer.Align64();
1260 BtSteebMsgNo = msg_no;
1263 TexManager.DeleteTextureBlock(42);
1265 NowDngMap = &MainDungeonMap;
1266 NowEventMan = &DngEventMan;
1268 if (strcmp(BtCfgCash, map_name) == 0 && BtCfgFlag != 0) {
1272 strcpy(BtCfgCash, map_name);
1274 MapModelBuffer.
used = 0;
1275 u_int *pack = read_buffer;
1276 read_buffer = old_read_buffer;
1281 for (i = 0; i < 12; i++) {
1284 field_set->
state[i] = 3;
1292 for (
int slot = 0; slot < 64; slot++) {
1294 event->
name[0] =
'\0';
1295 event->script_no = -1;
1296 event->parts_id = -1;
1297 event->switch_on =
false;
1298 event->enabled =
false;
1301 for (
int record = 0; record < 96; record++) {
1310 strcpy(mpd_path,
"dun/mpd_pack/");
1311 strcat(mpd_path, map_name);
1312 strcat(mpd_path,
".mpd");
1313 strcpy(cfg_path,
"dun/");
1314 strcat(cfg_path, map_name);
1315 strcat(cfg_path,
".cfg");
1316 TEIGIAnalyz(cfg_path);
1319 LoadFile(mpd_path, (
void *) read_buffer, &size);
1320 wait_now_loading_vsync();
1322 if (size >= 6400000) {
1323 printf(
"MAPDATA BUFFER OVER!! %d\n", size);
1327 TEIGIImgLoad(read_buffer, &MapModelBuffer);
1328 TEIGIMdsLoad(read_buffer, 0);
1335 NowDngMap->
box_body_model = LoadMDSFilePack(read_buffer,
"ibox_0.mds", &MapModelBuffer);
1336 NowDngMap->
box_lid_model = LoadMDSFilePack(read_buffer,
"ibox_t.mds", &MapModelBuffer);
1337 NowDngMap->
box_collision_model = LoadCollisionFilePack(read_buffer,
"ibox_a.mds", &MapModelBuffer);
1340 NowDngMap->
chest_body_model = LoadMDSFilePack(read_buffer,
"iboxs_0.mds", &MapModelBuffer);
1341 NowDngMap->
chest_lid_model = LoadMDSFilePack(read_buffer,
"iboxs_t.mds", &MapModelBuffer);
1342 NowDngMap->
chest_collision_model = LoadCollisionFilePack(read_buffer,
"iboxs_a.mds", &MapModelBuffer);
1346 itemOpenSmall.
LoadPack(read_buffer,
"dun/etc/itemget_s/d01i02m", &MapModelBuffer, &MapModelBuffer, &itemOpenSmall_info, 0);
1347 itemOpenBig.
LoadPack(read_buffer,
"dun/etc/itemget_b/d01i01m", &MapModelBuffer, &MapModelBuffer, &itemOpenBig_info, 0);
1350 int map_used = MapModelBuffer.
used;
1351 u_char *monster_base = MapModelBuffer.
base + map_used * 16;
1352 long monster_size = 0xA7F80 - map_used;
1353 MonstorModelBuffer.
base = monster_base;
1354 MonstorModelBuffer.
limit = monster_size;
1355 MonstorModelBuffer.
used = 0;
1358 printf(
"TotalMem = %d\n", 0xA7F80);
1359 printf(
"MapVisualData [%x] %d/%d\n", MapModelBuffer.
base + MapModelBuffer.
used * 16, MapModelBuffer.
used, ArenaLimit(MapModelBuffer));
1360 printf(
"MonstorData [%x] %d/%d\n", MonstorModelBuffer.
base + MonstorModelBuffer.
used * 16, MonstorModelBuffer.
used, ArenaLimit(MonstorModelBuffer));
1372void BtSet3DCellModel(
float *world,
CTexture *texture,
float size,
int x,
int y,
int width,
int height,
int alpha) {
1376 int bottom_right[4];
1381 if (MGRotTransPers3DSprite(top_left, bottom_right, world, size, size / 2.0f, 0) == 1) {
1382 top_right[0] = bottom_right[0];
1383 top_right[1] = top_left[1];
1384 top_right[2] = top_left[2];
1385 bottom_left[0] = top_left[0];
1386 bottom_left[1] = bottom_right[1];
1387 bottom_left[2] = bottom_right[2];
1391 source.
width = width;
1394 set3DSprite(Vif1Packet, texture, source, top_left, top_right, bottom_left, bottom_right, alpha);
void SetMotion(int no, int mode, float speed=-1.0f)
virtual void SetPosition(float x, float y, float z)
CDungeonEventData event[96]
void initSubmap(CDataAlloc2< 1 > *alloc)
CFrame * box_collision_model
CFrame * chest_collision_model
CFrame * chest_body_model
void CleanViewMonstor(int back_floor)
void LoadPack(unsigned int *pack, char *base_name, CDataAlloc2< 1 > *model_arena, CDataAlloc2< 1 > *motion_arena, MOTION_INFO *motion_info, int initialize_frames)
void AddDrink(int chara_no, s16 amount, float ratio)
void AddNowLife(int chara_no, s16 amount, float ratio)
WEAPON_HAVE chara_weapons[6][11]
s8 equipped_weapon_slot[6]
void SetBuff(short *buff)
float surface_position[4]