Faschz

Dark Cloud 1 - Classes + Functions

Dec 27th, 2020 (edited)
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 9.33 KB | None | 0 0
  1. typedef struct {
  2.     /* 0x00 */ char unk00[0x20];
  3.     /* Size: 0x20 */
  4. } ATTACH_LIST;
  5.  
  6. typedef struct {
  7.     /* 0x00 */ char unk00[0xF8];
  8.     /* Size: 0xF8 */
  9. } WEAPON_HAVE;
  10.  
  11. typedef struct {
  12.     /* 0x00 */ s16 unk00;
  13.     /* 0x02 */ s16 unk02[10]; // Slot
  14.     /* 0x16 */ s16 unk16[10]; // Menu
  15.     /* 0x2A */
  16.     /* Size: 0x2C */
  17. } CMenuCursor; /* 0x00158AE0 InitPos__11CMenuCursorFv */
  18.  
  19. typedef struct {
  20.     /* 0x0000 */ s8 NowDungeon;
  21.     /* 0x0001 */
  22.     /* 0x0002 */ s8 NowFloor;
  23.     /* 0x0003 */ s8 LastFloor;
  24.     /* 0x0004 */ s8 NowChara;
  25.     /* 0x0005 */ s8 TotalChara;
  26.     /* 0x0006 */ s16 MaxLife[6];
  27.     /* 0x0012 */ s16 NowLife[6];
  28.     /* 0x001E */
  29.  
  30.     /* 0x0278 */ s32 unk0278[6][40][8];      // Atla related ([dungeon][floor?][idx])
  31.     /* 0x2078 */ char unk2078[6][100][0x0C]; // Struct of Size: 0x0C (Atla related)
  32.     /* 0x3C98 */ s16 FloorKills[7][100];     // (My guess is these 2 arrays are 7 dungeons, it fits perfectly, however they initialize only 6)
  33.     /* 0x4210 */ s8 unk4210[7][25];          // Limited Zone Floors
  34.     /* 0x42BF */ s8 FloorsCleared[7];
  35.     /* 0x42C6 */
  36.  
  37.     /* 0x42C8 */ s32 NowStatus[6];
  38.     /* 0x42E0 */ s16 unk42E0[6];
  39.     /* 0x42EC */ f32 MaxThirst[6];
  40.     /* 0x4304 */ f32 NowThirst[6];
  41.     /* 0x431C */ s32 unk431C; // Non-zero forces menu open
  42.     /* 0x4320 */ s32 unk4320; // Go To Dungeon / Go To Other Area
  43.     /* 0x4324 */
  44.  
  45.     /* 0x433C */ s32 unk433C; // Option: Map Display Density
  46.     /* 0x4340 */ s8 DefaultWeapon[6];
  47.     /* 0x4346 */ u16 Gold;
  48.     /* 0x4348 */ s32 Defense[6];
  49.     /* 0x4360 */ s8 unk4360; // Item Capacity
  50.     /* 0x4361 */
  51.     /* 0x4362 */ s16 unk4362[3]; // Active Items
  52.     /* 0x4368 */ s16 unk4368[3]; // Active Item Counts
  53.     /* 0x436E */ s16 Items[103];
  54.     /* 0x443C */ s16 Slots[103];
  55.     /* 0x450A */
  56.  
  57.     /* 0x450C */ WEAPON_HAVE Weapons[6][11];
  58.     /* 0x84FC */ ATTACH_LIST Attachs[43];
  59.     /* Size: 0x8A5C */
  60. } CDngStatusData; /* 0x001BF340 Initialize__14CDngStatusDataFv */
  61.  
  62. // class CUserStatus : public CDngStatusData {}
  63. typedef struct {
  64.     /* 0x0000 */ CDngStatusData DngStatusData; // Inheritance
  65.     /* 0x8A5C */ s16 unk8A5C[6]; // NowLife copy
  66.     /* 0x8A68 */ s16 unk8A68[6];
  67.     /* 0x8A74 */ s32 unk8A74[6];
  68.     /* 0x8A8C */ s32 unk8A8C[6];
  69.     /* 0x8AA4 */ s8 unk8AA4[50]; // EventFlag?
  70.     /* 0x8AD6 */ s16 unk8AD6[6]; // Thirst related
  71.     /* 0x8AE2 */ s16 unk8AE2[6];
  72.     /* 0x8AEE */
  73.  
  74.     /* 0x8AF0 */ f32 unk8AF0[6]; // Thirst related (Time before next life drain?)
  75.     /* 0x8B08 */ s32 unk8B08; // User is NOT moving
  76.     /* 0x8B0C */ s32 unk8B0C;
  77.     /* 0x8B10 */ s32 unk8B10;
  78.     /* 0x8B14 */
  79. } CUserStatus; /* 0x001BEDE0 Init__11CUserStatusFv */
  80.  
  81. typedef struct {
  82.     /* 0x0000 */ s16 Items[60];
  83.     /* 0x0078 */ s16 Slots[60];
  84.     /* 0x00F0 */ WEAPON_HAVE Weapons[30];
  85.     /* 0x1E00 */ ATTACH_LIST Attachs[30];
  86.     /* Size: 0x21C0 */
  87. } CStockItem; /* 0x0023F590 Initialize__10CStockItemFv */
  88.  
  89. typedef struct {
  90.     /* 0x00048 */ u16 CharaName[6][0x20];
  91.     /* 0x001C8 */
  92.  
  93.     /* 0x001D0 */ f32 NowTime;
  94.     /* 0x001D4 */ s32 PlayTime;
  95.     /* 0x001D8 */ s32 Day;
  96.     /* 0x001DC */ s32 FishingPoint;
  97.     /* 0x001E0 */ char unk001E0[0x40][0x10]; // Struct of Size: 0x10 (4 floats) (Fishing?)
  98.     /* 0x005E0 */
  99.  
  100.     /* 0x00650 */ CMenuCursor MenuCursor;
  101.     /* 0x0067C */ char unk0067C[6][0xBB8]; // Struct of Size: 0xBB8
  102.     /* 0x04CCC */ s16 ElemData[6][128];
  103.     /* 0x052CC */
  104.  
  105.     /* 0x0540C */ CUserStatusData UserStatusData;
  106.  
  107.     /* 0x0E0A8 */ CStockItem StockItem;
  108.     /* 0x10268 */ s32 GameFlag[0x100];
  109.     /* 0x10668 */ s32 GameIntFlag[0x20];
  110.     /* 0x106E8 */ s32 MapFlag[0x50][0x10];
  111.     /* 0x11AE8 */ s32 MapInitFlag[0x50][0x10];
  112.     /* 0x12EE8 */ s16 VisitMap[0x50];
  113.     /* 0x12F88 */ s16 VisitDungeon[6]; // (7? Demon Shaft?)
  114.  
  115.     /* 0x12F98 */ s32 VisitDemonShaft;
  116.     /* 0x12F9C */
  117.  
  118.     /* Size: 0x131C0 */
  119. } CSaveData; /* 0x00158B60 Initialize__9CSaveDataFv */
  120.  
  121. /* 0x00157FB0 */
  122. s32* CSaveData::GetGrdData(s32 arg1) {
  123.     if (arg1 >= 0 && arg1 < 6) {
  124.         return &this->unk0067C[i];
  125.     } else {
  126.         return NULL;
  127.     }
  128. }
  129.  
  130. /* 0x001581A0 */
  131. s16* CSaveData::GetElemData(s32 arg1) {
  132.     if (arg1 >= 0 && arg1 < 6) {
  133.         return &this->ElemData[arg1][0];
  134.     } else {
  135.         return NULL;
  136.     }
  137. }
  138.  
  139. /* 0x001581E0 */
  140. CUserStatusData* CSaveData::GetDngStatus(void) {
  141.     return &this->UserStatusData;
  142. }
  143.  
  144. /* 0x001581F0 */
  145. CStockItem* CSaveData::GetStockItem(void) {
  146.     return &this->StockItem;
  147. }
  148.  
  149. /* 0x00158800 */
  150. s32 CSaveData::VisitMap(s32 NowMap, s16 Visits) {
  151.     if (NowMap >= 0 && NowMap < 0x50) {
  152.         this->VisitMap[NowMap] += Visits;
  153.         this->VisitMap[NowMap] = this->VisitMap[NowMap] > 9999 ? 9999 : this->VisitMap[NowMap];
  154.         return this->VisitMap[NowMap];
  155.     } else {
  156.         return 0;
  157.     }
  158. }
  159.  
  160. /* 0x00158874 */
  161. s32 CSaveData::QuestDungeon(s32 NowDungeon, s16 Visits) {
  162.     if (NowDungeon == 6) {
  163.         this->VisitDemonShaft += Visits;
  164.         this->VisitDemonShaft =  this->VisitDemonShaft > 9999 ? 9999 : this->VisitDemonShaft;
  165.         return this->VisitDemonShaft;
  166.     } else if (NowDungeon >= 0 && NowDungeon < 6) {
  167.         this->VisitDungeon[NowDungeon] += Visits;
  168.         this->VisitDungeon[NowDungeon] = this->VisitDungeon[NowDungeon] > 9999 ? 9999 : this->VisitDungeon[NowDungeon];
  169.         return this->VisitDungeon[NowDungeon];
  170.     } else {
  171.         return 0;
  172.     }
  173. }
  174.  
  175. /* 0x00158AE0 */
  176. void CMenuCursor::InitPos(void) {
  177.     for (int i = 0; i < 10; i++) {
  178.         this->unk02[i] = 0;
  179.     }
  180.  
  181.     for (int i = 0; i < 10; i++) {
  182.         this->unk16[i] = -1;
  183.     }
  184.  
  185.     this->unk16[0] = 4
  186.     this->unk16[2] = 6;
  187.     this->unk16[3] = 0;
  188.     this->unk2A = 0;
  189. }
  190.  
  191. /* 0x00158B60 */
  192. void CSaveData::Initialize(void) {
  193.     memset(&this, 0, sizeof(this));
  194.  
  195.     this->unk001CC = -1;
  196.     this->NowTime = 0;
  197.  
  198.     for (int i = 0; i < 6; i++) {
  199.         for (int j = 0; j < 128; j++) {
  200.             this->ElemData[i][j] = -1;
  201.         }
  202.     }
  203.  
  204.     for (int i = 0; i < 6; i++) {
  205.         memset(&this->unk0067C[i], 0, 0xBB8);
  206.  
  207.         for (int j = 0; j < 24; j++) {
  208.             for (int k = 0; k < 6; k++) {
  209.                 this->unk0067C[i].unk00A[j][k] = 0;
  210.             }
  211.         }
  212.  
  213.         for (int j = 0; j < 130; j++) {
  214.             this->unk0067C[i].unk2A8[j] = -1;
  215.         }
  216.     }
  217.  
  218.     this->UserStatusData.Initialize();
  219.     this->StockItem.Initialize();
  220.  
  221.     memset(&this, 0, 0x48);
  222.     memset(&this->GameFlag, 0, 0x400);
  223.     memset(&this->MapFlag, 0, 0x4);
  224. }
  225.  
  226. /* 0x00158D30 */
  227. CSaveData::CSaveData(void) {
  228.     this->MenuCursor.unk00 = 0;
  229.     this->MenuCursor.InitPos();
  230.     this->Initialize();
  231. }
  232.  
  233. /* 0x001BDBC0 */
  234. void CDngStatusData::LostGateKey(void) {
  235.     for (int i = 0; i < 103; i++) {
  236.         if (this->Items[i] == 0xC3) {
  237.             this->Items[i] = -1;
  238.         }
  239.  
  240.         if (this->Items[i] == 0xC4) {
  241.             this->Items[i] = -1;
  242.         }
  243.  
  244.         if (this->Items[i] == 0xC6) {
  245.             this->Items[i] = -1;
  246.         }
  247.  
  248.         if (this->Items[i] == 0xC9) {
  249.             this->Items[i] = -1;
  250.         }
  251.  
  252.         if (this->Items[i] == 0xCA) {
  253.             this->Items[i] = -1;
  254.         }
  255.  
  256.         if (this->Items[i] == 0xCB) {
  257.             this->Items[i] = -1;
  258.         }
  259.  
  260.         if (this->Items[i] == 0xCC) {
  261.             this->Items[i] = -1;
  262.         }
  263.  
  264.         if (this->Items[i] == 0xCD) {
  265.             this->Items[i] = -1;
  266.         }
  267.  
  268.         if (this->Items[i] == 0xCE) {
  269.             this->Items[i] = -1;
  270.         }
  271.  
  272.         if (this->Items[i] >= 0xD8 && this->Items[i] < 0xDF) {
  273.             this->Items[i] = -1;
  274.         }
  275.     }
  276. }
  277.  
  278. /* 0x001BEEF0 */
  279. void CDngStatusData::SetDead(void) {
  280.     this->Gold /= 2;
  281. }
  282.  
  283. /* 0x001BEF10 */
  284. void CDngStatusData::SetResLimmitZone(void) {
  285.     if (this->unk4210[this->NowDungeon][this->NowFloor] != -1) {
  286.         this->unk8B10 = this->unk4210[this->NowDungeon][this->NowFloor];
  287.     }
  288. }
  289.  
  290. /* 0x001BF700 */
  291. void CDngStatusData::AddKills(void) {
  292.     this->FloorKills[this->NowDungeon][this->NowFloor]++;
  293. }
  294.  
  295. /* 0x001BF740 */
  296. s16 CDngStatusData::ChkKills(s32 arg1, s32 arg2) {
  297.     return this->FloorKills[arg1][arg2];
  298. }
  299.  
  300. /* 0x00231AD0 */
  301. s32 GetAttachKind(s32 arg0) {
  302.     if (arg0 >= 0x51 && arg0 < 0x5B) {
  303.         return 1;
  304.     } else if (arg0 >= 0x5B && arg0 < 0x60) {
  305.         return 2;
  306.     } else if (arg0 >= 0x60 && arg0 < 0x6E) {
  307.         return 3;
  308.     } else if (arg0 >= 0x6F && arg0 < 0x7A) {
  309.         return 4;
  310.     } else {
  311.         return 5;
  312.     }
  313. }
  314.  
  315. /* 0x0023F590 */
  316. void CStockItem::Initialize(void) {
  317.     memset(&this->Items, 0, 0x78);
  318.     memset(&this->Slots, 0, 0x78);
  319.     memset(&this->Weapons, 0, 0x1D10);
  320.     memset(&this->Attachs, 0, 0x3C0);
  321. }
  322.  
  323. /* 0x0023F6C0 */
  324. void CStockItem::SetItemToPos(s32 arg1, s16* arg2, s16* arg3) {
  325.     s16 temp;
  326.  
  327.     temp = this->Items[arg1];
  328.     this->Items[arg1] = *arg2;
  329.     *arg2 = temp;
  330.  
  331.     temp = this->Slots[arg1];
  332.     this->Slots[arg1] = *arg3;
  333.     *arg3 = temp;
  334. }
  335.  
  336. /* 0x0023F6F0 */
  337. void CStockItem::GetItemInfo(s32 arg1, s16* arg2, s16* arg3) {
  338.     *arg2 = this->Items[arg1];
  339.     *arg3 = this->Slots[arg1];
  340. }
  341.  
  342. /* 0x0023F790 */
  343. void CStockItem::GetWeaponInfo(s32 arg1, WEAPON_HAVE* arg2) {
  344.     memcpy(arg2, &this->Weapons[arg1], 0xF8);
  345. }
  346.  
  347. /* 0x0023F850 */
  348. void CStockItem::GetAttachInfo(s32 arg1, ATTACH_LIST* arg2) {
  349.     memcpy(arg2, &this->Attachs[arg1], 0x20);
  350. }
  351.  
Add Comment
Please, Sign In to add comment