News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

Undocumented Commands in PB1.089c to PB1.27

Started by kevin, December 21, 2005, 11:01:48 PM

Previous topic - Next topic

kevin

Undocumented Commands

The following is a list of  commands were introduced in PlayBasic V1.089, most (if not all) of these commands are yet to added to the documentation.   The follow list is nothing more than the the command name and it's parameters /returns.   Most are self explanatory, but some possibly aren't.  So if your stuck, ask!.  

Also, it should be noted that some existing commands have been renamed and their parameters changed.




GetFree() Changes

  Added automatic quantity control has been added to various command libraries. So most GetFreeItem() functions (like getFreeSprite,GetFreeimage, etc etc ) will always Return a valid dynamic index now, regardless. of the current quantity of that media type.   This means that if the media type runs out, it will be automatically expanded for you.  Making it more transparent to the user.




Dll Binding

LinkDll  / EndLinkDll

 e.g Syntax

 LinkDll  "YourDllName.Dll"
      MyCustomCommand(Param1,Parm2)  Alias "CommandNameInDll"     ;   (  No returns)
      MyCustomFunction(Param1,Parm2)  Alias "FunctionNameInDll"   as integer   ;   (  function returns an integer)
 EndLinkDll


What is DLL binding ?

  This feature allows you import dll's written by 3rd parties into PB as PB commands directly.  While this was already possible through the DLL commands, binding gives us a a far more elegant and faster solution.

 One thing to note however are that your bindings are parsed during pass #2 of compile time,  which makes them a bit different than regular PB functions.  So DLL bindings have to be declared before the functions are used.
 


Mapping Commands

DeleteAllLevels ThisMap
DeleteAllMapAnims ThisMap
ResetMapAnims ThisMap

LevelDrawMode(ThisMap,ThisLevel,DrawMode)
DrawMode=GetLevelDrawMode(ThisMap,ThisLevel)

LevelTransparentTile ThisMap,ThisLevel,Tile
Tile=GetLevelTransparentTile(ThisMap,ThisLevel)


 IMPORTANT -  Renamed Commands

SetMapAnimated = LevelAnimated
SetMapSolid = LevelSolid
SetMapTransParent = LevelTransparent



Collision Changes:

  Run collision now uses the transparent tile of level, rather than defaulting to tile zero as being clear tile.



Added animation types

 Ping Pong map anim types (5 ping pong forward, 6 =backward ping pong)




* File Commands

OpenFile Filename$,FileIndex (for generic read/write file access)

ReadMemory FileIndex,NumberOFBytes,DestAddress

WriteMemory FileIndex,StartAddress,EndAddress




*Bank Commands

BankIndex=NewBank(Size)



*Direct Memory Access Commands

CopyMemory SrcAddress,DestAddress,Size
FillMemory DestAddress,Size,FillPattern,PatternWidth (1,2,3,4)



* Image Commands

ImageQuantity NumbOfImages
NumbOfImages=GetImageQuantity()
ImageIndex=NewImage(Width,height)
ImageIndex=LoadNewImage(filename$)

ScaleImage ThisImage,ScaleX,ScaleY,mode
GetImageType(thisImage) (normal=1 or FX=2)

Changes

DrawRotatedImage now has an added transparent flag on the (0=solid, 1 =transparent)



Sprite Commands

- SpriteQuantity NumbOFSprites
- NumbOFSprites=GetSpriteQuantity()

- ThisSprite = NewSprite(Xpos,Ypos,SpriteImage)


 
Font Commnds

 FontMaskColour ThisFont,MaskColour

 MaskColour=GetFontMaskCOlour(ThisFont)

FontChrWidth(ThisFont,ThisChr,Width)
Width=GetFontChrWidth(ThisFont,ThisChr)

DrawFontChr thisFont,ThisChr,Xpos,ypos

GetFontChr thisFont,ThisChr,Xpos,Ypos

DrawFontChr ThisFont,ThisChr,Xpos,ypos,TransparentFlag



Shape Commands





Scene Buffer Commands

CaptureVis CameraMask  

CameraMask =GetCaptureVis()

Zdepth# =GetCaptureDepth()      




Gfx Commands

CopyRect SrcSurface,x1,y1,x2,y2,DestSurface,x,y

CopyStripV SrcImage,Xpos,Y1,Y2,DestImage,X,Y

CopyStripH SrcImage,Ypos,X1,X2,DestImage,X,Y




Changes

TextureTri now has an added transparent flag
TextureQuad now has an added transparent flag




Music & Sound Commands

DeleteAllSounds

loadMusic Filename$,MusicIndex
DeleteMusic MusicIndex
DeleteAllMusics
PlayMusic MusicIndex
StopMusic MusicIndex
PauseMusic MusicIndex
ResumeMusic MusicIndex
MusicVolume MusicIndex,Volume
MusicFreq MusicIndex,FreqValue
MusicPan MusicIndex,PanValue
LoopMusic MusicIndex,Flag

MusicIndex=GetFreeMusic()
Flag=GetMusicStatus(MusicIndex)
Volume=GetMusicVolume(MusicIndex)
Pan=GetMusicPan(MusicIndex)
Freq=GetMusicFreq(MusicIndex)
Status=GetMusicPlaying(MusicIndex)

kevin

 Undocumented Commands in from  PB1.089c to PB1.27
 

Shapes

