Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int __fastcall sub_469A94(__int64 a1, int a2, int a3, int a4, unsigned int NewMemory, int NewTextVar, signed int Force, int IsOT)
- {
- signed int v8; // r9
- int CurrMemory; // r8
- unsigned int CurrIntensity; // r7
- int NewIntensity; // r6
- _DWORD *MemoryTable; // r4
- unsigned int R1; // r10
- unsigned int ChangePossibility; // r11
- unsigned __int16 NewIntensity; // r4
- int v17; // r0
- char v18; // r1
- signed int v19; // r2
- int v20; // r0
- int v21; // r1
- int NewFeeling; // r7
- int R2; // [sp+8h] [bp-40h]
- int R3; // [sp+Ch] [bp-3Ch]
- __int64 v25; // [sp+14h] [bp-34h]
- int v26; // [sp+1Ch] [bp-2Ch]
- int v27; // [sp+20h] [bp-28h]
- v25 = a1;
- v26 = a2;
- v27 = a3;
- ForceChange = Force;
- if ( !NewMemory || NewMemory >= 70 )
- return nullsub_1(0, 0);
- CurrMemory = getmemory_4D2728(a1, SHIDWORD(a1));
- CurrIntensity = getmemory_4D2728(v25, a4);
- NewIntensity = dword_58A134[7 * NewMemory];
- MemoryTable = &dword_58A134[7 * NewMemory];
- R1 = TinyMT_Global_Rand(100) + 1;
- ChangePossibility = MemoryTable[1];
- R2 = TinyMT_Global_Rand(256);
- R3 = TinyMT_Global_Rand(256);
- if ( MemoryTable[3] == 1 )
- {
- if ( IsOT )
- {
- if ( CurrMemory )
- {
- if ( MemoryTable[2] == 1 )
- return 0;
- goto LABEL_13;
- }
- ForceChange = 1;
- }
- else if ( !CurrMemory )
- {
- ForceChange = 1;
- }
- }
- if ( MemoryTable[2] == 1 )
- goto LABEL_29;
- LABEL_13:
- if ( ForceChange )
- goto LABEL_29;
- if ( R1 > ChangePossibility )
- return 0;
- if ( !CurrMemory ) // Blank Memory
- goto LABEL_29;
- if ( CurrIntensity >= 7 ) // Maximum Intensity
- return 0;
- if ( CurrMemory == NewMemory ) // Same Memory Value
- return 0;
- if ( CurrIntensity > NewIntensity + 2 ) // Stronger Intensity
- return 0;
- if ( CurrIntensity * R2 < NewIntensity * R3 )
- {
- LABEL_29: // Set random feeling according to new memory value
- v17 = 0;
- v18 = 0;
- v19 = 32;
- do
- {
- if ( MemoryTable[6] & (1 << v18) )
- ++v17;
- --v19;
- ++v18;
- }
- while ( v19 );
- if ( v17 )
- {
- v20 = TinyMT_Global_Rand(v17);
- v21 = 0;
- NewFeeling = 0;
- while ( 1 )
- {
- if ( MemoryTable[6] & (1 << NewFeeling) )
- {
- if ( v21 == v20 )
- {
- setmemory_3B42A0(v25, SHIDWORD(v25), NewMemory);
- setmemory_3B42A0(v25, v26, NewTextVar);
- setmemory_3B42A0(v25, v27, NewFeeling);
- return setmemory_3B42A0(v25, a4, NewIntensity);
- }
- ++v21;
- }
- if ( ++NewFeeling >= 32 )
- return nullsub_1(0, 0);
- }
- }
- return nullsub_1(0, 0);
- }
- NewIntensity = CurrIntensity + 1;
- if ( CurrIntensity + 1 >= 7 )
- NewIntensity = 7;
- return setmemory_3B42A0(v25, a4, NewIntensity);
- }
- // Table: dword_58A134
- // [0] Minimum Intensity
- // [1] Possibility of changing memory
- // [2] OT flag1
- // [3] OT flag2
- // [4] ???
- // [5] TextVar Type(0 none, 1 location, 2 item, 3 pokemon, 4 move)
- // [6] Possible feeling bitflags
- 0, 0, 0, 0, 0x26, 0, 0 //0
- 1, 100, 1, 0, 0x27, 1, 0x4CBFD //1
- 1, 100, 1, 0, 0x28, 1, 0x4BFD //2
- 1, 100, 1, 0, 0x29, 1, 0x4CBFD //3
- 1, 100, 1, 1, 0x2A, 1, 0x4CBFD //4
- 2, 5, 0, 0, 0x2B, 2, 0xFFFBFB //5
- 2, 5, 0, 0, 0x2C, 1, 0x84FFF9 //6
- 2, 5, 0, 0, 0x2D, 3, 0x47FFFF //7
- 2, 5, 0, 0, 0x2E, 0, 0xBF7FFA //8
- 2, 5, 0, 0, 0x2F, 3, 0x7660B0 //9
- 2, 5, 0, 0, 0x30, 0, 0x80BDF9 //10
- 2, 5, 0, 0, 0x31, 0, 0x88FB7A //11
- 2, 5, 0, 0, 0x32, 4, 0x83F79 //12
- 2, 5, 0, 0, 0x33, 3, 0x1FE //13
- 3, 10, 0, 0, 0x34, 3, 0xCFEFFF //14
- 3, 20, 0, 0, 0x35, 2, 0x84EBAF //15
- 3, 10, 0, 0, 0x36, 4, 0xB368B0 //16
- 3, 1, 0, 0, 0x37, 3, 0x91F7E //17
- 4, 50, 0, 0, 0x38, 3, 0x320A0 //18
- 4, 30, 0, 0, 0x39, 1, 0x80DDD //19
- 3, 5, 0, 0, 0x3A, 0, 0x81A7B //20
- 3, 5, 0, 0, 0x3B, 3, 0x404030 //21
- 3, 20, 0, 0, 0x3C, 0, 0xFFFFF //22
- 3, 5, 0, 0, 0x3D, 0, 0x9A08BC //23
- 3, 5, 0, 0, 0x3E, 1, 0x89A7B //24
- 3, 5, 0, 0, 0x3F, 3, 0x32AA //25
- 3, 1, 0, 0, 0x40, 2, 0x80FF7A //26 0x1A - Use Item
- 4, 50, 0, 0, 0x41, 0, 0xFFFFF //27
- 5, 100, 0, 0, 0x42, 0, 0x805FD //28
- 5, 50, 0, 0, 0x43, 3, 0x98278 //29 0x1D - Encounter Legends
- 5, 50, 0, 0, 0x44, 0, 0xB3FFF //30
- 2, 2, 0, 0, 0x45, 1, 0x8BBFFA //31
- 2, 2, 0, 0, 0x46, 1, 0x8BBFFE //32
- 2, 5, 0, 0, 0x47, 1, 0x81A97C //33
- 2, 5, 0, 0, 0x48, 2, 0x8BB97C //34
- 2, 5, 0, 0, 0x49, 1, 0x8BBF7F //35
- 2, 5, 0, 0, 0x4A, 1, 0x8BBF7F //36
- 2, 5, 0, 0, 0x4B, 1, 0x8BBF7F //37
- 2, 5, 0, 0, 0x4C, 1, 0x8BBF7F //38
- 2, 2, 0, 0, 0x4D, 1, 0xAC3ABE //39
- 3, 20, 0, 0, 0x4E, 2, 0xBFFFFF //40
- 3, 20, 0, 0, 0x4F, 0, 0x8B837C //41
- 1, 5, 0, 0, 0x50, 1, 0x848AFA //42
- 3, 10, 0, 0, 0x51, 0, 0x88FFFE //43
- 2, 1, 0, 0, 0x52, 3, 0x8B0B7C //44
- 2, 1, 0, 0, 0x53, 3, 0xB76AB2 //45 0x2D - Run away
- 4, 50, 0, 0, 0x54, 0, 0x8B1FFF //46
- 3, 30, 0, 0, 0x55, 0, 0xBE7AB8 //47
- 4, 20, 0, 0, 0x56, 4, 0xB77EB8 //48
- 4, 20, 0, 0, 0x57, 4, 0x8C9FFD //49
- 4, 10, 0, 0, 0x58, 3, 0xBF9BFF //50
- 4, 10, 0, 0, 0x59, 2, 0xF408B0 //51
- 2, 1, 0, 0, 0x5A, 1, 0xBCFE7A //52
- 4, 10, 0, 0, 0x5B, 3, 0x8F3F72 //53
- 2, 1, 0, 0, 0x5C, 1, 0x90DB7A //54
- 4, 50, 0, 0, 0x5D, 0, 0xBCEBFF //55
- 3, 30, 0, 0, 0x5E, 0, 0xBC5838 //56
- 3, 30, 0, 0, 0x5F, 1, 0x9C3FFE //57
- 4, 30, 0, 0, 0x60, 1, 0x9CFFFF //58
- 2, 2, 0, 0, 0x61, 1, 0x96D83A //59
- 3, 50, 0, 0, 0x62, 3, 0xB770B0 //60
- 3, 20, 0, 0, 0x63, 0, 0x881F7A //61
- 3, 20, 0, 0, 0x64, 0, 0x839F7A //62
- 3, 20, 0, 0, 0x65, 0, 0x839F7A //63
- 3, 20, 0, 0, 0x66, 0, 0x839F7A //64
- 2, 10, 0, 0, 0x67, 0, 0x53897F //65
- 3, 10, 0, 0, 0x68, 0, 0x41BB6F //66
- 4, 50, 0, 0, 0x69, 0, 0xC35FF //67
- 4, 20, 0, 0, 0x6A, 0, 0x8BBF7F //68 0x44 - Soaring in sky
- 2, 5, 0, 0, 0x6B, 0, 0x8BBF7F //69
Add Comment
Please, Sign In to add comment