Project Open Downtown - Remake of wil.MIS - [RELEASED]

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
Post Reply
User avatar
valps
Car Jacker
Car Jacker
Posts: 35
Joined: 31 Dec 2020, 15:03
GH nick: Valps
Location: Brazil
Contact:

Project Open Downtown - Remake of wil.MIS - [RELEASED]

Post by valps »

[yakuza] [zaibatsu] :)

Hello everyone!

In this project I want to create an equivalent to the source code of wil.scr. We know we already have the bil.MIS and all missions of Industrial District in our hands, but the source code of Downtown District and Residential District are missing.

I'm doing this because I want to mod Downtown District, such as make it more difficult. Furthermore, I want to learn more how the devs made the main districts. I don't want to passively read tons of code written by Billy Thomson, I will learn more efficiently if I rewrite the code. Also, I'm making a big (not full-size) and special map and I want to put some missions there.

We know that each district were made (mostly) by three (near) independent devs. As to Downtown District I want to know how William Mills did it.

I started with T.M. SCR decompiler which do all the hard work but all IF's, ELSE's, NOT's and WHILE's are broken, since T.M. never finished his decompiler.

Still, T.M.'s decompiler left in the partially decompiled .MIS some comments indicating that there is a use of IF or WHILE. It is possible to rebuild the IF's and WHILE's from these comments.

It's possible and feasible.

All you have to do is to solve puzzles of where and how the variables (COUNTERs) are used in the code. I initially thought it would be way too difficult, but isn't that hard.

I'm find tons of leftover variables that aren't used or that they are meant to be used but they were left unfinished.

Discover the how +170 variables are used is possible and feasible too. Just taken a whole day, but it worths it.

This is what the decompiler yields:
decompiled_code.png
decompiled_code.png (29.11 KiB) Viewed 1141 times
This is the same code but reworked:
reworked_code.png
The version 1.1.0 has been released:
Project_Downtown_v1.1.0.zip
(291.19 KiB) Downloaded 23 times
Older versions: https://github.com/Valps/Project_Open_D ... tag/v1.0.3

All things of Downtown District I'm aware of can be replicated compiling the main file wil.mis

Its files:

wil.MIS (the main script)
wil_end.MIS (the final job script)
wil_tra.MIS (the training mission, namely tutorial)

Loonies Missions: ;)

wil_le1.MIS ("Radio Za-Za!")
wil_le2.MIS ("Pizza Cake!")

wil_lm1.MIS ("Who is mad?")
wil_lm2.MIS ("Destroy J-Lab")
wil_lm3.MIS ("Dimentia to go!")

wil_lh1.MIS ("Taxi Drivers Must Die!")
wil_lh2.MIS ("Gang War A-Go-Go!")

Yakuza Missions: [yakuza]

wil_ye1.MIS ("Get ZitZaki!")
wil_ye2.MIS ("Bank Robbery!")

wil_ym1.MIS ("Happy Gas Smash!")
wil_ym2.MIS ("Get Gama Rei!")
wil_ym3.MIS ("Follow That Traitor!")

wil_yh1.MIS ("Swat Van Swipe!")
wil_yh2.MIS ("Stop the Tank!")

Zaibatsu Missions: [zaibatsu]

wil_ze1.MIS ("Cop Car Crush!")
wil_ze2.MIS ("Wheeler-Dealing!")

wil_zm1.MIS ("Lick Those Loonies!")
wil_zm2.MIS ("Yutes Must Die!")
wil_zm3.MIS ("Big Bank Job!")

wil_zh1.MIS ("Armored Car Clash!")
wil_zh2.MIS ("Bank Van Theft!")

This bundle is ready to get compiled with miss2.exe compiler.

All feedback are welcome, especially about bugs.

[respect]
Last edited by valps on 22 Oct 2024, 00:37, edited 12 times in total.
User avatar
valps
Car Jacker
Car Jacker
Posts: 35
Joined: 31 Dec 2020, 15:03
GH nick: Valps
Location: Brazil
Contact:

Re: Project Open Downtown - Remake of wil.MIS

Post by valps »

Version 1.1.0

- I've learned that there is a way to nest two or more WHILE_EXEC without freezing the game, which the original devs have used it. The next two topics are consequences of that:

- The main loop subroutine was reworked and now it is exactly the same of the original wil.scr (to see that you might decompile the original wil.scr, the open source version and compare their subroutine "function1"). The main loop is now a lot faster because it runs using WHILE_EXEC.

- All WHILE's were replaced by WHILE_EXEC, so all EXEC blocks which are inside a WHILE become obsolete and they were removed since now all commands are executed at the same frame. Now a lot of missions are executed faster.

Version 1.0.3

- Fixed a lot of crash issues when some mission fail conditions are triggered (thanks to WordofWind for finding them)
Missions fixed:

- Taxi Drivers Must Die
- Dementia to go
- Get ZitZaki
- Bank Robbery
- Happy Gas Smash
- Cop Car Crush
- Bank Van Theft
- Lick those Loonies
- Yutes must die
- Big Bank Job

Version 1.0.2:

- The countdown timer in the mission "Wheeler-Dealer" is now very accurate

Version 1.0.1:

- Fixed the mission fail check condition on clean-up of the mission "Yutes Must Die"
- Fixed the zaibatsu assassins trying to drive over the player in the mission "Who's Mad"
- Fixed the rooftop arrow of "Destroy J-Lab" and a spammed brief
- The district exit flag now no longer stays on player screen if he is playing a mission
- Some WHILE's replaced by WHILE_EXEC in missions script, then some missions will be a little faster

Version 1.0.0:

Includes:
- All those global name tags from wil.MIS renamed according to wil_name.txt list, such as saved counters, functions etc.
- Improved comments on .mis files
Last edited by valps on 22 Oct 2024, 00:39, edited 6 times in total.
User avatar
valps
Car Jacker
Car Jacker
Posts: 35
Joined: 31 Dec 2020, 15:03
GH nick: Valps
Location: Brazil
Contact:

Re: Project Open Downtown - Remake of wil.MIS

Post by valps »

There are 2 sub projects I'm want to do using these open source codes:

- Downtown, but more harder

We know that Downtown District is tweaked to be newbie-friendly, so there is a lot of things we can do to make it having nearly the same difficult of the Residential or Industrial District. I want to modify almost all the missions.

- Campaing mode Multiplayer Coop in Downtown

The campaing mode of Downtown District with all the missions but with a second player. I already made some tests and it works very well.
Preview of the coop mode
Preview of the coop mode
coop.jpg (374.02 KiB) Viewed 974 times
User avatar
B-$hep
Immortal
Posts: 579
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: Project Open Downtown - Remake of wil.MIS - [RELEASED]

Post by B-$hep »

Hello.
Nice work but why you didnt use script decompiler?
It can decompile everything except IF..ENDIF, WHILE loops
Always wear safety glasses while programming.
User avatar
valps
Car Jacker
Car Jacker
Posts: 35
Joined: 31 Dec 2020, 15:03
GH nick: Valps
Location: Brazil
Contact:

Re: Project Open Downtown - Remake of wil.MIS - [RELEASED]

Post by valps »

B-$hep wrote: 28 Sep 2024, 08:48 Hello.
Nice work but why you didnt use script decompiler?
It can decompile everything except IF..ENDIF, WHILE loops
I used script decompiler. I guess I misused the "remake" meaning, since I didn't write all code from scratch.

All I had to do was to identify which COUNTER do and how these are used, since the decompiler does not restore the original names of the variables. The decompiler also does not distinguish WHILE's from IFs except by a "GOTO" in the end, while the logic operators AND and OR are completely ignored by decompiler. The only hint I had was all "IF Jumps" appearing in the decompiled code, and the "GOTO" at the end of a WHILE.

Also all ELSE's operators are completely ignored, so if you find a non-sense sequence of commands like

SET count37 = 1
SET count37 = 0

or

DELETE_ITEM (auto99)
SET_CAR_NUMBER_GRAPHIC (auto99, 8)

then there is a high likelihood that there is an ELSE hidden between these commands.

There is another error in the decompiler I have found. The decompiler does not distinguish the char objective ENTER_CAR_AS_DRIVER from ENTER_CAR_AS_PASSENGER, setting all to ENTER_CAR_AS_DRIVER.

Basically I solved some hard "puzzles", guessing what all counters do, guessing if it is a IF or WHILE, guessing if there is a AND or OR operator, and guessing if there is a ELSE. It was hard in the beginning, but I got used to it.

The decompiler also does not give different names when a COUNTER is declared in mission script, so if the last COUNTER declared on main script is count26, the counters declared in all missions scripts will always begin at count27. Then I can't leave these names unchanged because the compiler will detect multiple different variables with the same name. To give names to these variables, I had to discover the real purpose of each variable in the code and then give a unique decent name to them.

I changed the name of most saved counters too, so in the open source code all mission counters have a intelligible name. If somebody want to modify a Downtown mission, it would be easy.

I have already started to remake ste.mis from residential district. I already have an functional "partially open" residential district with all the basic stuff (including the wang cars and the shoot-out in the beginning) working, redneck cranes fixed etc, but I want to remake all residential missions only in december.
Post Reply