Skip to content
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

3.9.0 Release Plan #231

Closed
46 tasks done
x87 opened this issue Jun 10, 2023 · 3 comments
Closed
46 tasks done

3.9.0 Release Plan #231

x87 opened this issue Jun 10, 2023 · 3 comments
Labels
Milestone

Comments

@x87
Copy link
Collaborator

x87 commented Jun 10, 2023

Breaking Changes

Some old code may not compile in this version. Read through the notes down below.

Download

https://github.com/sannybuilder/dev/releases/tag/v3.9.0

Features

Bug Fixes

@x87 x87 added the roadmap label Jun 10, 2023
@x87 x87 added this to the v3.9.0 milestone Jul 1, 2023
@x87
Copy link
Collaborator Author

x87 commented Jul 4, 2023

Internal Changes

  • new, stricter INI parser. helped to identify some mistakes in the existing files. Old *SCM.INI published elsewhere won't work and likely cause compilation errors.
  • split of the modes.xml into individual files. Sanny scans \data directory for folders with mode.xml and treats them as mode configs.
  • split of the monolithic SASCM.INI into multiple INI files. Adding extra opcodes is as easy as just dropping a file named SASCM.*.ini into the data\sa folder
  • new transform phase in the compiler that helps to process arithmetic operations without an opcode, e.g. it now supports bitwise operators
  • command names defined in SBL JSON files are now valid keywords (available in GTA III, VC, SA modes)

@x87
Copy link
Collaborator Author

x87 commented Jul 10, 2023

Breaking Changes

  • compiler now throws an error if an unknown* model name is used in a FOR loop range, or inside a HEX..END.

i.e. the following code is no longer valid if MODEL1 and MODEL100 are unknown names.

for 0@ = #MODEL1 to #MODEL100 
hex
 #MODEL1
end

*Unknown model is such a model, that is not defined in the standard IDE files such as default.ide, peds.ide, or vehicles.ide. Or the game directory is not set in the options, so the compiler can't read those files.

Previously the compiler would try to add those modes to the DEFINE OBJECT list if it was an SCM file (not CLEO) and replaced model names with negative indexes in that list, e.g. -1 or -2. This behavior most likely deviates from the script goal and leads to many confusions.

Solution

To compile this code, the compiler should have access to the game's data folder, meaning one should set the game directory in the options. Then, it scans the standard IDE files (see above) and finds an id for the given models (MODEL1 and MODEL100). If such names are not found, another error is thrown.

Alternative path is to replace model names in the code with their respective IDs (numbers).


  • compiler now throws an error on a duplicate constant declaration. The error code is 0090. Previously Sanny would silently ignore subsequent declarations and use the first value.
const x = 5
const x = 6
0@ = x // it would've been 0@ = 5, now error

Solution

Use unique name for each constant.


  • compiler is stricter about variable and constant declarations. Previously parser allowed all kind of non-sense and missing syntax elements (missing : in var v int). now parser obeys rules formalized here.

Solution

Update the code to match the spec.

@x87 x87 pinned this issue Jul 10, 2023
@x87
Copy link
Collaborator Author

x87 commented Jul 12, 2023

Release Notes

beta.2

beta.1

beta.0

alpha.2

  • add support for inline and comma-separated const and var declarations
const x = 10
int 0@ = 5, 1@ = 6, 7@ = 10.0
float x, y, z
const
    VarName = $Var
    IndexName = 25
end
VarName[IndexName] = 0

alpha.1

  • add support for constants and hexadecimal numbers for n in byte(n) syntax (see 1 below).
  • support constant names in bitwise operations (see 3 below)
  • support for timed addition and substraction operator =@
  • support for cast assignment operator =#
  • disassemble invalid floats (NaN) as integer numbers
  • fix an error in compiling class props with parenthesis (e.g. 0@ = $PLAYER_CHAR.CurrentCar())
  • include CLEO 4.4.4

alpha.0

  1. it is now possible to generate a series of repetitive bytes in hex..end using new byte(N) syntax. For example, if you needed 10 zero bytes, you had to write each one individually as follows:
hex
  00 00 00 00 00 00 00 00 00 00
end

Now it is possible to write:

hex
  00(10)
end

there should be no whitespace between a byte and a number of repetitions enclosed in braces. You can use this syntax many times per block:

hex
  00(3) FF 01(4) FF
end

will be unwrapped to

hex
  00 00 00 FF 01 01 01 01 FF
end

N can be a constant defined earlier in the code:

const n = 10

hex
  00(n)
end
  1. It is now possible to include a whole file as a binary blob using hex..end and $INCLUDE directive. I.e.
hex
  {$INCLUDE file.bin}
end

will read the file.bin from the disk as a binary file, then insert each byte of it into hex..end, and compile. Common {$INCLUDE} rules apply https://docs.sannybuilder.com/coding/directives#usdinclude

  1. Support Bitwise Operations without opcodes #97
    I.e. now this code
0@ = 1@ % 2@
~0@

will be compiled without need for opcodes. See #97 for the complete reference.

  1. Each command name defined in .JSON files (from Sanny Builder Library) serves as a keyword for Sanny Builder. It means it is allowed to write a code like this:
get_controller_mode $13
if 
  not $13 == 3
goto_if_false @label1
if 
  is_button_pressed 0 pressed_key 19
goto_if_false @label2

which is similar to SA SCR mode, but does not require any keywords be explicitly declared in keywords.txt.

To support an enormous amount of new keywords in IDE the autocomplete list was limited to 200 names.

  1. TIMERA and TIMERB implicitly declared as int variables.
var
 $x: int
end

$x = TIMERA // 008A: $x = TIMERA  // (int)
  1. Edit mode configuration changed and mods don't have to be listed in modes.xml anymore. Each mode is a separate folder inside data and their config is located in a mode.xml file. Creating and maintaining your own modes could be done independently from core Sanny Builder files and future updates won't affect them.

@x87 x87 closed this as completed Sep 10, 2023
@x87 x87 unpinned this issue Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant