1#pragma helper_mask_gpr 0x30
2#pragma helper_mask_fpr 0x1000
3#pragma name_counter 612
11#include "dngmessageman.hpp"
12#include "dun/gameloop.hpp"
15#include "menu_dungeon.hpp"
16#include "menu_inventory.hpp"
22#include "userstatus.hpp"
27int defWeapon__2[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};
29int element_tbl[6] = {1, 2, 4, 8, 0x10, 0};
33char *LanguageStr[7] = {
"dun/img/jp/",
"dun/img/us/",
"dun/img/us_e/",
"dun/img/fr/",
34 "dun/img/gr/",
"dun/img/it/",
"dun/img/sp/"};
37int BattleSubWeaponDmg(
float amount,
int kind) {
38 int default_weapons[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};
43 if (weapon->
item_no == ITEM_WEAPON_SERPENT_SWORD && SaveData->
GetGameFlag(0x30) == 0) {
47 if (weapon->
flags & 0x200) {
51 if (weapon->
flags & 0x100) {
55 default_weapon = default_weapons[chara_no];
61 float wear = 1.5f - 0.01f * NowWeaponHave->
endurance;
68 int powder_slot = ((
CDngStatusData *) UserStatus)->CheckActItemSlot(ITEM_AUTO_REPAIR_POWDER);
70 if (powder_slot != -1) {
71 DelActiveItem(powder_slot + 1);
74 DngMessMan.
timer = 0xF0;
76 SndSePlay(SE_WEAPON_REPAIR, -1, 0);
82 SndSePlay(SE_WEAPON_BREAK, -1, 0);
86 if (default_weapon + 1 == now_item) {
90 DngMessMan.
timer = 0x1E0;
92 WepDataListToHaveCopy(default_weapon, weapon);
93 SetWeaponAttachStatus(NowWeaponHave);
99 if (default_weapon + 1 != (s16) now_item) {
102 for (
int slot = 0; slot < 10; replacement++, slot++) {
103 if (replacement->
item_no == default_weapon) {
105 SetWeaponAttachStatus(NowWeaponHave);
111 DngMessMan.
timer = 0x1E0;
117 if (replacement->
item_no == default_weapon + 1) {
119 SetWeaponAttachStatus(NowWeaponHave);
125 DngMessMan.
timer = 0x1E0;
143 DngMessMan.
timer = 0xF0;
151 DngMessMan.
timer = 0xF0;
158void HitValueEntry(
CHitValue *values,
float *world,
int amount,
int kind,
CFrame *frame) {
159 for (
int i = 0; i < 32; i++) {
160 if (values[i].active == 0) {
161 values[i].
EntryValue(world, amount, kind, frame);
170 for (
int i = 0; i < 5; i++) {
172 phase[i] = -PI_SHORT;
180 sceVu0CopyVector(
pos, world);
184 if (
kind == HIT_VALUE_ZERO) {
191 int seen_nonzero = 0;
193 for (
int i = 4; i >= 0; i--) {
194 digit_value = amount / divisor;
196 if (digit_value > 0) {
201 if (i == 0 || seen_nonzero != 0) {
202 digit[i] = digit_value;
203 amount -= digit_value * divisor;
214 case HIT_VALUE_MONSTER:
226 case HIT_VALUE_PLAYER:
244 if ((
kind == HIT_VALUE_MONSTER ||
kind == HIT_VALUE_ZERO) && ((s32 *) SaveData->
GetConfigData())[10] == 1) {
248 CTexture *digit_texture = TexManager.GetTexture(
"stayframe", -1);
249 CTexture *mark_texture = TexManager.GetTexture(
"itempack", -1);
260 sceVu0CopyVector(world,
pos);
263 if (MGRotTransPers2D(screen, world, 0) == 0) {
267 if (
digit[0] == -2) {
268 int bounce = (int) (48.0f * sinf(
phase[0]));
269 set2DSprite(Vif1Packet, mark_texture,
CRect_i_(screen[0], screen[1] - bounce - 48, 72, 24),
CRect_i_(0, 128, 72, 24), (u8)
opacity);
273 for (
int place = 0; place < 5; place++) {
274 if (
digit[place] == -1) {
278 int bounce = (int) (48.0f * sinf(
phase[place]));
279 set2DSprite(Vif1Packet, digit_texture,
CRect_i_(screen[0] - place *
texel.
width, screen[1] - bounce - 48,
texel.
width,
texel.
height),
CRect_i_(
texel.
x +
digit[place] *
texel.
width,
texel.
y,
texel.
width,
texel.
height), (u8)
opacity);
294 for (
int i = 0; i < 5; i++) {
313 if (
alpha >= 128.0f) {
void EntryValue(float *world, int amount, int kind, CFrame *frame)
int GetGameFlag(int flag_no)
WEAPON_HAVE chara_weapons[6][11]
s8 equipped_weapon_slot[6]