SCM related

Last-modified: 2009-01-21 (水) 18:22:19

0xA49960 - Start of the SCM block (0xA49960 + (4 * varnumber) is that particular variable)
0xA7A6A0 - Start of the mission block (69000 bytes)
0x464080 - GetOpcodeParameters()
0xA447F4 - Command count
00469F00 - CRunningScript_ProcessOneCommand
0x464080 - CRunningScript_CollectParameters
0x4859D0 - CRunningScript_UpdateCompareFlag
0x469390 - Game_Script_Thread struct
0xA43C78 - Where the routine above stores opcode parameters values. Max 16 paramters for an opcode it seems
0x8A6168 - "Master" jumptable, each dword points to one of 27 different functions, each one handling approx 100 opcodes
0x466C50 - Opcodes 0000 - 0063. Array of dword, each pointing to the function for that opcode
0x468364 - Opcodes 0064 - 00C4. Array of dword, each pointing to the function for that opcode
0x469E4C - Opcodes 00D6 - 0129. Array of byte, each byte is an index for the array of dword at 0x469DD4, which points to the opcode function
0x47D1B4 - Opcodes 0137 - 018F. Array of byte, each byte is an index for the array of dword at 0x47D0F4, which points to the opcode function
0x47DFE0 - Opcodes 0190 - 01F3. Array of byte, each byte is an index for the array of dword at 0x47DF58, which points to the opcode function
0x47F304 - Opcodes 01F4 - 0256. Array of byte, each byte is an index for the array of dword at 0x47F24C, which points to the opcode function
0x47FA04 - Opcodes 0292 - 02B8. Array of byte, each byte is an index for the array of dword at 0x47F9BC, which points to the opcode function
0x480FD8 - Opcodes 02BE - 031D. Array of byte, each byte is an index for the array of dword at 0x480F10, which points to the opcode function
0x4836B8 - Opcodes 0320 - 0382. Array of byte, each byte is an index for the array of dword at 0x483600, which points to the opcode function
(No time to finish now, will finish later)

Threads
0xA8B430 - Start of the threads pool. There are two queues: the active threads and inactive ones.
0xA8B42C - Pointer to the first active SCM thread.
0xA8B428 - Pointer to the first inactive SCM thread.

Each thread has size of 224 (0xE0) bytes.

  1. 0 = [void*] Pointer to the next thread in a queue
  2. 4 = [void*] Pointer to the previous thread in a queue
  3. 8 = [char] Thread name given by the opcode 03A4, char 8
  4. 16 = [dword] Thread base IP (used in the missions and external scripts to calculate a global address of a local jump offset)
  5. 20 = [dword] Current IP
  6. 24 = [dword] Return stack (stores the current IP when a gosub executed, dword 8)
  7. 56 = [word] Last item index of the return stack
  8. 60 = [dword] Local variables array, dword 32
  9. 188 = [dword] Automatically incrementing timers, dword 2
  10. 196 = [boolean] Thread active flag
  11. 197 = [boolean] IF result
  12. 198 = [boolean] Mission flag
  13. 199 = [boolean] External script flag
  14. 200 = [boolean] Unknown flag (in menu?). Used in 03E5
  15. 201 = [boolean] Unknown flag (ID of an assigned script?)
  16. 204 = [dword] Wakeup time (set by 0001)
  17. 208 = [word] IF number (set by 00D6)
  18. 210 = [boolean] Not flag (if a condition to check is negative – any opcodes higher than 0x7FFF)
  19. 211 = [boolean] Wasted or busted check enabled flag (set by 0111); only for missions
  20. 212 = [boolean] Player is wasted or busted flag; only for missions
  21. 216 = [dword] Skip scene IP (used by opcodes 0707, 0701)
  22. 220 = [boolean] Mission flag
    External Scripts Info
    0xA47B60 – Start of the external scripts info pool. There are 82 elements with 32 bytes of size each
  1. 0 = [dword] Script IP
  2. 4 = [word] Status (can be obtained by 0926)
  3. 6 = [word] Index in SCM (a number as defined in the scm header)
  4. 8 = [char] Name, char 20
  5. 28 = [dword] Size
    0xA485A0 – [dword] Size of the largest external script
    0xA485A4 – [dword] Total scripts count

Misc
0xA4892C – Start of the pool stored the flipped vehicles handles. There are 6 elements in there, with each of them:

  1. 0 = [dword] Vehicle handle to check if it flipped. Stored by opcode 0190.
  2. 4 = [dword] Time in ms passed from the moment a vehicle flipped. Used by opcode 018F
    00A90850 – Start of the mission cleanup list. This list keeps the handles of any entities created during a mission. When the opcode 00D8 executed (normally it happens at the end of any mission), the game reads this list and destroys everything being stored there. Maximum of the items in the list is 75. Each item has the following structure:
  1. 0 = [byte] Entity type:
    1 - vehicle
    2 - actor
    3 - object
    4 - particle
    5 – group (062F)
    7 – AS_origin (061D)
    8 - action_sequence
    9 - decision maker
    11 - searchlight
    13 - txd_dictionary
  2. 4 = [dword] entity handle (an index in the proper pool)