Jump to content

Photo

Triangle3D() : Undocumented ZScript Function You Can Use

Report ZScript Functions Internal Drawing Triangle 3D

  • Please log in to reply
4 replies to this topic

#1 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 09 September 2015 - 12:51 AM

I think people will find this useful: Triangle3D() is an undocumented ZScript function, that is internal to ZQuest. It requires no headers (not even std.zh), and it isn't mentioned in ZScript.txt, so this may be the first you've heard of it.

Details
Triangle3D() works in the same way as Quad3D(), so you may refer to the documentation for that if you have any questions. It's syntax is as follows:
 

void Triangle3D( int layer, int pos[9], int uv[6], int csets[3], int size[2], int flip, int tile, int polytype );
* [9]pos - x, y, z positions of the 3 corners.
* [6]uv - x, y texture coordinates of the given texture.
* [3]csets - of the corners to interpolate between.
* [2]size - w, h, of the texture.

Args pos[9], uv[6], csets[3], and size[2] are arrays, that you will need to create, and pass to the function.

I haven't done much with this, but it is critical to making 3D environments, should anyone else be mad enough to try that.
 
I've added this to the ZScript.txt update, and added it to the present (working template) for new Drawing Functions entry on the Wiki. Other than that, I can't guide you very far, so if you want to make use of it, you will need to experiment.
 
P.S. I do not know if this was intentionally left out of ZScript.txt, or if it was an oversight. The function does compile. Gleeok has casually mentioned it in the past, in one or two posts, but it has never been in the docs.


Edited by ZoriaRPG, 09 September 2015 - 12:52 AM.

  • Astromeow likes this

#2 Alucard648

Alucard648

    Magus

  • Members
  • Location:castle Dracula

Posted 09 September 2015 - 01:59 AM

One question: does this function work as intended? Screenshot of this function in action, please.



#3 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 09 September 2015 - 02:06 AM

Did I forget to document that..?? :/ My bad. :D I blame the butterflies.

#4 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 09 September 2015 - 02:15 AM

Did I forget to document that..?? :/ My bad. :D I blame the butterflies.

 

Heheh.

 

Luck you have a sucker to do the work for you. :D

 

I think you will like the updated docs, and I do need to discuss my proposed std.zh and string.zh updates at some point. I should be done with those in a few days, at which point, I'll send them to you.

 

I should also note, these are also undocumented, and I'm not sure what a colour buffer is:

 

////////////////////
/// Undocumented ///
////////////////////

//! These are in the source code, but have no documentation, at all, at all.
//! I'm unsure of the intended use, or what a 'colour buffer' means.

void SetColorBuffer(     int amount, int offset,        ZASM Instruction:
                         int stride, int *ptr )         SETCOLORB

Opcode: OSetColorBufferRegister()
Example Use:

/************************************************************************************************************/

void GetColorBuffer(    int amount, int offset,     ZASM Instruction:
                        int stride, int *ptr )      GETCOLORB
            
Opcode: OGetColorBufferRegister();
Exaple Use:

/************************************************************************************************************/

void SetDepthBuffer(    int amount, int offset,     ZASM Instruction:
                        int stride, int *ptr )      SETDEPTHB
            
Opcode: OSetDepthBufferRegister();
Example Use:

/************************************************************************************************************/

void GetDepthBuffer(    int amount, int offset,     ZASM Instruction:
                        int stride, int *ptr )      GETDEPTHB
            
Opcode: OGetDepthBufferRegister();
Example use:

/************************************************************************************************************/

 

Is a colour buffer some strange allegro thing? What is the proper usage of these functions?

 

Further...there's this...

 

This ZASM instruction has no ZScript equivalent:

 

//Overlay Tile

//! Is there a ZScript equivalent of this?!
//! This instruction seems to be ***ZASM-specific***.
//! Game->overlayTile() and Screen->OverlayTile() both return an error (no such pointer).
//! Add this to the bytecode in a future build.

void OverlayTile() ?

 

    OVERLAYTILEVV
    OVERLAYTILEVR
    OVERLAYTILERV
    OVERLAYTILERR

 

 

/************************************************************************************************************/

 

 

...at least, none that I can find. Is this an oversight?

 

The ZASM instruction should work; unless it doesn't, and this wasn't included in 2.50.x.

I'm also uncertain if I should document the Script RAM and Global RAM commands, because of how they might be abused. Did you intentionally leave those out of the docs, for that sort of reason?

 

 

I also think I have those script drawing things that I sent to you, close to done. Poke, poke, PolyXor.

 

One question: does this function work as intended? Screenshot of this function in action, please.

 

It works. I simply have no viable example of it, or any real idea of a good example. I guess I could make a Zelda 'animated series' Triforce jewel or something, but I'm spending all my time doing more useful things. Gleeok might have a quest file that uses it, somewhere.


Edited by ZoriaRPG, 09 September 2015 - 02:19 AM.


#5 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 09 September 2015 - 04:54 AM

It's a secret to everybody. :P


Actually, there were just some things that never got finished. It happens a lot with low priority features.



Also tagged with one or more of these keywords: Report, ZScript, Functions, Internal, Drawing, Triangle, 3D

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users