Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. DLC
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
      7. The Diamond Casino Heist
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

thehambone

GTA III Save File Documentation

Recommended Posts

Seemann

GTA3 allocates 140 entries for the CPed pool.

Share this post


Link to post
Share on other sites
OrionSR

Well... that's odd. I limited my CPed array to 138 because there appears to be inappropriate data in the next two structures.

 

This investigation has proven to be very frustrating. I don't see any hope of working out enough information to properly port a CPed structure between platforms. I get the impression that 90% of this data doesn't matter and will simply be replaced as soon as the game loads anyway. I'm going to move on to other things. This doesn't seem to be a productive investigation.

 

My experience with using 010 templates on memory suggests that a clever save editor could also serve as a trainer. Very similar tools can be applied to each purpose.

 

I updated my previous CPed post with a summary of the information I found and my current CPed template. I figured I'd better take care of that before moving on.

Edited by OrionSR

Share this post


Link to post
Share on other sites
OrionSR

Mafia Massacre - ConvertediOS to Android v2

 

Based on Seemann's comments on Variable Method Tables, and the fact that I stuffed every byte in CPed except weapons, weapons slots, health, armor, max stamina, vtml and player coordinates with BBs (0xBB) and not only did the save load and work properly, but only 2 unknown bytes and 4 dwords persisted after loading. Then I thought of something Seemann said about vtml, "The VMT is constant and built by the compiler for each virtual class." So, different engine, different VTM, right? And yes, they are different, and I fixed it in the save above. I am quite hopeful about this fix.

 

If this works, then the end game is near. I think we can properly port between Android and iOS saves. I need to make BB saves for each version that can be loaded (hopefully) and saved to provide the required clues as to which persistent bytes need to go where. It looks like everything else can safely be ignored.

Edited by OrionSR

Share this post


Link to post
Share on other sites
gangster2332

Mafia Massacre - ConvertediOS to Android v2

ill try it out

Share this post


Link to post
Share on other sites
OrionSR

Thanks gangster. I await your report as the results will determine how I proceed. No hurry though. I'm starting a new job today and probably won't have much time for a few days.

 

GTA3 CPed - Persistent Bytes

 

Everything else is either not read or replaced when loading. My thought is that they are not read as bogus data doesn't cause any issues.

 

0x0000 DWORD vtml

0x0034 FLOAT[3] playerCoords

0x0160 BYTE unknown (ped ref usually 2?)

0x02C0 FLOAT health

0x02C4 FLOAT armor

0x035C struct WeaponSlots (13 slots * 6 dwords = 312 bytes)

0x0498 BYTE WeaponSlot

0x0499 BYTE nWeaponCount

0x045C FLOAT maxStamina

0x056C DWORD[4] targetableObjects (that are not destroyed?)

 

targetableObjects - empty value is -1, 0xFFFFFFFF

 

I'm not sure what to make of these yet. This info is based on matching indexes in CPed and these global variables. I'm not sure why the targets in Ray4 are not included expect that those are destroyed and these are not. Experimenting with cleo should help clarify.

 

$31, $32, $33 - Main initial setup

$3246 - Ray5 Plaster Blaster

 

0x0160 BYTE unknown (ped ref usually 2?)

No idea. Value may be constant based on limited data. VC and SA seem to maintain the same value, maybe.

Edited by OrionSR

Share this post


Link to post
Share on other sites
gangster2332

 

Mafia Massacre - ConvertediOS to Android v2

ill try it out

crashes upon loading, like any other ios save

Share this post


Link to post
Share on other sites
Seemann

0x0160 BYTE unknown (ped ref usually 2?)

No idea. Value may be constant based on limited data. VC and SA seem to maintain the same value, maybe.

It's an entity type used for the mission cleanup routine. When the game creates a new entity from within a mission script, its type and handle are stored on the mission cleanup list. In GTA III and VC the following types are used: 1 is vehicle, 2 - ped, 3 - object. SA has more. Edited by Seemann

