Last active
August 5, 2025 00:29
-
-
Save 2Tie/5d20d9420bbac0929f8ad0b4d35e480e to your computer and use it in GitHub Desktop.
monster size generation G
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void SetMonsterSizes(int param_1,undefined8 param_2) | |
| { | |
| short *psVar1; | |
| uint uVar2; | |
| long lVar3; | |
| while( true ) { | |
| lVar3 = FUN_sub_main__004b3860(param_1,0); | |
| psVar1 = (short *)FUN_sub_main__004b3860(param_1,1); | |
| if (lVar3 == 0) break; | |
| if (psVar1 != (short *)0x0) { | |
| for (; *psVar1 != -1; psVar1 = psVar1 + 0x1e) { | |
| FUN_sub_main__004b78d0(psVar1,param_2); | |
| lVar3 = CheckMonsterScalable(*psVar1); | |
| if (lVar3 == 1) { | |
| psVar1[0x18] = *(short *)(DAT_0032d074 + 0x40); | |
| uVar2 = RollMonsterSize(); | |
| psVar1[0x18] = (short)((int)((uint)(ushort)psVar1[0x18] * (uVar2 & 0xffff)) / 100); | |
| lVar3 = FUN_0012d1b0(); | |
| if ((lVar3 == 1) || (lVar3 = FUN_sub_main__004f3b00(DAT_0032d018), lVar3 != 1)) { | |
| psVar1[0x18] = 100; | |
| } | |
| } | |
| else { | |
| psVar1[0x18] = 100; | |
| } | |
| } | |
| } | |
| param_1 += 0x10; | |
| } | |
| return; | |
| } | |
| undefined4 CheckMonsterScalable(short param_1) | |
| { | |
| undefined4 uVar1; | |
| if (((((((param_1 == 0x21) || (param_1 == 0x1f)) || (param_1 == 0x1c)) || | |
| ((param_1 == 0x1b || (param_1 == 0x2c)))) || (param_1 == 0x1a)) || | |
| (((((param_1 == 0x30 || (param_1 == 0x16)) || | |
| ((param_1 == 0x2e || (((param_1 == 0x15 || (param_1 == 0x27)) || (param_1 == 0x14)))))) || | |
| (((param_1 == 0x2f || (param_1 == 0x11)) || | |
| ((param_1 == 0x2d || | |
| ((((param_1 == 0xf || (param_1 == 0x2b)) || | |
| ((param_1 == 0xe || (((param_1 == 0x31 || (param_1 == 0x29)) || (param_1 == 0xb)))))) || | |
| ((param_1 == 8 || (param_1 == 0x26)))))))))) || (param_1 == 6)))) || | |
| (((param_1 == 0x25 || (param_1 == 0x2a)) || (param_1 == 1)))) { | |
| uVar1 = 1; | |
| } | |
| else { | |
| uVar1 = 0; | |
| } | |
| return uVar1; | |
| } | |
| byte RollMonsterSize(void) | |
| { | |
| undefined *puVar1; | |
| byte bVar2; | |
| uint uVar3; | |
| int iVar4; | |
| uVar3 = getNextRand(); | |
| /* grab a scale table */ | |
| puVar1 = (&PTR_DAT_sub_main__004fdb60_sub_main__004fdc40) | |
| [(byte)(&DAT_sub_main__004fdc60)[uVar3 & 0x1f]]; | |
| uVar3 = getNextRand(); | |
| /* grab scale category from quest */ | |
| iVar4 = *(char *)(DAT_0032d074 + 0x44) * 2; | |
| /* grab scale from table */ | |
| bVar2 = puVar1[uVar3 & 0x1f]; | |
| /* check against scale category */ | |
| if ((byte)puVar1[uVar3 & 0x1f] < (byte)(&DAT_00541e40)[iVar4]) { | |
| bVar2 = (&DAT_00541e40)[iVar4]; | |
| } | |
| if ((byte)(&DAT_00541e41)[iVar4] < bVar2) { | |
| bVar2 = (&DAT_00541e41)[iVar4]; | |
| } | |
| return bVar2; | |
| } | |
| scale tables odds table (4FDC60): | |
| 00 x1, 01 x1, 02 x2, 03 x19, 04 x6, 05 x2, 06 x1 | |
| scale tables (pointed to from table 4FDC40): | |
| 00: | |
| 4B x1, 4C x2, 4D x4, 4E x8, 4F x17 | |
| 01: | |
| 50 x1, 51 x2, 52 x4, 53 x8, 54 x17 | |
| 02: | |
| 55 x1, 56 x1, 57 x1, 58 x2, 59 x2, 5A x3, 5B x3, 5C x4, 5D x5, 5E x10 | |
| 03: | |
| 5F x1, 60 x2, 61 x2, 62 x3, 63 x4, 64 x8, 65 x4, 66 x3, 67 x2, 68 x2, 69 x1 | |
| 04: | |
| 6A x10, 6B x5, 6C x4, 6D x3, 6E x3, 6F x2, 70 x2, 71 x1, 72 x1, 73 x1 | |
| 05: | |
| 74 x17, 75 x8, 76 x4, 77 x2, 78 x1 | |
| 06: | |
| 79 x17, 7A x8, 7B x4, 7C x2, 7D x1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment