eyza-cod2 / vscode-cod-gsc

Extension for VS Code for GSC scripts used in Call of Duty games
GNU General Public License v3.0
15 stars 0 forks source link

Add support for MW3 and BO2 #1

Open Jbleezy opened 4 months ago

Jbleezy commented 4 months ago

I feel like MW3 and BO2 should be included in this extension. These two games did not have that many changes yet, it was mostly starting with BO3 where the syntax got changed.

Love to see where this extension goes!

eyza-cod2 commented 4 months ago

Can you provide me support for these games? I would need raw files of these games to understand the changes they introduced to the GSC syntax.

If there is no much difference, i could add it to supported list of games

Jbleezy commented 4 months ago

I know BO2 added foreach loops and default arguments, the rest is basically the same.

eyza-cod2 commented 3 months ago

Do you have the original source files for BO2?

Jbleezy commented 3 months ago

https://github.com/plutoniummod/t6-scripts

JezuzLizard commented 1 month ago

https://github.com/Gamecheat13/RawGames/tree/Call-of-Duty/Call%20of%20Duty%20Black%20Ops%202

These are not decompiled, but rather actual source taken from different pre release versions of the game. I think they might be more useful as BO2 they added a primitive preprocessor, but that information is lost when compiled.

The full list of special syntax that I know of for BO2(though I suppose you would be able to easily detect it with the extension by opening the files, as they would be syntax errors):

foreach
%generic_human::some_anim
#define(only values canonically)
#insert(gsc-tool uses #inline)
default arguments
function flags(autoexec, private, codecall)
ternary
do while
const
# for dvar strings

gsc-tool also has the syntax reversed for T6 here: https://github.com/xensik/gsc-tool/blob/dev/gen/arc/parser.ypp

ineedbots commented 1 month ago

MW3 and MW2 are identical, so adding support for either will support both.

MW2 added childthread keyword, foreach

BO1 (and by extension BO2) added the hash # token.

Example of childthread: https://github.com/shit-ware/IW4/blob/8e6419893f593e8d157e92407256b423084e472f/maps/_zodiac_ai.gsc#L76

Example of foreach : https://github.com/shit-ware/IW4/blob/8e6419893f593e8d157e92407256b423084e472f/maps/mp/_areas.gsc#L34 and https://github.com/shit-ware/IW4/blob/8e6419893f593e8d157e92407256b423084e472f/maps/_intelligence.gsc#L35

Example of hash token: https://github.com/plutoniummod/t5-scripts/blob/main/MP/Common/maps/mp/gametypes/_bot.gsc#L9

eyza-cod2 commented 1 month ago

Added a support for foreach, ternary, do-while.

Will continue with childthread and call keywords.

ultimateshadsform commented 3 weeks ago

Here is the BO2 GSC dump. bo2-full-gsc-dump.zip

I found it on a forum and added another file which was missing. Not sure if it REALLY is the complete version but it seems to have most of it.

ultimateshadsform commented 3 weeks ago

I added patch_mp files to a project and it has 21K+ Problems. Good for fixing syntax in the extension.

image

ultimateshadsform commented 3 weeks ago

I just played around a little to get 21K but actually it is 217K something errors

ultimateshadsform commented 3 weeks ago

I also would like to add it would be nice if you could scan and use game source as a reference?

Like placing game files in game folder example:

game\patch_mp\codescripts\character_mp.gsc

And have custom code in src folder example:

src\main.gsc

Idk it would be nice to be able for it to recognize already existing code by placing game files in a "game" folder or something.

Example image: image

Anyways if you don't have game source I guess you could assume it is in the game or something and NOT provide IntelliSense for that or something?

ultimateshadsform commented 3 weeks ago

Oh. I see you have a choose folder for file reference feature? Very nice! I guess it's a vscode feature?

eyza-cod2 commented 3 weeks ago

Oh. I see you have a choose folder for file reference feature? Very nice! I guess it's a vscode feature?

There is an option to add folder for file references via Quick Action avaible for each diagnostic error. Its not intuitive, Im working on improved way to do that.