Share this post


Link to post
Share on other sites
OrionSR

Ah, okay then. Is it safe to call the byte at 0x160 EntityType? I guess that's a two part question. Is entity type the correct label; can you suggest something appropriate? And should the label be applied to the byte at 0x160? I'm just guessing on the significance of the data.

Share this post


Link to post
Share on other sites
Seemann

Sorry, I was wrong. That byte at +0x160 is not an entity type, it seems to be a ped reference: it is set to 1 for any pedestrian, and only equal to 2 when it's created with an opcode. So I would say 1 is a random ped, 2 is a script ped. Mission cleanup just uses the same constant value (2) for peds and that confused me.

 

With opcode 01c2 that byte changed from 2 to 1 for the ped.

Share this post


Link to post
Share on other sites
Silent

Would call it an entity owner, then.

Share this post


Link to post
Share on other sites
OrionSR
01C2: remove_references_to_actor [email protected] // Like turning an actor into a random pedestrian // legacy01C2: mark_char_as_no_longer_needed [email protected] // SA SCR

How about neededPedref (1=Random, 2=Needed)? That would make sense in terms of the legacy save documentation and both opcode INIs, but memory tends to get described a bit differently. If entity owner would make more sense in another context I'd prefer to use a standard name. Is this one of those parent/child class things that has to make sense for cars as well?

 

 

Share this post


Link to post
Share on other sites
Seemann

In San Andreas same field is located at CPed+484 and MTA team did not even document this field

https://github.com/multitheftauto/mtasa-blue/blob/master/MTA10/game_sa/CPedSA.h

there is BYTE bPad4a[80] in their doc;

 

DK described this field as dwUsageType which is closer to its meaning.

https://github.com/DK22Pac/plugin-sdk/blob/master/src/sdk/game_sa/CPed.h

 

I would add that CPed has a method called 004CF8B0 CPed::CanBeDeleted() that checks the byte at 0x160 and returns true if it's not equal to 2 (and only 2). Same valid for 005511B0 CVehicle::CanBeDeleted() (however the latter checks a number of fields).

 

I didn't like using the word ref in there, as it's not incremented/decremented as a reference count usually does. So personally I would stick to DK's term bUsageType or something like bOriginType (1=Random, 2=Script). A b prefix is needed as this field occupies a single byte in length.

Edited by Seemann

Share this post


Link to post
Share on other sites
OrionSR

Mafia Massacre ConvertediOSv3

 

I am much more confident that this save will load and the player will move properly. I repeated the process of replacing the imported iOS vtbl with an Android version, but this time I was more careful of the source file and manually calculated the position. I'm not sure what I did wrong last time. Please let me know how it works.

 

Never mind. This save loads but player moonwalks instead of backing up. I had to jump my way out of the garage.

 

Mafia Massacre ConvertediOSv4

 

Okay. Here we go. Not quite a direct conversion but should be a working save. I ended up stripping everything I could. The weapon slots should be loading properly now too.

Edited by OrionSR

Share this post


Link to post
Share on other sites
gangster2332

Mafia Massacre ConvertediOSv4

 

Okay. Here we go. Not quite a direct conversion but should be a working save. I ended up stripping everything I could. The weapon slots should be loading properly now too.

works like a charm

Share this post


Link to post
Share on other sites
Lethal Vaccine

Now back to my original question. If OrionSR was able to do that, why didn't Rockstar just do this from the start? I still don't see a reason to make III and VC NOT compatible, then make SA and CTW compatible. That's only 50% of the Mobile Ports which work between iOS and Android. Just doesn't make sense why they'd make it different between the operating systems.

 

Too bad I finished all my stuff and don't need anyone's Saves now that I did all the Mobile Ports myself...

Share this post


Link to post
Share on other sites
thehambone

Now back to my original question. If OrionSR was able to do that, why didn't Rockstar just do this from the start? I still don't see a reason to make III and VC NOT compatible, then make SA and CTW compatible. That's only 50% of the Mobile Ports which work between iOS and Android. Just doesn't make sense why they'd make it different between the operating systems.

I don't think it was Rockstar's choice to not make them compatible. The game was ported to mobile by War Drum Studios, so I'd blame them. I think the reason they aren't compatible in the first place is because the developers didn't expect people to be sharing saves across mobile devices, so it never crossed their minds to ensure that both iOS and Android saves were compatible.

 

 

Now that a save has been successfully converted, I can work to implement a file converter in my editor.

Share this post


Link to post
Share on other sites
Lethal Vaccine

So if someone wants to switch to a Windows Phone and/or an iPhone and/or an Android Phone they can't and instead have to buy the game AGAIN and complete the game AGAIN? Doesn't make much sense to me with how limited they are. Furthermore as I've stated a handful of times that SA and CW are compatible but III and VC are not. If 2 out of 4, or one half, is compatible how can the first two not be? I am still baffled... :p Idiot War Drum, I guess! :D

Share this post


Link to post
Share on other sites
OrionSR

The differences I see in the iOS and Android saves suggests that War Drum didn't to anything to make the saves incompatible. My current hypothesis is that iOS is happy to start writing new numbers starting on an even byte, but Android, like PC, insists on starting new numbers on doubly-even. This means that iOS records are a bit shorter, so the saves are incompatible.

 

Which leads to another question, why are SA saves compatible given the hypothesis above.

Share this post


Link to post
Share on other sites
gangster2332

The differences I see in the iOS and Android saves suggests that War Drum didn't to anything to make the saves incompatible. My current hypothesis is that iOS is happy to start writing new numbers starting on an even byte, but Android, like PC, insists on starting new numbers on doubly-even. This means that iOS records are a bit shorter, so the saves are incompatible.

 

Which leads to another question, why are SA saves compatible given the hypothesis above.

they introduced social club there for mobile, where you could store saves to be able to play on other devices. propably because of this

Share this post


Link to post
Share on other sites
Lethal Vaccine

...But, you can NOT do this in CTW. There is only 2 Save Slots and none of them mention a Social Club. There isn't even an option to sign into Social Club on Chinatown Wars, unlike SA Mobile. III and VC don't have that either, however III and VC have "Cloud" Saves, at least for iOS. But I don't use any of that stuff. I always save in Slot 1 for every Game on PS2/3 and iOS.

 

Want to know something else which is strange? CTW is compatible, sure, but when you give someone a Save from iOS (my own) to someone using Android Device, some of the Stats come up wacky. For instance, I have 100 something Missions Attempted, yet when I give it to someone on Android, they have something like 2000+ :lol: I have 49 Missions Failed...Android has 3, etc, etc. There is really weird statistical errors, BUT the Saves ARE compatible.

Edited by Militia

Share this post


Link to post
Share on other sites
spaceeinstein

@OrionSR, how's your progress on the documentation of the crane structure? This is my interpretation of the values:

 

0x00 dword index0x04 dword 0x08 dword 0x0C float pickup zone x1 (crane opcode parameter 3)0x10 float pickup zone x2 (crane opcode parameter 5)0x14 float pickup zone y1 (crane opcode parameter 6)0x18 float pickup zone y2 (crane opcode parameter 4)0x1C float destination point x (crane opcode parameter 7)0x20 float destination point y (crane opcode parameter 8)0x24 float destination point z (crane opcode parameter 9)0x28 float heading in radians (crane opcode parameter 10)0x2C float crane arm idle rotation in radians0x30 float crane arm destination rotation in radians0x34 float crane arm idle distance from center of crane0x38 float crane arm destination distance from center of crane0x3C float crane arm idle height0x40 float crane arm destination height0x44 float crane arm current rotation in radians0x48 float crane arm current distance from center of crane0x4C float crane arm current height0x50 float crane hook initial x0x54 float crane hook initial y0x58 float crane hook initial z0x5C float crane hook current x0x60 float crane hook current y0x64 float crane hook current z0x68 float 0x6C float 0x70 dword pointer to vehicle to pick up0x74 dword current game time + 10000 (only updates when crane has finished lifting car)0x78 byte crane activity       0 = idle crane       1 = crusher/military crane active       2 = crane inactive0x79 byte crane status       0 = idle       1 = crane moving to pick up       3 = moving upwards from pick up       2 = moving to destination       4 = moving downwards to drop off       5 = moving upwards from drop off0x7A byte number of vehicles dropped off0x7B byte is crusher crane0x7C byte is military crane0x7D byte 0x7E byte model is not doc_crane_cab0x7F byte align
Edited by spaceeinstein

Share this post


Link to post
Share on other sites
OrionSR

My progress on cranes stalled a while back and I have made no more progress. The only thing I had listed that is not included in your report is a timer of some sort at 0x74 and m_dwStaticIndex at 0x00, which is not the sort of name I would invent so I probably pulled it out of some other documentation somewhere.

 

Nice work on activating the VC cranes. I was really curious to see how that would work out.

Share this post


Link to post
Share on other sites
spaceeinstein

For the pickups block, can someone confirm if this is correct?

  • 0x24C0 - word - collected pickup array index value, always between 0 and 19
  • 0x24C4 - dword[20] - collected pickup array of pickup index values
The collected pickup array contains the last 20 collected pickup index values. When a pickup is collected, the array element at the collected pickup array index stores the pickup's index value and then the collected array index increments by 1. If the collected array index reaches 20, it resets back to 0 and starts back at the beginning of the array. Opcode 0214 (HAS_PICKUP_BEEN_COLLECTED) makes use of this data. Using the opcode sets the pickup index value in the array to 0 if it finds it and then returns true, otherwise it does nothing and returns false. Edited by spaceeinstein

Share this post


Link to post
Share on other sites
Seemann

Seems to be correct. They called CPickups::CollectedPickUpIndex and CPickups::aPickUpsCollected respectively.

Share this post


Link to post
Share on other sites
thehambone

 

034B: staunton_complete affects the bridge and tunnel traffic between Staunton and Shoreside islands, news headlines and no criminal rating limit (otherwise it can't be higher than 4552). Nothing special at all. Also the game plays an audio announcement on the radio about the bridge operating again once the opcode is executed.

I do not see any change in traffic from opcode 034B. Traffic restrictions for the bridges and tunnels seems to be controlled entirely by forbidden cube corners. The radio announcement is consistent, and I've noticed that the reader board above the Portland tunnel entrance has a message about the bridge opening. I don't know where to look for News Headlines.

 

III OpenUp

 

I've been experimenting with an OpenUp cleo script to help with testing of GTA III saves. I'm not sure what needs to be unlocked. Let me know if I forgot anything. The current script:

  • Repairs the bridge between Portland and Staunton
  • Removes any barriers blocking bridges and subways
  • Activates the lift bridge between Staunton and Shoreside Vale
  • Restores normal traffic to bridges and tunnels
  • Unhides all hidden vehicles

 

 

{$CLEO .cs}//IIIOpenUp.txt{Open Up GTA III map for testingRepairs the bridge between Portland and StauntonRemoves any barriers blocking bridges and subwaysActivates the lift bridge between Staunton and Shoreside ValeRestores normal traffic to bridges and tunnelsUnhides all hidden vehicles}0000:wait 10while true  wait 0  if    05EE:   key_pressed 0x75 // F6  then//  :Wait    wait 0    if      05EE:   key_pressed 0x75 // F6    then      jump @Wait    end03B6: replace_model_at 525.3125 -927.0625 71.8125 radius 20.0 from #NBBRIDGFK2 to #NBBRIDGCABLS01 03B6: replace_model_at 706.375 -935.8125 67.0625 radius 20.0 from #NBBRIDGFK2 to #NBBRIDGCABLS01 03B6: replace_model_at 529.0 -920.0625 43.5 radius 20.0 from #DAMGBRIDGERDB to #NBBRIDGERDB 03B6: replace_model_at 702.75 -939.9375 38.6875 radius 20.0 from #DAMGBRIDGERDB to #NBBRIDGERDB 03B6: replace_model_at 529.0 -942.9375 43.5 radius 20.0 from #DAMGBBRIDGERDA to #NBBRIDGERDA 03B6: replace_model_at 702.75 -919.9375 38.6875 radius 20.0 from #DAMGBBRIDGERDA to #NBBRIDGERDA 03B6: replace_model_at 525.3125 -927.0625 71.8125 radius 20.0 from #LODRIDGFK2 to #LODRIDGCABLS01 03B6: replace_model_at 706.375 -935.8125 67.0625 radius 20.0 from #LODRIDGFK2 to #LODRIDGCABLS01 03B6: replace_model_at 521.125 -922.9375 43.5 radius 20.0 from #LODGBRIDGERDB to #LODRIDGERDB 03B6: replace_model_at 702.75 -939.9375 38.6875 radius 20.0 from #LODGBRIDGERDB to #LODRIDGERDB 03B6: replace_model_at 529.0 -940.0625 43.5 radius 20.0 from #LODGBBRIDGERDA to #LODRIDGERDA 03B6: replace_model_at 702.75 -919.9375 38.6875 radius 20.0 from #LODGBBRIDGERDA to #LODRIDGERDA 0363: toggle_model_render_at 1027.25 -933.75 15.0 radius 50.0 object #INDHELIX_BARRIER 0 03B6: replace_model_at 1027.25 -933.75 15.0 radius 50.0 from #INDHELIX_BARRIER to #LOD_LAND014 //0108: destroy_object $34   // #SUBWAYGATE//0108: destroy_object $35   // #TUNNELENTRANCE:LOVE3_000D6: if 03CA:   object $34 exists 004D: jump_if_false @LOVE3_10108: destroy_object $34 // #SUBWAYGATE (gate in Chinatown, Portland):LOVE3_100D6: if 03CA:   object $35 exists 004D: jump_if_false @LOVE3_2 0108: destroy_object $35 // #TUNNELENTRANCE (Portland):LOVE3_200D6: if 03CA:   object $37 exists 004D: jump_if_false @LOVE3_3 0108: destroy_object $37 // #SUBWAYGATE (gate at Francis Intl. Airport):LOVE3_300D6: if 03CA:   object $38 exists 004D: jump_if_false @LOVE3_40108: destroy_object $38 // #SUBWAYGATE (gate at Francis Intl. Airport):LOVE3_400D6: if 03CA:   object $39 exists 004D: jump_if_false @LOVE3_50108: destroy_object $39 // #TUNNELENTRANCE (blocking Shoreside Vale access within tunnel):LOVE3_500D6: if 03CA:   object $51 exists 004D: jump_if_false @LOVE3_60108: destroy_object $51 // #HELIX_BARRIER (barriers to Shoreside Vale lift bridge):LOVE3_6//034A: portland_complete 034B: staunton_complete // activate lift bridge //034C: shoreside_complete // Last Requests - FRANK401E7: remove_forbidden_for_cars_cube 619.5625 -911.5 45.0 834.25 -954.5 32.0  01E7: remove_forbidden_for_cars_cube 659.5625 200.0 -20.0 945.75 147.5 5.0 01E7: remove_forbidden_for_cars_cube 529.5625 106.5 -30.0 581.375 65.6875 0.0 // A Drop in the Ocean - LOVE301E7: remove_forbidden_for_cars_cube 496.6875 75.5 -30.0 484.0 44.1875 0.0   01E7: remove_forbidden_for_cars_cube -46.75 -648.0 39.0 -69.0625 -614.0 50.0 //014C: set_parked_car_generator $445 cars_to_generate_to 101 // #KURUMA   (disabled during Cipriani's Chauffeur)//014C: set_parked_car_generator $460 cars_to_generate_to 101 // #IDAHO    (disabled during The Fuzz Ball)//014C: set_parked_car_generator $463 cars_to_generate_to 101 // #MRWONGS  (disabled during Taking Out The Laundry, The Pick-Up)//Blow Fish - TONI5014C: set_parked_car_generator $479 cars_to_generate_to 101 // #BELLYUP  (disabled)014C: set_parked_car_generator $480 cars_to_generate_to 101 // #BELLYUP  (disabled)014C: set_parked_car_generator $481 cars_to_generate_to 101 // #BELLYUP  (disabled)//Grand Theft Aero - LOVE4014C: set_parked_car_generator $536 cars_to_generate_to 101 // #COLUMB  (disabled)014C: set_parked_car_generator $537 cars_to_generate_to 101 // #COLUMB  (disabled)014C: set_parked_car_generator $492 cars_to_generate_to 101 // #YAKUZA014C: set_parked_car_generator $493 cars_to_generate_to 101 // #YAKUZA014C: set_parked_car_generator $494 cars_to_generate_to 101 // #YAKUZA014C: set_parked_car_generator $495 cars_to_generate_to 101 // #DODO014C: set_parked_car_generator $497 cars_to_generate_to 101 // #BFINJECT (Joe Bug 5:00 to midnight)014C: set_parked_car_generator $498 cars_to_generate_to 101 // #BORGNINE (100 Taxi Fares)014C: set_parked_car_generator $522 cars_to_generate_to 101 // #REEFER   (Portland complete)014C: set_parked_car_generator $549 cars_to_generate_to 101 // #RHINO    (Shoreside complete)  endend

 

 

Unlocking All Islands Through Save Editing

 

1.) Repair Callahan Bridge

The Callahan bridge makes use of the BuildingSwap (or StaticReplacement, depending on which document (III or SA) you're reading) array structure in block 0 of the save file in order to temporarily replace the fixed bridge models with the destroyed models for the Portland portion of the game. "Repairing" the bridge is as simple as clearing these BuildingSwap array elements.

The BuildingSwap structure (for reference):

 

struct{    DWORD nType;      // 0 = OBJ_NONE, 1 = OBJ_TREADABLE, 2 = OBJ_STATIC, 3 = OBJ_DYNAMIC, 4 = OBJ_DYNAMIC_NOTLOADED    DWORD nHandle;    int32 nNewModel;    int32 nOldModel;} BuildingSwap;
We can use the model IDs as well as the handles to identify which BuildingSwap elements to clear. Luckily, the handles appear persist across newly created saves on different instances of the game (tested on 1.0 EXE only).

To clear a BuildingSwap element:

 

eType = 0;nHandle = 0;nNewModel = -1;nOldModel = -1;
The following BuildingSwap entries must be cleared to repair the bridge:

 

handle, new model, old model, description3489, 1140, 1141, western support cables3478, 1140, 1141, eastern support cables3484, 1147, 1143, nw roadway3479, 1147, 1143, se roadway3485, 1146, 1145, sw roadway3480, 1146, 1145, ne roadway3486, 1187, 1181, LOD western support cables3481, 1187, 1181, LOD eastern support cables3487, 1185, 1183, LOD nw roadway3482, 1185, 1183, LOD se roadway3488, 1186, 1184, LOD sw roadway3483, 1186, 1184, LOD sw roadway
Remember, you are not removing the BuildingSwap elements, simply resetting their fields back to their default values. There should always be 25 BuildingSwap elements.

 

Lastly, I'm not sure if this is required or not, but main.scm shows that the global variable $BRIDGE_IS_DAMAGED ($36) is set to 1 after the models are swapped back to their repaired counterparts as the mission "Last Requests" wraps up. To me, this seems backwards, as the bridge is no longer damaged; wouldn't you think this should be set to 0? Regardless, if you want to remain consistent with the game script, you can set index 36 (DWORD at offset 0x90) of the global variables array to 1.

 

2.) Remove Road Barriers

a.) Remove Callahan Bridge Barriers on Portland

The Callahan Bridge barriers make use of both the BuildingSwap array and the InvisibilitySetting array structures in block 0. All that needs to be done to remove these barriers is set an element in both the BuildingSwap array and the InvisibilitySetting array for that object. Adding the object to the InvisibiltySetting array will make the object invisible (who would've guessed? :p), while the BuildingSwap entry will be used to replace the LOD model with LOD land.

The InvisibilitySetting structure (for reference):

 

struct{    DWORD nType;   // 0 = OBJ_NONE, 1 = OBJ_TREADABLE, 2 = OBJ_STATIC, 3 = OBJ_DYNAMIC, 4 = OBJ_DYNAMIC_NOTLOADED    DWORD nHandle;} InvisibilitySetting;
Similar to the bridge objects, the object handle for the road barrier appears to persist across game instances.

To remove the road barrier:

 

// InvisibilitySettingeType = 2;        // OBJ_STATICnHandle = 3513;// BuildingSwapeType = 2;        // OBJ_STATICnHandle = 3513;nNewModel = 218;  // #LOD_LAND014nOldModel = 855;  // #INDHELIX_BARRIER
b.) Remove Shoreside Lift Bridge Barriers on Staunton Island

The Shoreside Lift Bridge barrier is cleared using a different method. This object, unlike the Callahan Bridge barrier, is stored in the objects pool in block 4. All that needs to be done in order to remove this barrier is to delete this object from the object pool. The object can be identified in the pool by its handle and model ID. The model ID is 1299 and its handle is stored in the global variable $HELIX_BARRIER ($51).

To delete an object from the object pool:

1.) Locate the object element you wish to delete in the object pool array in block 4.

2.) Remove all 84 bytes of the element structure.

3.) Decrement the nNumObjects field that precedes the object array by 1.

4.) Subtract 84 from both size fields that precede the object array in block 4.

5.) Add 84 bytes to one of the padding blocks.

6.) Add 84 to the size field that precedes the padding block you just modified.

 

3.) Remove Subway and Tunnel Barriers

Essentially the same process as removing the Shoreside Lift Bridge barriers: find object handle from variable, locate object in pool, remove object from pool and adjust padding and size-of-data fields accordingly.

The model IDs of the objects and global variables containing the handles of the objects that need to be removed:

 

model, handle var1280, $SUBWAY_GATE_INDUSTRIAL ($34)1281, $TUNNEL_GATE_INDUSTRIAL ($35)1280, $SUBWAY_GATE_SUBURBAN1 ($37)1280, $SUBWAY_GATE_SUBURBAN2 ($38)1281, $TUNNEL_GATE_SUBURBAN ($39)
Again, just follow the steps above to remove an object pool entry.

 

4.) Remove forbidden cars cubes for Portland Bridge, Shoreside Lift Bridge and Porter Tunnel

Not sure how to do this yet... :whistle:

 

5.) Activate Shoreside Lift Bridge

This last step is easy! When Staunton Island is completed (i.e. "A Drop in the Ocean" is passed), the opcode 034B: staunton_complete is called, which activates the Shoreside Lift Bridge, among other things. The status of this opcode is saved in block 17 (stats block).

To activate the bridge, simply set the DWORD at offset 0xCC in the data section of block 17 to 1. I suppose you could set the status of 034A: portland_complete to 1 (offset 0xC8), as well as set the global variables $FLAG_INDUSTRIAL_PASSED ($208) and $FLAG_COMMERCIAL_PASSED ($209) to 1 if you want, but these steps aren't necessary.

 

A Few Questions

1.) Is there a way to confirm that object handles are constant? [Answered]. It certainly seems like they are from the testing that I've done, but I'd like to be sure that they're constant before committing any of this to any kind of an editor. To me, object handles seem like something that would change, say, each time a new game is created. However, this does not seem to be the case. Does the object type (STATIC or DYNAMIC) have anything to do with how objects are handled internally or does it refer to the fact that some objects are immovable and others are breakable? To me, it seems like type refers to the latter.