ShapeIndex=NewShape(Verts,Edges)
ShapeIndex=NewConvexShape(Radius,Edges)
RefreshShape ThisSHape ;Updates a shape verts bounding box/circle

Flag=LineHitSHape(x1,y1,x2,y2,shapeindex,shapex,shapeY,InterSectFlag)

Quote
   The intersection point and normal can be obtained via GetIntersectX/Y()  and GetNormalX/Y() functions

DrawShape now has display mode 3.  This mode will display the normal of each edge.



Camera / World and Scene

WorldIndex=NewWorld()
CameraIndex=NewCamera()



Vertex Rotation + Mesh Support

TranslateMeshToScene(MeshAddress,VertAddress,RemoveBackfaces,CameraCenterX,CameraCenterY)

RotateVertexListXYZ(SrcListPtr,SrcVertModulo,destListPtr,destVertModulo,basex,basey,basez,anglex,angley,anglez,NumberOfvert)
RotateVertexListZYX(SrcListPtr,SrcVertModulo,destListPtr,destVertModulo,basex,basey,basez,anglex,angley,anglez,NumberOfvert)
RotateVertexList(ObjectPointer,SrcListPtr,SrcVertmodulo,destListPtr,,destvertmodulo)
RotateVertexListToCamera(CameraObjectPointer,ObjectPointer,SrcListPtr,SrcVertmodulo,destListPtr,,destvertmodulo)



Structure of Source Vertex Data. =====================
 0) Float  Xpos#
 4) Float  Ypos#
 8) Float   Zpos#
 
Rotated Vertex Data Structure of destination Vertex Data. ====================
 0) Float  Rotated Xpos#
 4) Float  Rotated Ypos#
 8) Float  Rotated  Zpos#

Translated /Rotated Vertex Data structure ====================
Rotated Vertex Data Structure of destination Vertex Data.
 0) Float  Rotated Xpos#
 4) Float  Rotated Ypos#
 8) Float  Rotated  Zpos#
12) Float  Translated 2D Xpos#
16) Float  Translated 2D Ypos#




Math Functions

Value=MinVal(Value1,value2)
Value#=MinVal#(Value1,value2)
Value=MaxVal(Value1,value2)
Value#=MaxVal#(Value1,value2)

 Result=Log(Value#)
 Result=Log10(Value#)

- Value#=Rnd#(Range) (returns a float)
- Value#=RndRange#(bot#,top#) (returns a float)


* Trial Commands
FastCalc result#=variable+vairable etc etc

 
 FastCalc is a unique command that allows you to by pass the expression resolve and directly feed a list of simple math operations into a math  

 Unlike a normal expression, FastCalc operations are perform linearly across the expression, from LEFT to RIGHT. No precedence is considered.  Brackets are not supported.   The result is returned in the variable you defined to accept it.

 Since FastCalc is a special case, it can only perform operation upon floating point variables.  You can NOT use constants within the expression.

 FastCalc can perform basic operations such as    +, -, /, * and  =.   As well as some math operations (Cos/Sin/Log/ Powers/ Sqaure roots .  
 Example #1
  A#= A# +b#+C#
  FastCalc A#=A# +b#+C#

 Example #2
  A#= cos(a#) * c#
  FastCalc A#=C# * Cos(a#)  ;   Note  Operations like COS/SIN etc can't be the first operation in the FastCalc list

Example #3
 a#= (B#*C#) +(b#+D#)
 FastCalc a#= b# *C=temp#, B#+D#+Temp#





Sprites
Level#=GetSpriteFadeLevel(ThisSprite)




Compiler & Data Types
Explicit Flag (Toggle force declaration ON/OFF)

BytePointer=BytePtr(POinter)
WordPointer=WordPtr(POinter)
intPointer=IntPtr(POinter)
FloatPointer=FloatPtr(POinter)


ElseIF is now supported IF/ElseIF/ELse/Endif


 If Value =1
   ....
 Elseif Value=2
   ...
 Endif



* NOTE
- Dim now support variable and pointer declaration



Important Changes To Random

QuoteThe Random Number creator has been changed, this WILL affect the behavior of code the replied upon the old random sequence. 


Reserved _Future_ Keywords
-Class, EndClass
-Module,EndModule
-Private, Public



 Graphics  - Screen/Image

RGB = FastPoint(Xpos,Ypos)

FastDOT Xpos,Ypos,RgbColour

>>>>WARNING
>>> FASTDOT + FASTPOINT  do Not support clipping
>>> FASTDOT + FASTPOINT can not be captured
>>> FASTDOT + FASTPOINT requires the user to llock/unlock he buffer, before rendering.



Changes

Alpha ADD/SUB inkmodesnow support MMX where available in16bit (565 & 555) formats. (Some 555's modes aren't fully supported yet)


Flag=ScreenModeExist(Width,height,Depth)

CreateFxImage ImageIndex,WIdth,Height

CreateFxImageEx IMageINdex,Width,Height,Depth (15,16,24,32)

Depth=GetImageDepth(ThisImage)

SetBlitBlendImage ImageINdex (for use with BlitImage)

QuoteThis is used in  New BlitImage Modes (32bit only)
mode 32 - Blit with Alpha Combine. 


 Maps and Levels


MapIndex =NewMap(NumberOfLevels)
LevelIndex =NewLevel(ThisMap,Width,Height)

PrepareFXMap MapIndex