JS-Corrections

From Realsoft3D Wiki

The JS header files contain some errors. This page lists remedies for some of these. No guarantees of any kind are given, editing these files may corrupt your RS Javascript engine. Make sure that you have a copy of the original files before applying any of these modifications.

If you don't understand this page - don't try to apply any of the patches!!

Contents

Diff format

The patches shown here are listed in a format very similar to the unified diff format. In short, if the line starts with a '-', the line should be deleted from the file, if a line starts with a '+', the characters after the '+' should be added to the file. Lines that doesn't start with any of the characters '@', '-' or '+' can be used to locate where in the file the changes are supposed to be made.

Patches

  • js
    • real
      • code
        • r3vsl.js

          SETATTRIBUTESHOWSTATEBYOBJ - Wrong number of parameters

          The declaration of this method states that two parameters are required, in fact this method takes three paramters. In addition to this, the automatic header file generator that Realsoft used has a funny way of truncating method names. In r3vsl.js it causes two methods to have the same name. The effective result of this is that only the method that is last declared in the JS class will function. To remedy this, apply the following diff to your file:

           // 	 attr tag is unknown.
           // p2: Integer, attribute tag
           // p3: Integer, show state (TRUE == show, FALSE == hide)
           
          -R3VSLM_SETATTRIBUTESHOWSTATE = 53020;
          +R3VSLM_SETATTRIBUTESHOWSTATEBYOBJ = 53020;
           
          -function mR3VSLM_SETATTRIBUTESHOWSTATE(p2, p3) {
          -  return   DoA3(this.r3obj, R3VSLM_SETATTRIBUTESHOWSTATE, 0, R3TID_INTEGER, 0, p2, R3TID_INTEGER, 0, p3, R3TID_INTEGER, 0);
          +function mR3VSLM_SETATTRIBUTESHOWSTATEBYOBJ(p1, p2, p3) {
          +  return   DoA3(this.r3obj, R3VSLM_SETATTRIBUTESHOWSTATE, p1, R3TID_OBJECT, 0, p2, R3TID_INTEGER, 0, p3, R3TID_INTEGER, 0);
           }
          

          And further down:

              this.ISOFPHASELEVEL=mR3VSLM_ISOFPHASELEVEL;
          -   this.SETATTRIBUTESHOWSTATE=mR3VSLM_SETATTRIBUTESHOWSTATE;
          +   this.SETATTRIBUTESHOWSTATEBYOBJ=mR3VSLM_SETATTRIBUTESHOWSTATEBYOBJ;
          
          Error spotted in Error fixed in
          4.26.40 win

          SETATTRIBUTENAMEBYOBJ - Wrong number of parameters

          The declaration of this method states that two parameters are required, in fact this method takes three paramters.

           R3VSLM_SETATTRIBUTENAMEBYOBJ = 53021;
           
          -function mR3VSLM_SETATTRIBUTENAMEBYOBJ(p2, p3) {
          +function mR3VSLM_SETATTRIBUTENAMEBYOBJ(p1, p2, p3) {
          -  return   DoA3(this.r3obj, R3VSLM_SETATTRIBUTENAMEBYOBJ, 0, R3TID_INTEGER, 0, p2, R3TID_INTEGER, 0, p3, R3TID_STRING, 0);
          +  return   DoA3(this.r3obj, R3VSLM_SETATTRIBUTENAMEBYOBJ, p1, R3TID_INTEGER, 0, p2, R3TID_INTEGER, 0, p3, R3TID_STRING, 0);
           }
          
          Error spotted in Error fixed in
          4.26.40 win
      • objects
        • r3prim.h

          ENUMSELECTHANDLES - Wrong number of parameters

          The declaration of this method states that no parameters are required, in fact this method takes a tag list as a paramter.

           R3PRIMM_ENUMSELECTHANDLES = 140156;
          
          -function mR3PRIMM_ENUMSELECTHANDLES() {
          -  DoA(this.r3obj, R3PRIMM_ENUMSELECTHANDLES, 0, R3TID_INTEGER, 0);
          +function mR3PRIMM_ENUMSELECTHANDLES(p3) {
          +  return   Do(this.r3obj, R3PRIMM_ENUMSELECTHANDLES, p3, R3TID_TAG, R3TNF_ARRAY);
           }
          
          Error spotted in Error fixed in
          4.26.40 win
        • r3subdiv.js

          Point wise colour - Optimization bug in some versions

          The build for some platforms have a bug related to optimization, this means that the SDS-specific attribute ID for point wise colours can not be used in JS. To remedy this, apply the following diff to your file:

           function GetR3SUBDIVA_ColorSize() {
            return R3Get(this.r3obj, R3SUBDIVA_ColorSize, R3TID_INTEGER, 0); 
          }
          
          -R3SUBDIVA_PointwiseColor = 1235536;
          +//R3SUBDIVA_PointwiseColor = 1235536;
          +R3SUBDIVA_PointwiseColor = R3PRIMA_PointwiseColor;
          function SetR3SUBDIVA_PointwiseColor(value) {
            R3Set(this.r3obj, R3SUBDIVA_PointwiseColor, value, R3TID_VECTOR, R3TNF_ARRAY); 
          }
          
          Error spotted in Error fixed in
          6.01.24 32 bit Windows XP

          SELECTEDFACESTOTRI - Truncated method name

          The automatic header file generator that Realsoft used has a funny way of truncating method names. This may be a requirement of the JS engine, but it causes some problems. In r3subdiv.js it causes two methods to have the same name. The effective result of this is that only the method that is last declared in the JS class will function. To remedy this, apply the following diff to your file:

           R3SUBDIVM_GETMAXEDGESPERVERT = 1235126;
           function mR3SUBDIVM_GETMAXEDGESPERVERT() {
             return   DoA(this.r3obj, 1235126, 0, R3TID_INTEGER, 0);
          
          -R3SUBDIVM_SELECTEDFACESTOTRI = 1235127;
          +R3SUBDIVM_SELECTEDFACESTOTRIS = 1235127;
          -function mR3SUBDIVM_SELECTEDFACESTOTRI(p1, p3) {
          +function mR3SUBDIVM_SELECTEDFACESTOTRIS(p1, p3) {
            if(arguments.length < 2) {
          -      error("SELECTEDFACESTOTRI() needs 2 parameters");
          +      error("SELECTEDFACESTOTRIS() needs 2 parameters");
             }
             return   DoA2(this.r3obj, 1235127, p1, R3TID_BOOLEAN, 0, p3, R3TID_BOOLEAN, 0);
          
          

          Then, further down:

            this.GETMAXEDGESPERVERT=mR3SUBDIVM_GETMAXEDGESPERVERT;
          - this.SELECTEDFACESTOTRI=mR3SUBDIVM_SELECTEDFACESTOTRI;
          + this.SELECTEDFACESTOTRIS=mR3SUBDIVM_SELECTEDFACESTOTRIS;
            this.WELD=mR3SUBDIVM_WELD;
          
          Error spotted in Error fixed in
          4.26.40 win
          5.1.56 linux

          SETFACEMATERIALUV - Incorrect parameter type

          The header file specifies the uv parameter as a single vector rather than an array of vectors. To remedy this, apply the following diff to your file:

          R3SUBDIVM_SETFACEMATERIALUV = 1235093;
          
          function mR3SUBDIVM_SETFACEMATERIALUV(p1, p2, p3) {
            if(arguments.length < 3) {
                error("SETFACEMATERIALUV() needs 3 parameters");
            }
          -  DoA3(this.r3obj, 1235093, p1, R3TID_INTEGER, 0, p2, R3TID_STRING, 0, p3, R3TID_VECTOR, 0);
          +  DoA3(this.r3obj, 1235093, p1, R3TID_INTEGER, 0, p2, R3TID_STRING, 0, p3, R3TID_VECTOR, R3TNF_ARRAY);
          }
          
          Error spotted in Error fixed in
          4.26.40 win
          6.01.24 win

          EXTRUDE - Several tags omitted

          Some special tgas may be used with the EXTRUDE method, unfortunately, r3subdiv.js does not define symbols for these tags. In order to use these tags without having to remember their number, apply the following diff to your file:

          function GetR3SUBDIVA_Quality() {
             return R3Get(this.r3obj, R3SUBDIVA_Quality, R3TID_INTEGER, 0);
           }
          
          +R3SUBDIVA_ExtrudeRegionOpt = 1235512;
          +R3SUBDIVA_ExtrudeNormalOpt = 1235513;
          +R3SUBDIVA_ExtrudeLeaveFloor = 1235514;
          
          Error spotted in Error fixed in
          4.26.40 win 5.1.57 linux
          5.1.56 linux

Poor tree layout

This section has nothing to do with RS, it is a, not so subtle, pointer for you to make sure that your browser is up to date. If the tree looks something like this:

Image:FolderTree-MSIE.png

you have a browser that doesn't support the content CSS directive correctly. The tree should look something like this:

Image:FolderTree-Correct.png