2.) Does anybody know how forbidden car/ped cubes are stored in the save file? I figure they'd be stored in block 5 (PathFind), but I have no idea how this block is structured. I may need to spend some time mapping out the structure of block 5.

Edited by thehambone

Share this post


Link to post
Share on other sites
spaceeinstein

BuildingSwap only allows types 0 to 2 and InvisibilitySetting only allows types 0 to 4. I documented this for VC and haven't fully explored III but they should be equivalent.

  • Type 0 - no object
  • Type 1 - a treadable object, i.e. object that have a PATH attached to it
  • Type 2 - a building object, i.e. regular static object
  • Type 3 - a script-created object or loaded dynamic object
  • Type 4 - a dummy object, i.e. unloaded dynamic object

Share this post


Link to post
Share on other sites
OrionSR

I forget the details of III objects. Are we talking only about objects added by main.scm? If so, you may want to consider pulling the handles from the associated global variables, just to be safe.

 

I haven't check the SA object handles to see if they vary, but I have founds differences in the indexes of pickups and gargens. The pickups are different because a few added through IPL are not included if a new game is started after loading a previous save. The gargens vary depending on where the save was made in doors or out and how much of the into cut-scene was skipped.

Share this post


Link to post
Share on other sites
thehambone

BuildingSwap only allows types 0 to 2 and InvisibilitySetting only allows types 0 to 4. I documented this for VC and haven't fully explored III but they should be equivalent.

Interesting. When I used opcode 0363: toggle_model_render_at to remove the Callahan Bridge barrier (the same opcode used in main.scm), an InvisibilitySetting entry was added with a type of 2. You say that type 4 is an unloaded dynamic object, but I don't think the Callahan Bridge barrier is a dynamic object, unless my understanding of static and dynamic objects is wrong.

 

I forget the details of III objects. Are we talking only about objects added by main.scm? If so, you may want to consider pulling the handles from the associated global variables, just to be safe.

Some of the objects are defined in main.scm, and their handles can be pulled from the global variables (Shoreside Lift Bridge barrier, tunnel and subway barriers). The rest of the objects used in the unlocking process (Callahan Bridge barrier and Callahan Bridge components) don't appear to have handles present in the global variables.

Edited by thehambone

Share this post


Link to post
Share on other sites
spaceeinstein

My definition of a dynamic object is any object that can change when damaged, like streetlights. When you use the opcode on a streetlight that hasn't been loaded, the type is 4. When you use it on one that has been loaded, the type is 3. Barrier objects are static so type 2 is right.

Share this post


Link to post
Share on other sites
Seemann

thehambone

BuildingSwap (or StaticReplacement, depending on which document (III or SA)

BuildingSwap is how it is called by the Rockstar devs, whereas StaticReplacement is a customly guessed name, which in fact makes more sense, but we should stick to the original one.

Lastly, I'm not sure if this is required or not, but main.scm shows that the global variable $BRIDGE_IS_DAMAGED ($36) is set to 1 after the models are swapped back to their repaired counterparts as the mission "Last Requests" wraps up. To me, this seems backwards, as the bridge is no longer damaged; wouldn't you think this should be set to 0? Regardless, if you want to remain consistent with the game script, you can set index 36 (DWORD at offset 0x90) of the global variables array to 1.

This name is taken directly from the script source code:
http://gtamodding.ru/wiki/Frank#frank4

INDUSTRIAL_PASSEDbridge_is_damaged = 1    //SWAP BRIDGE FROM DAMAGED TO FIXED


But as it's never ever used, its name and value actually do not matter.

1.) Is there a way to confirm that object handles are constant?

For the sake of simplicity consider a handle as an index the pool of same entities. Objects created in the same order will always have the same handle.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.