-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Garages do not open / work #107
Comments
Also remember that you could park multiple cars in a single garage and have them saved in those positions, including the first garage (I used that trick a lot on the PS2 version). |
I'm trying to reach @spaceeinstein at the moment as he said I misinterpreted some of the garage stuff of his. |
When a garage is created through 0219, 021A, or a loading of a save game, the game looks through every object currently placed in the world. The game checks if the object's model name exists in the list of garage door model names. If there is a match, then the game checks if the object is within 20 units of the center of the garage area. If it is, then the game stores the reference of the object as a property of the garage. Now you have a door object that you can manipulate. A garage has several states: closed, opening, opened, closing, and a few other special cases. It is independent of the door object so garages should still work without it. Using a spray shop for example, the default state is opened. In this state, if the door object exists, the z position of the door object is set to the maximum height some units above its original placement in the world. When the player stops within the garage area, the state changes to closing and, if the door object exists, the z position of the door object is decreased down to its original placement in the world. The state changes to closed and waits for a moment. Then the state changes to opening and, if the door object exists, the z position of the door object is increased up to its maximum height. Now the state has returned to opened. The garage at index 0 is the crusher. Its creation is hardcoded into the game. The crusher is completely independent of the crane. |
This should be split into more specific issues now that there is some garage work completed |
At least the following garages must be supported in order to be able to play the game:
You can find a full list of garge types here
It's currently not known how the game knows which object is the garage door.
The garages are created from the script or a savegame. A garage is created as a specific type, and each type can have multiple garages associated with it.
The script also controls how each garage opens (swing door / slide door). It's a miracle how the game can know which garage number (which is independent from the type!) controls which door object.
There is a list which links different garages to their respective door model. However, each door model appears multiple times and the game somehow figures out which door is the correct one.
It's not known if the garage door objects might be hardcoded independent of the garages.
We should test if garage doors open, even if no garage is created from the script / savegame.
From the script the garages are identified by a number (the order they are created in the SCM, starting at index 1, index 0 is some unused (broken?) garage I believe). The index of each garage is then stored in the global variables listed on the list above.
Standard doors (such as the one to mistys house) and gates are created as instance object by script or savegame.
They are opened and closed by setting the heading / z_angle using the script or some slide opcode.
The text was updated successfully, but these errors were encountered: