12#include "dataalloc.hpp"
14#include "dngstatusdata.hpp"
15#include "dun/gameloop.hpp"
17#include "framevu1.hpp"
18#include "hitvalue.hpp"
21#include "menu_save.hpp"
30int BtBattleMusic_Flag;
35int BtBattleMusic_Wait;
40float BtBattleMusic_Vol;
44 unsigned int *file = GetPackFile(pack, name, &size);
47 printf(
"Model NotFound!!%s\n", name);
51 return (
CFrame *) LoadMDSFile(file, buffer, 0, NULL, NULL);
56 unsigned int *file = GetPackFile(pack, name, &size);
59 printf(
"Model NotFound!!%s\n", name);
63 return (
CFrame *) LoadCollisionFile(file, buffer);
73void setCameraPassData(
CFrameVu1 *frame,
CCamera *camera,
char *position_name,
char *reference_name) {
77 frame->SearchFrame(reference_name)->GetLWMatrix(matrix);
79 frame->SearchFrame(position_name)->GetLWMatrix(matrix);
90void getFramePos(
CFrameVu1 *frame,
char *name,
float *position) {
91 CFrame *named_frame = frame->SearchFrame(name);
95 origin[0] = origin[1] = origin[2] = 0.0f;
97 named_frame->GetWorldPosition(position, origin);
107void makeWeaponName(
char *name,
int weapon_no) {
108 char *prefix[6] = {
"c01w",
"c04w",
"c06w",
"c05w",
"c10w",
"c18w"};
109 int first_weapon[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};
113 if (weapon_no >= ITEM_WEAPON_DAGGER_BROKEN) {
114 if (weapon_no >= ITEM_WEAPON_DAGGER_BROKEN && weapon_no < ITEM_WEAPON_WOODENSLINGSHOT_BROKEN) {
118 if (weapon_no >= ITEM_WEAPON_WOODENSLINGSHOT_BROKEN && weapon_no < ITEM_WEAPON_MALLET_BROKEN) {
122 if (weapon_no >= ITEM_WEAPON_MALLET_BROKEN && weapon_no < ITEM_WEAPON_GOLD_RING_BROKEN) {
126 if (weapon_no >= ITEM_WEAPON_GOLD_RING_BROKEN && weapon_no < ITEM_WEAPON_FIGHTING_STICK_BROKEN) {
130 if (weapon_no >= ITEM_WEAPON_FIGHTING_STICK_BROKEN && weapon_no < ITEM_WEAPON_MACHINE_GUN_BROKEN) {
134 if (weapon_no >= ITEM_WEAPON_MACHINE_GUN_BROKEN) {
139 strcpy(name,
"dun/item/main_wep/");
140 strcat(name, prefix[chara_no]);
141 int offset = weapon_no - first_weapon[chara_no];
144 sprintf(number,
"0%d", offset);
146 sprintf(number,
"%2d", offset);
149 strcat(name, number);
160void BtGetItemNamePath(
char *model_path,
char *texture_path,
int item_no) {
161 item_no = TransWepNo(item_no);
163 if (item_no >= ITEM_WEAPON_START) {
164 makeWeaponName(model_path, item_no);
166 if (ITEM_NAME_TBL_NEW[item_no - ITEM_ATTACH_START] == NULL) {
167 item_no = ITEM_REGULAR_WATER;
170 strcpy(model_path,
"dun/item/main_data/");
171 strcat(model_path, ITEM_NAME_TBL_NEW[item_no - ITEM_ATTACH_START]);
174 strcpy(texture_path, model_path);
175 strcat(model_path, MdsExtension);
176 strcat(texture_path,
".img");
177 printf(
"mds = %s\n", model_path);
178 printf(
"img = %s\n", texture_path);
184char nameWepBuff_mds[64];
189char nameWepBuff_img[64];
191void BtGetWeaponNamePath2(
char *chr_name,
char *cfg_name,
int chara,
int weapon_index) {
192 char *prefix[6] = {
"c01w",
"c04w",
"c06w",
"c05w",
"c10w",
"c18w"};
194 char *base = prefix[chara];
196 strcpy(nameWepBuff_mds, base);
197 strcpy(nameWepBuff_img, base);
199 if (weapon_index < 10) {
200 sprintf(number,
"0%d", weapon_index);
202 sprintf(number,
"%2d", weapon_index);
205 strcat(nameWepBuff_mds, number);
206 strcat(nameWepBuff_mds,
".chr");
207 strcat(nameWepBuff_img, number);
208 strcat(nameWepBuff_img,
".cfg");
209 strcpy(chr_name, nameWepBuff_mds);
210 strcpy(cfg_name, nameWepBuff_img);
213void BtGetWeaponNamePath3(
char *chr_name,
char *cfg_name,
int weapon_no) {
217 if (weapon_no < ITEM_WEAPON_START) {
220 weapon_data = GetWeaponData(weapon_no);
222 if (weapon_data != NULL) {
223 chara_no = (s8) weapon_data->
owner;
224 weapon_no -= defWeapon__2[chara_no];
225 printf(
"offset %d\n", weapon_no);
226 BtGetWeaponNamePath2(chr_name, cfg_name, chara_no, weapon_no);
238void getAtraToSaveData(
int atra,
int atra_no,
CSaveData *save,
int dungeon,
int floor) {
239 printf(
"GET ATRA [%d] !!\n", atra);
247 ((
CDngStatusData *) UserStatus)->GetAtraData(dungeon, floor, atra_no);
257int createAttachVolume(
int item_no,
int dungeon) {
260 if (item_no < ITEM_ATTACH_STAT_START || item_no > ITEM_ATTACH_MAGICAL_POWER) {
264 int roll = (int) ((50.0f * (
float) rand()) / 2.1474836e9f);
265 roll += (int) ((50.0f * (
float) rand()) / 2.1474836e9f);
279void BtBattleMusic_Init() {
280 BtBattleMusic_Flag = 0;
281 BtBattleMusic_Wait = 0;
282 BtBattleMusic_Vol = 0.0f;
285void BtBattleMusic_Stop() {
286 if (BtBattleMusic_Flag != 0) {
288 SndAmbientSetVolf(0.0f);
289 BtBattleMusic_Init();
300void BtBattleMusic_Excg(
float distance,
float *field_volume,
float *battle_volume) {
301 if (BtBattleMusic_Flag != 0) {
302 if (distance >= 110.0f) {
303 if (BtBattleMusic_Wait == 0) {
304 BtBattleMusic_Vol -= 1.0f / 30.0f;
306 if (BtBattleMusic_Vol < 0.1f) {
307 BtBattleMusic_Flag = 0;
308 BtBattleMusic_Vol = 0.0f;
311 BtBattleMusic_Wait--;
313 }
else if (BtBattleMusic_Vol < 0.9f) {
314 BtBattleMusic_Vol += 1.0f / 30.0f;
318 if (BtBattleMusic_Flag == 0 && distance <= 100.0f) {
319 BtBattleMusic_Flag = 1;
322 if (BtBattleMusic_Vol >= 0.9f) {
323 BtBattleMusic_Vol = 0.9f;
326 if (BtBattleMusic_Vol <= 0.0f) {
327 BtBattleMusic_Vol = 0.0f;
330 *field_volume = 1.0f - BtBattleMusic_Vol;
331 *battle_volume = BtBattleMusic_Vol;
337int yearFloorTbl[25] = {5, 18, 23, 38, 51, 66, 102, 109, 122, 140, 151, 162, 205,
338 208, 213, 225, 238, 249, 300, 310, 322, 340, 356, 382, 400};
340int BtGetFloorLevel(
int floor) {
341 if (floor >= 0 && floor < 25) {
342 return yearFloorTbl[floor];
void SetRef(CFrame *parent, float x, float y, float z)
void SetPos(CFrame *parent, float x, float y, float z)
int AtraPartsGet(int georama_no, int plot_no)
int AtraChipGet(int georama_no, int chip_id)